Easy way to enable/disable pipeline stages

Presently, we can enable/disable stages only through .yml file. Which requires updating the file, creating a MR and merging it to see the changes in the pipeline. This is cumbersome process. It would be good to support to enable/disable stages using configuration UI once the basic pipeline has been created using yml file.

Many times some stages fail because of issues with software update like code analysis, coverity scan etc having easy way to disable the stages will be very helpful.

1 Like

Hi there!

Couple of thoughts:

  1. you can create customized pipelines based on changes, branches, etc (“when” comes to mind) : https://docs.gitlab.com/ee/ci/yaml/#when

  2. Building on #1 - you could create “when:manual” jobs & run these if you want the job to kickoff in the pipeline view.

If neither of the above works then suggest creating an issue on gitlab.com -> https://gitlab.com/groups/gitlab-org/-/boards/1290681?&label_name[]=UX&label_name[]=devops%3A%3Averify

These methods are to enable/disable jobs. The question was about stages. Is there a facility to handle entire stages?

Hi Frakman -

To add - I’ve been using CI rules to pass variables to skip jobs & stages.

Here’s an example of a cross project pipeline that uses variables & rules using two projects:

Project A / developer code
Project B / Terraform/IaC code

Flow:

  1. Project A calls Project B to deploy infrastructure
  2. Project B runs the stages & jobs if there’s a match on a passed variable. The variable & value = CLUSTER_STATE & “UP”
  3. Project B returns a completion to Project A.
  4. Project A “builds” code.
  5. Project A then calls Project B to run a new pipeline. The variable passed & value = CLUSTER_STATE & “DOWN”
  6. Project B ONLY runs a single stage/job - the “destroy” stage & job.

The linked projects are a step above pseudocode. I wanted to test out the Terraform state management that we recently released.

Does this help?

Kelly

1 Like

Is there a good reason why when: never is not supported (outside of an if-statement)?

Are they just worried people will start disabling jobs with “when: never” instead of actually deleting them from the code?

We (I am working for an organization using GitLab Ultimate) also have a use case for which we haven’t found any good mechanism yet: We use Renovate to upgrade our dependencies in our project and would like to add a job in the GitLab pipeline for this. But when running this job we don’t want any of the other jobs to run. So the Renovate job and all other jobs are mutually exclusive. From what I can tell I would have to add rules to every single job to make sure that the job isn’t executed when running the Renovate job. The only feature I found which helps here is reference tags, but this also doesn’t really help when additional jobs are included from another file (unless those jobs also all use the same reference tags in their job rules).

Thus I was thinking it would be nice if the stages could be configured with rules, so that I could have a separate stage for Renovate and in the stages rules could declare which stages are actually to be considered when running the pipeline.

Possibly I have overlooked some existing mechanism which would help with our use case. If so, please let me know!

Thanks!