gitlab-ci

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


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?


Solution

  • 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