Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab-CI : triggering a stage based on the Status of the previous stage

enter image description here

Hello - I'm using Gitlab 10.x Enterprise version.

This is in the context of a Production deployment to an environment having eight servers. The requirement is to deploy to one server first, and then after couple of days do a deployment to the remaining servers with the press of just one button.

Pipeline Stages: Release-Tag-Creation -> Production-OneServer-Deployment -> OneButtonPush -> DeploytoAllServers

Question:

How can I tie the dependency between the stages "OneButtonPush" and "DeploytoAllServers"?. "DeploytoAllServers" stage should be kicked-off only when the Status of the job in the "OneButtonPush" stage is successful. "DeploytoAllServers" stage will have parallel jobs to deploy to each server.

I made few attempts based on the Gitlab CI documentation, but wasn't successful. Also, can the concept of Rolling deployment used in the context of GitLab-CI.

Thanks!

like image 271
Raj R Avatar asked Oct 28 '25 14:10

Raj R


1 Answers

In Gitlab CI, the stages are run one after another. Each stage can have multiple jobs which run in parallel.

As per your use case, you'll need to have different stages each for Release-Tag-Creation, Production-OneServer-Deployment, OneButtonPush and DeploytoAllServers. You can have manual triggers for particular jobs (OneButtonPush in your case) by specifying when: manual in the job definition.

By default, if there is a job awaiting manual trigger, jobs from further stages will start executing considering the job with manual trigger as successful. To change this behavior one will need to use allow_failure: false. Mode details on allow_failure over here

like image 63
Dhruvil Vaghela Avatar answered Oct 31 '25 10:10

Dhruvil Vaghela



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!