Vin Shahrdar
Vin Shahrdar

Reputation: 1221

How to merge into a temporary branch before Jenkins build

I have the following Gitlab + Jenkins setup:

  1. I have a branch called "Develop"
  2. I have feature branches "F1", and "F2", and so forth.
  3. When the author of "F1" creates a merge request, Gitlab will trigger a Jenkins build, which currently checks out and builds F1.

I want Jenkins to do the following:

  1. Clone develop to a local branch named "Temp"
  2. Merge F1 to Temp
  3. Build my solution in Temp and Run the Tests
  4. Report the build result back to Gitlab

Is something like this possible in Jenkins? I know Git plugin has an option called "Checkout to a Specific local Branch", but I am not entirely sure if this does what I want.

Any help/input regarding this issue would be highly appreciated. Thanks and Cheers :)

Upvotes: 5

Views: 2058

Answers (1)

T Percival
T Percival

Reputation: 8674

There is a "merge before build" action in the Git plugin. It only merges on the build machine — it doesn't push the merge back to the origin repository.

"Merge before build" parameters

Upvotes: 8

Related Questions