Merged results pipelines (PREMIUM)
- Renamed from
pipelines for merged results
tomerged results pipelines
in GitLab 14.8.- Introduced in GitLab 15.1, merged results pipelines also run on Draft merge requests.
A merged results pipeline is a type of merge request pipeline. It is a pipeline that runs against the results of the source and target branches merged together.
GitLab creates an internal commit with the merged results, so the pipeline can run against it. This commit does not exist in either branch, but you can view it in the pipeline details. The author of the internal commit is always the user that created the merge request.
The pipeline runs against the target branch as it exists at the moment you run the pipeline. Over time, while you're working in the source branch, the target branch might change. Any time you want to be sure the merged results are accurate, you should re-run the pipeline.
Merged results pipelines can't run when the target branch has changes that conflict with the changes in the source branch.
In these cases, the pipeline runs as a merge request pipeline
and is labeled as merge request
.
Prerequisites
To use merged results pipelines:
- Your project's CI/CD configuration file must be configured to run jobs in merge request pipelines.
- Your repository must be a GitLab repository, not an external repository.
- You must not be using fast forward merges. An issue exists to change this behavior.
Enable merged results pipelines
To enable merged results pipelines in a project, you must have at least the Maintainer role:
- On the top bar, select Menu > Projects and find your project.
- On the left sidebar, select Settings > General.
- Expand Merge requests.
- Select Enable merged results pipelines.
- Select Save changes.
WARNING: If you select the checkbox but don't configure your pipeline to use merge request pipelines, your merge requests may become stuck in an unresolved state or your pipelines may be dropped.
Troubleshooting
Merged results pipelines are not created
In GitLab 13.7 and earlier, merged results pipelines might not be created due
to a disabled feature flag. This feature flag
was removed in GitLab 13.8.
Upgrade to 13.8 or later, or make sure the :merge_ref_auto_sync
feature flag is enabled
on your GitLab instance.
fatal: reference is not a tree:
error
Pipelines fail intermittently with a Merged results pipelines run on a merge ref for a merge request
(refs/merge-requests/<iid>/merge
), so the Git reference could be overwritten at an
unexpected time.
For example, when a source or target branch is advanced, the pipeline fails with
the fatal: reference is not a tree:
error, which indicates that the checkout-SHA
is not found in the merge ref.
This behavior was improved in GitLab 12.4 by introducing persistent pipeline refs. Upgrade to GitLab 12.4 or later to resolve the problem.