When I use release-cli
in .gitlab-ci.yml
with the tag option in my release job it is creating a new pipeline with only the build job in it. The upload and release jobs in my three stage pipeline are not being retriggered. How do I prevent the tag from triggering a new job?
Here is the .gitlab-ci.yml
step I'm using in my release job:
- >
release-cli create
--name "My Program"
--tag-name v${VERSION}
--assets-link "{\"name\":\"${ARCHIVE_NAME}\",\"url\":\"${PACKAGE_URL}\"}"
I have tried this but it does not suppress the extra trigger:
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
when: always
- if: $CI_COMMIT_TAG
when: never
also from this answer I have tried "except: -tags" in the build job and also all three jobs but this breaks my pipeline from working. I suspect this syntax might no longer be valid in the version EE v17.10.3 of gitlab I am using.
script:
- echo "Project pipeline ID = $CI_PIPELINE_IID"
- echo "Current commit SHA = $CI_COMMIT_SHA"
- echo "Running pipeline for branch/tag = $CI_COMMIT_REF_NAME"
- echo "Is this specifically a branch build? Branch = $CI_COMMIT_BRANCH"
- echo "Pipeline triggered by = $CI_PIPELINE_SOURCE"
- ./Scripts/Build.ps1 -a -w
- echo "Completed building"
except:
- tags
For GitLab EE v17.10.3 found this to suppress undesired tag triggered pipelines:
# prevent tags triggering the pipeline
workflow:
rules:
- if: $CI_COMMIT_MESSAGE =~ /-draft$/ # not tested yet
when: never
- if: $CI_COMMIT_TAG
when: never
- if: '$CI_PIPELINE_SOURCE == "push"'
when: always
# below will duplicate pipelines during a merge request, there must be two events being processed
#- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# when: always
- when: never