Reputation: 354
Is there a way to execute a stage just once, only the first time that the pipeline is executed
For example, if I have this stages
I wanna execute N pipelines but without execute 'tag_version' the next times, just execute it at the first time
Upvotes: 0
Views: 42
Reputation: 354
I solved using the following rule, catching the push event and matching with my tag that I wanna tag. In this way my stage is executed once
.mycondition: &mycondition
rules:
- if: '$CI_COMMIT_TAG =~ /^release-v\d+$/ && $CI_PIPELINE_SOURCE == "push"'
when: always
Upvotes: 1
Reputation: 1988
You can use rules: changes
, maybe combined with when: manual
, so that the tag is executed only when a specific file is changed (say, the Dockerfile).
See https://docs.gitlab.com/ee/ci/yaml/#ruleschanges
Upvotes: 1