How to auto merge Git branches prior to a Jenkins build?

后端 未结 2 1610
野的像风
野的像风 2021-02-04 01:15

How to auto merge Git branches prior to a Jenkins build?

I have 2 builds, one for branch master and one for production.

I would like to do Git merge <

相关标签:
2条回答
  • 2021-02-04 01:19

    You can do premerging via extensions block in pipelines (assuming you configured checkout: [ $class: 'GIT_SCM' ] already.)

    [
            $class: "PreBuildMerge",
            options: [
                mergeTarget: "master",
                fastForwardMode: "FF",
                mergeRemote: "origin",
                mergeStrategy: "OURS"
            ]
    ]
    
    0 讨论(0)
  • 2021-02-04 01:20

    That's supported by the latest Git Plugin on Jenkins. Just set "Checkout/merge to local branch" to "production" under the Advanced settings for Git in the Job configuration. Then set the "Branches to build" to master, or just leave it blank to have Jenkins try and merge and build each other branch it finds to production. It will do one merge/build for each branch. It can also push the merged branch back to the source it pulled from.

    Check this out: https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-AdvancedFeatures

    0 讨论(0)
提交回复
热议问题