I often push a work-in-progress (WIP) branch to GitLab to share with my team or as a backup. I don’t necessarily want to run the CI/CD pipeline on this branch: the tests aren’t updated and it’s not ready for a feature branch deployment. GitLab provides several ways to skip the pipeline.
Git push option
One way to skip the pipeline is to pass the ci.skip
push option to Git:
git push -o ci.skip origin my-branch
The branch is pushed to the server, but the pipeline isn’t created.
Commit message
Another way to skip the pipeline is to include [ci skip]
or [skip ci]
in
your commit message. Again, the branch is pushed, but the pipeline isn’t
created.
Custom rules
It’s also possible to run the pipeline and skip specific jobs based on the
commit message. For example, this job from the
.gitlab-ci.yml
reference
is skipped if the commit message contains skip-end-to-end-tests
:
end-to-end:
script: rake test:end-to-end
except:
variables:
- $CI_COMMIT_MESSAGE =~ /skip-end-to-end-tests/