Search code examples
gitlabyamlcontinuous-integrationtagsgitlab-ci

Gitlab CICD Tags pipeline duplication


i have gitlab-ci.yml file with simple workflow like

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE != "merge_request_event"

There is job that automate code analisys and it also have simple rule

  rules:
    - if: $CI_COMMIT_BRANCH != "main"

When i create tag it trigger code_analisys job and i want to prevent that. Tried with:

- if: $CI_COMMIT_TAG == null

But the problem is still occuring.


Solution

  • If you do not want to trigger the pipeline when pushing a tag, use the following rule:

    rules:
      - if: $CI_COMMIT_TAG
        when: never