GitLab steht Mittwoch, den 08. Juli, zwischen 09:00 und 13:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

merge_when_build_succeeds.md 2.03 KB
Newer Older
1 2 3
# Merge When Build Succeeds

When reviewing a merge request that looks ready to merge but still has one or
4 5 6
more CI builds running, you can set it to be merged automatically when the
builds pipeline succeed. This way, you don't have to wait for the builds to
finish and remember to merge the request manually.
7 8 9 10 11

![Enable](img/merge_when_build_succeeds_enable.png)

When you hit the "Merge When Build Succeeds" button, the status of the merge
request will be updated to represent the impending merge. If you cannot wait
12 13
for the pipeline to succeed and want to merge immediately, this option is
available in the dropdown menu on the right of the main button.
14 15 16 17 18 19 20

Both team developers and the author of the merge request have the option to
cancel the automatic merge if they find a reason why it shouldn't be merged
after all.

![Status](img/merge_when_build_succeeds_status.png)

21 22 23
When the pipeline succeeds, the merge request will automatically be merged.
When the pipeline fails, the author gets a chance to retry any failed builds,
or to push new commits to fix the failure.
24 25 26 27 28

When the builds are retried and succeed on the second try, the merge request
will automatically be merged after all. When the merge request is updated with
new commits, the automatic merge is automatically canceled to allow the new
changes to be reviewed.
29 30 31 32 33 34 35 36 37 38 39 40 41 42

## Only allow merge requests to be merged if the build succeeds

> **Note:**
You need to have builds configured to enable this feature.

You can prevent merge requests from being merged if their build did not succeed.

Navigate to your project's settings page, select the
**Only allow merge requests to be merged if the build succeeds** check box and
hit **Save** for the changes to take effect.

![Only allow merge if build succeeds settings](img/merge_when_build_succeeds_only_if_succeeds_settings.png)

43
From now on, every time the pipeline fails you will not be able to merge the
44
merge request from the UI, until you make all relevant builds pass.
45

46
![Only allow merge if build succeeds message](img/merge_when_build_succeeds_only_if_succeeds_msg.png)