Is there anyway the Jenkins Git plugin to set the merge-strategy option to "them"?

I am using Jenkins with a Git plugin. Facts:

  • I have 2 branches develop and rc with the same ancestor.
  • develop is in commit 635d361d2005f74dd55f274bf409d43d6413d9b0
  • I am trying to combine develop it in rc
  • Changes to the x.html file were made independently in both branches, which causes a merge conflict
  • I always want develop changes to change in trump rc when a conflict occurs.

In the project, through the Git plugin, I added the additional behavior "Merge before assembly", and I can set the strategy as "recursive".

Screenshot of Jenkins Git Plugin Additional Behavior Config

This configuration generates a merge that looks like this:

  git checkout -f origin/rc git merge -s recursive 635d361d2005f74dd55f274bf409d43d6413d9b0 

However, I cannot specify any strategy parameters, so this simply creates a conflict.

In particular, I am trying to perform a merge while agreeing to a conflict, as shown below:

  git checkout -f origin/rc git merge -s recursive --strategy-option theirs 635d361d2005f74dd55f274bf409d43d6413d9b0 

Can this be done using a plugin?

+5
source share
1 answer

I don’t think you can set the merge strategy parameter using the Jenkins Git plugin. What I did as a workaround was to remove the Merge Before Build extra behavior. Then, in the “Build” step, add the “Execute shell” build step and invoke the commands you tried to execute.

+3
source

Source: https://habr.com/ru/post/1208167/


All Articles