I'm in the process of setting up a build script for a CI pipeline in gitlab. I want the job to wait for manual input before running. I can't seem to find a configuration that works however. If I make one of the stages 'manual' the other stage will still run as soon as I push a change. If I use allow_failure: false as described here: https://about.gitlab.com/blog/2021/05/20/dag-manual-fix/ the job hangs at pending once I trigger it. I'm not sure what I'm doing wrong here. Any suggestions?
For reference, my gitlab-ci-yml looks like:
stages:
- build
- deploy
build-dev:
stage: build
tags:
- development
script:
- echo "building message center..."
deploy-dev:
stage: deploy
tags:
- development
variables:
NODE1: "99099"
script:
- echo shutting down tomcat for node $NODE1...
when: manual
allow_failure: false
With a small modification as below it would work the way you wanted
stages:
- build
- deploy
build-dev:
stage: build
tags:
- development
script:
- echo "building message center..."
when: manual
allow_failure: false
deploy-dev:
stage: deploy
tags:
- development
variables:
NODE1: "99099"
script:
- echo shutting down tomcat for node $NODE1...
Now, the moment you commit your code, the pipeline will be created but it will get blocked at build stage waiting for a manual start from you. Once manually triggered and if the build stage is successful, the deploy stage will automatically run.
Any failure in build stage will not let the deploy stage proceed. The status of deploy stage would be "skipped" in this case and you cannot run the deploy stage as build has failed.