5

When pushing a commit two pipeline jobs are triggered. But the same thing has not occurred when starting the pipeline manually.

Where I should check? What is the meaning of the arrow from the left or from the right indicating branch activities?

One thing I have to say is that there is a merge request pending, does it cause this issue?

enter image description here

2 Answers 2

6

The thing with your solution is that it only avoids pipeline execution when you have a merge request event, but there still will be duplicate pipelines, e.g. merge-request pipelines (the detached ones) and branch pipelines (others), also when pushing a tag your setup will create a separate pipeline I think.

Following the docs you can avoid duplicate pipelines and switch between Branch- and MR-Pipelines when using the following rules-set for workflow (I added the || $CI_COMMIT_TAG) since when pushing a tag also a pipeline should be created (but maybe only a few jobs will be added into this pipeline)

workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
      when: never
    - if: '$CI_COMMIT_BRANCH' || '$CI_COMMIT_TAG'

this pipeline is a merge-request pipeline, you can see this because it's detached and because of the Merge-Request Symbol and the number of the MR on the left hand side of the commit id

merge-request pipeline

The following screenshot shows a 'normal' branch-pipeline, which is denoted by the branch-name and the GitLab branch symbol on the left of your commit id

branch-pipeline

Sign up to request clarification or add additional context in comments.

Comments

2

Pending merge request cause second pipeline jobs triggered. After adding the following into gitlab-ci.yml file it is resolved

workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      when: never
    - when: always

1 Comment

The first rule does not avoid duplications in your pipeline, it only avoids pipelines from being generated on opening a merge-request, see answer below for further info and updated rule-set, but this is a quite tricky topic where I already spent lots of hours fixing duplicate pipelines

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.