Issue:
When performing a maven release, it is necessary that the local branch name 
is the same as the remote branch sans "origin/" to allow successful pushes 
of the updated pom files.

The maven release plugin does a push as "git push origin 
{local_branch}:{local_branch}".

As a result of this, we must checkout to a local branch.  A detached head 
does not work.  In the interest of creating a single Jenkins job that can 
build and release any branch, we configure the job with:
Git Parameter, to allow selecting any branch specified by ${BRANCH}.
Git Plugin builds branch specified by ${BRANCH}

Unfortunately, ${BRANCH} will be origin/master, or origin/some-other-branch

We need to specify a separate parameter for local branch, and use this 
parameter in the Local Branch extension.  This approach requires the build 
person to enter the branch twice, once in the Git Parameter, and manually 
in a separate string parameter to specify the local branch to build.

Proposal:
To simplify this sequence, I have modified the git plugin GitSCM.checkout() 
method to allow the Local Branch extension to be specified without a value. 
 In this case, the local branch is derived from the remote branch being 
built.  In addition, the environment variable GIT_LOCAL_BRANCH is set.

If the LocalBranch extension specifies a value, that value is used asis. 
 If the value is null (LocalBranch was configured, but not set) then the 
value is derived from GIT_BRANCH by removing 'origin/'.

Help Needed:
I have cloned the git plugin, and updated GitSCM.commit() and the 
GitSCMTest.  The project builds, but my new test cases fail because 
GIT_BRANCH and GIT_LOCAL_BRANCH have not been set.  From this I conclude 
that I do not understand the test infrastructure.  

I will appreciate a code review of the changes in 
https://github.com/mlgiroux/git-plugin.git.  I'm reluctant to create a PR 
back to the jenkins/git-plugin repo since this is my first attempt to 
contribute, and I'm not entirely sure of the process.  Guidance appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/7fce8a79-4657-464b-afe2-64589c4e7c36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to