mercredi 2 octobre 2019

if else command on gitlab ci yaml file

ı have a yaml file and I need if true message sended yaml file will be succesful.else yaml file will be fail

ı want to that, if respond message is true yaml file success but else yaml file will fail

variables:
  NUGET_PATH: 'C:\Tools\Nuget\nuget.exe'
  MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\amd64\msbuild.exe'
  SOLUTION_PATH: 'Textbox_ComboBox.sln'

stages:
  - build
  - job1
  - job2

before_script:
  - "cd Source"

build_job:
  stage: build
  except:
    - schedules
  script:
    - '& "$env:NUGET_PATH" restore'
    - '& "$env:MSBUILD_PATH" "$env:SOLUTION_PATH" /nologo /t:Rebuild /p:Configuration=Debug'

job1:
  stage: job1
  script:
    - 'curl adress1'
    -  -  if [ "$message" == "SAP transfer started. Please check in db" ]; then exit 0; else exit 1; fi


job2:
  stage: trigger_SAP_service
  when: delayed
  start_in: 5 minutes
  only:
    - schedules
  script:
    - 'curl adress2'

I expect output job succeed. if message is SAP Transfer started.Please check in db.But else yaml file fail. Could someone provide the correct syntax for the same? Is there any documentation for the conditions (if-else, for loop) in gitlabci?

Aucun commentaire:

Enregistrer un commentaire