I am using the current version of the Git plugin (provider and publisher of SCM) on Jenkins 1.500. The SCM poll works fine using my Git HTTP URL and the build branch settings for the feature- * feature. This picks up changes in any branch, for example, "feature-1234", runs build / testing / coverage tasks and reports on success or failure. All of this works great, including merging with the integration branch, where the code should exit after successfully building and validating the code.
The problem is trying to bring the completed BACK assembly branch to the beginning, to the same branch "feature-1234". In this case, the assembly variable "GIT_BRANCH" contains "origin / feature-1234", which causes the following error and failure in Git Publisher after a successful build:
Pushing HEAD to branch origin/feature-1234 at repo origin ERROR: Failed to push branch origin/feature-1234 to origin hudson.plugins.git.GitException: Command "/usr/bin/git push https://jenkins:jenkinsPWD@myproject.com/git/project HEAD:origin/feature-1234" returned status code 1: stdout: stderr: error: unable to push to unqualified destination: origin/feature-1234 The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref. error: failed to push some refs to 'https://jenkins:jenkinsPWD@myproject.com/git/project' at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:897) at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:858) at hudson.plugins.git.GitAPI.push(GitAPI.java:915) at hudson.plugins.git.GitPublisher$4.invoke(GitPublisher.java:351) at hudson.plugins.git.GitPublisher$4.invoke(GitPublisher.java:333) at hudson.FilePath.act(FilePath.java:865) at hudson.FilePath.act(FilePath.java:838) at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:333) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:785) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:732) at hudson.model.Run.execute(Run.java:1582) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:236) Build step 'Git Publisher' changed build result to FAILURE Build step 'Git Publisher' marked build as failure
Look at the extra “background” there? origin / feature-1234 <== that the current value is $ {GIT_BRANCH}, and although I understand that this is a remote branch and that’s it, it prevents me from starting the process that we want to execute.
If I am missing something simple, I would like to hear it. But I tried many different settings for the various git related parts of my assembly, and nothing seems to allow me to pass the merged and verified code back to the working branch (unlike the integration branch, which is easy to do.
git jenkins
mtutty
source share