Prevent all CI jobs from from running on certain branches

During collaboration on a project, it is common for our development team to share bug repro’s by creating branches labelled repros/branch_name. Obviously, we don’t want CI/CD running on any commit in these branches.

I have seen that one way to do this is by using the except parameter in the job’s configuration. However, we run a number of different jobs during our CI/CD and in It would be preferable if there was a way to disable all CI/CD for certain branch labels.

Any help with this would be greatly appreciated!



You can try workflow:rules. From the documentation,

The top-level workflow: key applies to the entirety of a pipeline, and will determine whether or not a pipeline is created.

So, based on a condition, you can prevent all jobs from running. In your case, the condition might be something like:

    - if: $CI_COMMIT_REF_NAME =~ /repros\/.*$/
      when: never