How to run a build, when there is merge request from feature to master branch in GitLab before accepting the merge request

Viewed 272

I have a created a Jenkins pipeline job and also added the webhook for the piepline in GitLab for the merge events and for the merge request my pipeline is executing.

But I am not able to get after raising the merge request, how can I test the requested merge code before accepting the merge request. (Can I create some temporary branch from gitlabTargetBranch? is it possible)

I am using the two variables gitlabSourceBranch and gitlabTargetBranch in the checkout stage.

Can anyone please suggest what should be added in checkout stage for the above?

Thanks!

1 Answers

One alternative would be to use a "gate" repo, a GitLab repo (fork of your first one) where your PR applies, and you run your test after accepting that PR.

If those tests pass, then that would trigger a new PR to the final actual target repo, which can then be automatically accepted.
That way, that final PR has been tested before being accepted.

Related