0

On my gitlab.ci.yaml response status must be 200 otherwise job should be fail and must write transfer already started.

But I don't know how to write if statement for that.

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'


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

How to add if condition for status=200 and transfer started in response ?

Nicolas Pepinster
  • 5,413
  • 2
  • 30
  • 48
mrbytr
  • 23
  • 1
  • 2
  • 8
  • 1
    You can either call an external script or the [script tag](https://docs.gitlab.com/ee/ci/yaml/#script) for this purpose or you may consider using [only/except](https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-basic) – Arihant Godha Sep 23 '19 at 07:55
  • could you give an example? – mrbytr Sep 23 '19 at 08:10
  • Possible duplicate of [How to fail a build on Gitlab CI shell runner](https://stackoverflow.com/questions/36619212/how-to-fail-a-build-on-gitlab-ci-shell-runner) – Arty-chan Sep 25 '19 at 03:05

0 Answers0