Automatic Merge Branch with Master on gitlab pipeline succeeds

How can I perform the Gitlab Branch merge with the master automatically?

Is anyone knows about it please help me with this development activity?

Upvotes: 0

Views: 1575

Answers (1)

Adam Marshall
Adam Marshall

Reputation: 7649

Currently there is no way to set the Merge When Pipeline Succeeds option project-wide, it has to be done for each merge-request. However, Gitlab does support the use of git push-options to interact with some merge request settings. To create a merge request and set it to merge when the pipeline finishes, you can do: git push -o merge_request.create -o merge_request.target=my-target-branch -o merge_request.merge_when_pipeline_succeeds.

You can also set a git alias to set any push options you need when you push: git config --global alias.push_merge "push -o merge_request.create -o merge_request.target=master -o merge_request.merge_when_pipeline_succeeds"

and use it with git push_merge my_branch.

You can view all the available push options that Gitlab supports, and useful aliases in the docs here: https://docs.gitlab.com/ee/user/project/push_options.html

Upvotes: 1

Related Questions