I would like two jobs to run in parallel in Gitlab CI but I want to launch them manually. Basically I have multiple jobs needed to deploy my code to staging (build the server, build the frontend). I want to deploy to staging by clicking ONE button (hence making the jobs manual) but I want both of them to run at the same time in parallel (faster). I don't want both jobs to be manual because it displays two buttons in the Gitlab UI and someone could deploy only one part.
I tried creating a third, empty job, that would be manual, and have the real deploy jobs run automatically when the empty job has completed. However, even an empty job with just an “echo” takes > 30 seconds and I feel this is dumb. Here is my current solution that does not convince me:
start-release:
stage: build-and-deploy-to-staging
rules:
- when: manual
script:
- echo "Starting staging deployment"
release-api-staging:
stage: build-and-deploy-to-staging
script:
- "ENV_NAME=staging STEP=release_api release/deploy.sh"
when: on_success
needs:
["start-release-staging"]
release-frontend-staging:
stage: build-and-deploy-to-staging
script:
- "ENV_NAME=staging STEP=release_frontend release/deploy.sh"
when: on_success
needs:
["start-release-staging"]
Do you have any idea how I could manage this?
Thanks a lot!