Feature Proposal: Option for multiple jobs within a stage to run sequentially
Problem to solve
Today when building a CI/CD pipeline, if you have a stage with multiple jobs they all run in parallel with no way to allow them to run sequentially instead. There are valid use cases where you'd want to have dependent jobs run for a particular stage without having to create separate stages for each job which makes the pipeline fatter than it needs to be.
Intended users
Developers, DevOps Engineers
Further details
Real life use case:
An example that I currently face is when I'm dynamically building a staging environment in our internal cloud to host a review app.
I need to first provision a floating ip address before I can build the infrastructure. And I can't deploy the app to staging until I build the infrastructure.
So under a stage called STAGING, I'd like to have 3 jobs that run in sequenece: Generate IP > Build Infrastructure > Deploy App
Today since they run in parallel, it is possible that the Build Infrastructure step might try to complete before the Generate IP step does which would cause a failure. So the only workaround is to run these 3 jobs in separate stages which makes the pipeline too long and ugly.
Proposal
When defining stages in the .gitlab-ci.yml file, allow some way to indicate a stage should process jobs sequentially:
For example, today I have to define stages like this:
stages:
- build
- staging_ip
- staging_build
- staging_deploy
- change_validation
- prod_deploy
- cleanup
Under this proposal, it would change to something like this:
stages:
- build
- staging:SEQUENTIAL
- change_validation
- prod_deploy
- cleanup
Permissions and Security
I don't think any extra permissions would be needed to apply this.
Testing
Regression testing would need to be performed to ensure that non sequentially tagged stages still run in parallel as they do today.
What does success look like, and how can we measure that?
Success would be that jobs within a stage run in sequence when tagged accordingly.
What is the type of buyer?
I think this could be a Premium and Ultimate feature.