gitlab-ci skipped the manual step and continue
I have the following GitLab-ci YAML file. the manual job gets skipped, and the pipeline completes successfully even though the manual job did not get triggered.
How can I fix it and why did this happen?
stages:
- stage1
- stage2
job1:
stage: stage1
script:
- echo "this is an automatic job"
manual_job:
stage: stage2
script:
- echo "This is a manual job"
when: manual
This happens because manual jobs are considered optional, and do not need to run.
Internally, manual jobs have allow_failure set to true by default, which means that these skipped manual jobs do not cause a pipeline failure. The YAML code below demonstrates how to write the manual job, which results in the same behavior. The job doesn't automatically start, is skipped, and the pipeline passes.
stages:
- stage1
- stage2
job1:
stage: stage1
script:
- echo "this is an automatic job"
manual_job:
stage: stage2
script:
- echo "This is a manual job"
when: manual
allow_failure: false
You can set allow_failure to true for any job, including both manual and automatic jobs, and then the pipeline does not care if the job runs successfully or not.