Merging git branches to master using Jenkins

411 views
Skip to first unread message

Alex Brodov

unread,
Sep 30, 2015, 11:58:43 AM9/30/15
to Jenkins Users
I want to create a modular process which will merge the "devel" branch upon each successful build to the master branch, and it will also create a tag. Is there any way to do it using Jenkins and Git plugin rather than writing code. If yes, is there any option to provide Git plugin the repository URL as a parameter, so it will be as modular as possible. The job that I want to create will be performing only the merge (git merge --no-commit -X theirs) operation and it will create a tag (the tag name will be provided as a parameter as well).This job will be triggered by other jobs.

milki milk

unread,
Sep 30, 2015, 12:09:26 PM9/30/15
to Jenkins Users
Under Advanced Features in https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin, the docs talk about pre-build branch merging. You can specify the merge type as well - ff, or no-ff. By default, the plugin makes a new tag. As a post-build tag, you can then push the branch and tag back to the repository.

You can provide the url as a parameter to the job and then use that variable as the repository url.

A warning though, a non-ff merge is done as (git merge --no-ff $GIT_SHA) and you can't customize the tag name. This method might not be flexible enough for your needs. Typically, I do manually merging and tagging as build steps.
Reply all
Reply to author
Forward
0 new messages