The idea is to allow the following functions in the Gitlab Workflow config -
- Branch pipelines
- MR pipelines with MR labels
- Schedule pipelines
And to run without creating duplicate pipelines (branch and MR) during the MR process.
The workflows are -
- Open a feature branch and push, this triggers two initial stages.
- If the initial stages pass, then an MR is created, and the more stages are introduced on top of the initial stages.
All of the above works in various combinations, but not all together.
The following workflow does not work for branch pipelines, all else is fine.
workflow:
rules:
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_PROTECTED == "true"
Current versions
- Gitlab v16.3.4-ee
- Runner v16.3.0
Any ides or tips on the above would be much appreciated :~)
A working Gitlab Workflow config can be seen here -
Each of the jobs extend rules like so
For plan_rules it was needed only for merge requests and not branch pipelines
So I tried
But the above triggered a duplicate pipeline during the merge request pipeline.
By updating plan_rules to
Duplicate pipelines no longer appear!