1

In gitLab, I create CI to build the project, for each stage I have 2 job seperately

Build BookProject:
  stage: build  
  <<: *dotnetbuild_job 
  when: manual 
 
Build ShopProject:
  stage: build
  <<: *dotnetbuild_job
  when: manual

Deploy BookProject:
  stage: Deploy 
  needs: ["Build BookProject"]
  <<: *dotnetdeploy_job 
  when: on_success 
 
Deploy ShopProject:
  stage: Deploy
  needs: ["Build ShopProject"]
  <<: *dotnetdeploy_job
  when: on_success

I find that when Build BookProject: job return ERROR: Job failed: exit code 1, which the job icon show !, the Deploy BookProject: are still continue to run, even I set when: on_success, can I know how to prevent it ?

sytech
  • 29,298
  • 3
  • 45
  • 86
Emily
  • 103
  • 8
  • Exit code 0 is success, so it's expected to move on. If the exit code is unexpectedly 0, we need more information to figure out why. Including your job script and the job output may help. – sytech Aug 28 '22 at 10:14
  • sorry , it should be ERROR: Job failed: exit code 1 – Emily Aug 28 '22 at 12:25
  • Try adding `allow_failure: false` to your manual build jobs. – sytech Aug 28 '22 at 14:21

1 Answers1

0

When jobs specify when: manual, it implies allow_failure: true.

To avoid this behavior, specify allow_failure: false on your manual build jobs.

sytech
  • 29,298
  • 3
  • 45
  • 86
  • but when I set allow_failure: false, if another job Build ShopProject is not run is that it cannot define as pass ? – Emily Aug 29 '22 at 08:21