Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a better way to disable/skip a job in a GitLab CI pipeline than commenting everything out?

Tags:

gitlab-ci

I have a job in a GitLab CI pipeline that I want to temporarily disable because it is not working. My test suites are running locally but not inside docker, so until I figure that out I want to skip the test job or the test stage.

I tried commenting out the stage, but then I get an error message from the CI validation: test job: chosen stage does not exist; available stages are .pre, build, deploy, .post

So I can simply comment out the entire job, but I was wondering if there was a better way?

like image 939
tillsanders Avatar asked Feb 09 '21 09:02

tillsanders


People also ask

What is used to restrict when a job is executed on your pipeline?

Run jobs for scheduled pipelines To configure a job to be executed only when the pipeline has been scheduled, use the rules keyword.

Which file is used to specify the jobs within the GitLab CI pipeline?

gitlab-ci. yml file. Jobs are: Defined with constraints stating under what conditions they should be executed.

How do I stop a running pipeline in GitLab?

To enable or disable GitLab CI/CD Pipelines in your project: Navigate to Settings > General > Visibility, project features, permissions. Expand the Repository section. Enable or disable the Pipelines toggle as required.

Can GitLab runner run multiple jobs?

One way to allow more jobs to run simultaneously is to simply register more runners. Each installation of GitLab Runner can register multiple distinct runner instances. They operate independently of each other and don't all need to refer to the same coordinating server.


1 Answers

Turns out, there is! It's quite at the end of the very thorough documentation of GitLab CI: https://docs.gitlab.com/ee/ci/jobs/index.html#hide-jobs

Instead of using comments on the job or stage, simply prefix the job name with a dot ..

Example from the official documentation:

.hidden_job:
  script:
    - run test
like image 123
tillsanders Avatar answered Oct 17 '22 21:10

tillsanders