I'm using GitLab for code evolution management. All smooth about that. Use merge-requests to review code changes. I also generally use GitFlow , except using the name
rc-* for release branches (GitFlow predicts
Briefly about GitFlow, it has nomenclature for whites, each one has a goal:
masteris the branch with production code, so relatively stable code
developis the branch with development code, so relatively unstable code
rc-*is the branch with the release candidate , is derived from
developand (when mature enough) will be integrated into
rc-1.2is the release candidate for version
For example, I might want GitLab to only run the
deploy-lib job on the
build: stage: build script: - mvn compile deploy-lib: stage: deploy script: - mvn deploy only: - master - develop
I would like to add a job to only run on branches that follow the
rc-* pattern . I didn't find anything in the documentation regarding the pattern name for
jobs:only , but this is used in many places in GitLab web.
So, I ask:
- Can I configure GitLab-CI to only run a certain job for branches that satisfy the
rc-*pattern ? If yes, how do I do this?
According to the documentation, yes, it is possible.
Read the detailed documentation
In addition to keywords (such as
tags ), you can specify the name of the verbatim branch . In question,
job:deploy-libs will run when called in the
develop branch .
To use regular expressions, enclose the expression /in slashes/ . So, as you want to add the pattern
rc-* , in regex the equivalent would be (already putting the required slashes)
In this case, the
.gitlab-ci.yml would look like this:
build: stage: build script: - mvn compile deploy-lib: stage: deploy script: - mvn deploy only: - master - develop - /^rc-.*$/