Let’s consider the following setup:
- A
build
job triggered automatically, without any dependencies. - A
test
job triggered manually, needing thebuild
job to be finished. - A
deploy
job triggered manually, needing thebuild
andtest
job to be finished.
The corresponding .gitlab-ci.yaml would be the following:
stages:
- build
- test
- deploy
build:
stage: build
needs: []
script: [...]
test:
stage: test
needs: [build]
rules:
- when: manual
allow_failure: true
script: [...]
deploy:
stage: deploy
needs: [test, build]
rules:
- when: manual
allow_failure: true
script: [...]
My issue is that if I want to trigger the deploy
job, I need to
- wait for the build job to finish,
- trigger the
test
job manually, - wait for the
test
job to finish, - and then trigger the
deploy
job.
Is there any way to automatically do that by only clicking one button?
In other words, I would like to be able to trigger both test
and deploy
jobs all at once, even before the end of the build
job, so that they turn in waiting
status, and then run one after another automatically according to their dependency rules.
NB1: I know there are ways to do that with rules based on branch name, tag, commit message etc. But I really want to be able to decide to launch the deploy
job (with its dependencies) from any commit in the Gitlab UI, without having to push something specific. And I also want to keep the possibility to run the test
job independently from the deploy
job.
NB2: My use-case is in reality much more complicated with dozens of dependent jobs, and I am looking for an easy way to manually trigger all the upstream dependencies of a manual job without having to run each stage manually one after another.