Hudson doesn't checkout the master branch. Hudson uses an 'unnamed' branch therefore:

      Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref

      Hmm - dunno how to resolve that. Perhaps the Git plugin should handle the checkout different ... But nevertheless the issue surfaces here

          [JENKINS-5856] Unable to Release a Git Project

          James Nord added a comment -

          Hudson doesn't do a checkout at all. Maven performs the checkout.

          Can you make sure that

          1) the SCM section is correct in the POM
          2) that you can release from the command line with the same project

          James Nord added a comment - Hudson doesn't do a checkout at all. Maven performs the checkout. Can you make sure that 1) the SCM section is correct in the POM 2) that you can release from the command line with the same project

          sannies added a comment -

          The initial checkout of the workspace is performed by hudson. So what maven sees on the disk is a hudson/git checked out workspace. But this workspace is not the master branch - it is an unnamed branch and therefore maven cannot release it.

          sannies added a comment - The initial checkout of the workspace is performed by hudson. So what maven sees on the disk is a hudson/git checked out workspace. But this workspace is not the master branch - it is an unnamed branch and therefore maven cannot release it.

          James Nord added a comment -

          can you attach the console output.

          James Nord added a comment - can you attach the console output.

          sannies added a comment - - edited

          I attached a full log. But the most important part seems to be here:

          ...
          
          Checkout:CoreMedia Application Maven Plugin / /opt/hudson/workspace/CoreMedia Application Maven Plugin - hudson.remoting.Channel@3af579de:co5dvap02
          Using strategy: Default
          Last Built Revision: Revision 915baf52125748fbae5f26c3c191e7269abb0fd0 (origin/master)
          Checkout:CoreMedia Application Maven Plugin / /opt/hudson/workspace/CoreMedia Application Maven Plugin - hudson.remoting.LocalChannel@13725b2
          GitAPI created
          
          
          ...
          [INFO] [INFO] BUILD SUCCESSFUL
          [INFO] [INFO] ------------------------------------------------------------------------
          [INFO] [INFO] Total time: 52 seconds
          [INFO] [INFO] Finished at: Sat Apr 10 15:55:20 CEST 2010
          [INFO] [INFO] Final Memory: 25M/50M
          [INFO] [INFO] ------------------------------------------------------------------------
          [INFO] Checking in modified POMs...
          [INFO] Executing: /bin/sh -c cd "/opt/hudson/workspace/CoreMedia Application Maven Plugin" && git add -- pom.xml
          [INFO] Working directory: /opt/hudson/workspace/CoreMedia Application Maven Plugin
          [INFO] Executing: /bin/sh -c cd "/opt/hudson/workspace/CoreMedia Application Maven Plugin" && git status
          [INFO] Working directory: /opt/hudson/workspace/CoreMedia Application Maven Plugin
          [INFO] Executing: /bin/sh -c cd "/opt/hudson/workspace/CoreMedia Application Maven Plugin" && git commit --verbose -F /tmp/maven-scm-2038306611.commit pom.xml
          [INFO] Working directory: /opt/hudson/workspace/CoreMedia Application Maven Plugin
          [INFO] Executing: /bin/sh -c cd "/opt/hudson/workspace/CoreMedia Application Maven Plugin" && git symbolic-ref HEAD
          [INFO] Working directory: /opt/hudson/workspace/CoreMedia Application Maven Plugin
          [HUDSON] Archiving /opt/hudson/workspace/CoreMedia Application Maven Plugin/pom.xml to /var/lib/hudson/jobs/CoreMedia Application Maven Plugin/modules/com.coremedia$maven-coremedia-application-plugin/builds/2010-04-10_15-54-01/archive/com.coremedia/maven-coremedia-application-plugin/0.2.0-alpha-10-SNAPSHOT/pom.xml
          [INFO] ------------------------------------------------------------------------
          [ERROR] BUILD ERROR
          [INFO] ------------------------------------------------------------------------
          [INFO] An error is occurred in the checkin process: Exception while executing SCM command.
          
          Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref
          

          And this is what git branch -va says:

          * (no branch)           0255b03 [maven-release-plugin] prepare release maven-coremedia-application-plugin-0.2.0-alpha-10
            master                3611377 [behind 37] dos2unix  *.sh, *.jpif and bin/cm
            remotes/origin/HEAD   -> origin/master
            remotes/origin/master 915baf5 [maven-release-plugin] prepare for next development iteration
          

          git log on this anonymous branch says:

          -bash-3.2$ git log
          commit 0255b03c22dc3f8fdcf87b3035cafad4167380b1
          Author: xxx [the hudson user]
          Date:   Sat Apr 10 15:55:20 2010 +0200
          
              [maven-release-plugin] prepare release maven-coremedia-application-plugin-0.2.0-alpha-10
          
          commit 915baf52125748fbae5f26c3c191e7269abb0fd0
          Author: [user a]
          Date:   Fri Apr 9 15:16:43 2010 +0200
          
              [maven-release-plugin] prepare for next development iteration
          
          commit 6f2b72fc9cbfa0d35d5437c69942e8bf0dd0a8f7
          Author: [user a]
          Date:   Fri Apr 9 15:16:38 2010 +0200
          
              [maven-release-plugin] prepare release maven-coremedia-application-plugin-0.2.0-alpha-9
          
          commit 924c3786f5ea0c07ab7631bf4d249b0d6bf14b27
          Author: [user a]
          Date:   Fri Apr 9 15:11:55 2010 +0200
          
              fix complex exclusion situation
          
          ....
          
          

          (the log just to allow you to understand where each branch is)

          sannies added a comment - - edited I attached a full log. But the most important part seems to be here: ... Checkout:CoreMedia Application Maven Plugin / /opt/hudson/workspace/CoreMedia Application Maven Plugin - hudson.remoting.Channel@3af579de:co5dvap02 Using strategy: Default Last Built Revision: Revision 915baf52125748fbae5f26c3c191e7269abb0fd0 (origin/master) Checkout:CoreMedia Application Maven Plugin / /opt/hudson/workspace/CoreMedia Application Maven Plugin - hudson.remoting.LocalChannel@13725b2 GitAPI created ... [INFO] [INFO] BUILD SUCCESSFUL [INFO] [INFO] ------------------------------------------------------------------------ [INFO] [INFO] Total time: 52 seconds [INFO] [INFO] Finished at: Sat Apr 10 15:55:20 CEST 2010 [INFO] [INFO] Final Memory: 25M/50M [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Checking in modified POMs... [INFO] Executing: /bin/sh -c cd "/opt/hudson/workspace/CoreMedia Application Maven Plugin" && git add -- pom.xml [INFO] Working directory: /opt/hudson/workspace/CoreMedia Application Maven Plugin [INFO] Executing: /bin/sh -c cd "/opt/hudson/workspace/CoreMedia Application Maven Plugin" && git status [INFO] Working directory: /opt/hudson/workspace/CoreMedia Application Maven Plugin [INFO] Executing: /bin/sh -c cd "/opt/hudson/workspace/CoreMedia Application Maven Plugin" && git commit --verbose -F /tmp/maven-scm-2038306611.commit pom.xml [INFO] Working directory: /opt/hudson/workspace/CoreMedia Application Maven Plugin [INFO] Executing: /bin/sh -c cd "/opt/hudson/workspace/CoreMedia Application Maven Plugin" && git symbolic-ref HEAD [INFO] Working directory: /opt/hudson/workspace/CoreMedia Application Maven Plugin [HUDSON] Archiving /opt/hudson/workspace/CoreMedia Application Maven Plugin/pom.xml to / var /lib/hudson/jobs/CoreMedia Application Maven Plugin/modules/com.coremedia$maven-coremedia-application-plugin/builds/2010-04-10_15-54-01/archive/com.coremedia/maven-coremedia-application-plugin/0.2.0-alpha-10-SNAPSHOT/pom.xml [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] An error is occurred in the checkin process: Exception while executing SCM command. Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref And this is what git branch -va says: * (no branch) 0255b03 [maven-release-plugin] prepare release maven-coremedia-application-plugin-0.2.0-alpha-10 master 3611377 [behind 37] dos2unix *.sh, *.jpif and bin/cm remotes/origin/HEAD -> origin/master remotes/origin/master 915baf5 [maven-release-plugin] prepare for next development iteration git log on this anonymous branch says: -bash-3.2$ git log commit 0255b03c22dc3f8fdcf87b3035cafad4167380b1 Author: xxx [the hudson user] Date: Sat Apr 10 15:55:20 2010 +0200 [maven-release-plugin] prepare release maven-coremedia-application-plugin-0.2.0-alpha-10 commit 915baf52125748fbae5f26c3c191e7269abb0fd0 Author: [user a] Date: Fri Apr 9 15:16:43 2010 +0200 [maven-release-plugin] prepare for next development iteration commit 6f2b72fc9cbfa0d35d5437c69942e8bf0dd0a8f7 Author: [user a] Date: Fri Apr 9 15:16:38 2010 +0200 [maven-release-plugin] prepare release maven-coremedia-application-plugin-0.2.0-alpha-9 commit 924c3786f5ea0c07ab7631bf4d249b0d6bf14b27 Author: [user a] Date: Fri Apr 9 15:11:55 2010 +0200 fix complex exclusion situation .... (the log just to allow you to understand where each branch is)

          sannies added a comment -

          sannies added a comment - The problem has been discussed here: http://stackoverflow.com/questions/1877027/cant-get-automated-release-working-with-hudson-git-maven-release-plugin

          John McNair added a comment -

          The git plugin performs the checkout. It is checking out the sha-1 of the branch you told it to build. Git allows you to commit in such a state, but it's not particularly useful. I experienced this issue when using a Maven2 project with release:prepare release:perform given as commands. So I am letting maven do all the SCM and deploy tasks instead of Hudson. The maven-scm-plugin for git simply tries to do the two commits and push your currently checked out branch upstream. It doesn't work if you don't have a branch (e.g., master) checked out.

          I worked around this using the Hudson M2 Extra Steps plugin with the following pre-build step:
          git checkout master || git checkout -b master
          git reset --hard origin/master

          That allows the git plugin to still control which sha-1 is being built but coerces that this sha-1 be master. I use the || so that it's safe for the first clone and for subsequent fetches.

          John McNair added a comment - The git plugin performs the checkout. It is checking out the sha-1 of the branch you told it to build. Git allows you to commit in such a state, but it's not particularly useful. I experienced this issue when using a Maven2 project with release:prepare release:perform given as commands. So I am letting maven do all the SCM and deploy tasks instead of Hudson. The maven-scm-plugin for git simply tries to do the two commits and push your currently checked out branch upstream. It doesn't work if you don't have a branch (e.g., master) checked out. I worked around this using the Hudson M2 Extra Steps plugin with the following pre-build step: git checkout master || git checkout -b master git reset --hard origin/master That allows the git plugin to still control which sha-1 is being built but coerces that this sha-1 be master. I use the || so that it's safe for the first clone and for subsequent fetches.

          Andrew Bayer added a comment -

          Preliminary work on tweaking the git plugin to checkout to an optional local branch (for JENKINS-6856 as well as this) is up at http://github.com/abayer/Hudson-GIT-plugin/tree/JENKINS-6856, if anyone wants to take a look.

          Andrew Bayer added a comment - Preliminary work on tweaking the git plugin to checkout to an optional local branch (for JENKINS-6856 as well as this) is up at http://github.com/abayer/Hudson-GIT-plugin/tree/JENKINS-6856 , if anyone wants to take a look.

          Andrew Bayer added a comment -

          Sending this back to m2release - it should work now from the git plugin side of things.

          Andrew Bayer added a comment - Sending this back to m2release - it should work now from the git plugin side of things.

          James Nord added a comment -

          Still not working, relavent sections are:

          <pre>
          Checkout:proj-app_commit / /home/hudson/data/workspace/proj-app_commit - hudson.remoting.Channel@1c17335:cabci-cf-rh5-x64-01
          Using strategy: Default
          Last Built Revision: Revision ec90272fc4b0def86159148588e4f9d602b256dc (origin/master)
          Checkout:proj-app_commit / /home/hudson/data/workspace/proj-app_commit - hudson.remoting.LocalChannel@a90942
          GitAPI created
          Fetching changes from the remote Git repository
          Fetching upstream changes from ssh://user@mygerritserver:29418/cms/proj/proj-app.git
          [proj-app_commit] $ git fetch -t ssh://user@mygerritserver:29418/cms/proj/proj-app.git +refs/heads/:refs/remotes/origin/
          [proj-app_commit] $ git ls-tree HEAD
          Seen branch in repository origin/master
          Commencing build of Revision ec90272fc4b0def86159148588e4f9d602b256dc (origin/master)
          GitAPI created
          Checking out Revision ec90272fc4b0def86159148588e4f9d602b256dc (origin/master)
          [proj-app_commit] $ git checkout -f ec90272fc4b0def86159148588e4f9d602b256dc
          [proj-app_commit] $ git tag -a -f -m "Hudson Build #36" hudson-proj-app_commit-36
          Recording changes in branch origin/master
          [proj-app_commit] $ git whatchanged --no-abbrev -M --pretty=raw ec90272fc4b0def86159148588e4f9d602b256dc..ec90272fc4b0def86159148588e4f9d602b256dc
          Parsing POMs

          <snip>

          [INFO] Executing: /bin/sh -c cd /home/hudson/data/workspace/proj-app_commit && git add pom.xml proj-bp/pom.xml proj-bp/proj-bp-adiSupport/pom.xml proj-bp/proj-bp-content/pom.xml proj-bp/proj-bp-offer/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-base/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-interface/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-mercury/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-mock/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-xti/pom.xml proj-bp/proj-bp-publishing/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-base/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-interface/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-mercury/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-mock/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-xti/pom.xml proj-definitions/pom.xml proj-definitions/proj-definitions-commonSpring/pom.xml proj-definitions/proj-definitions-packWorkflow/pom.xml proj-definitions/proj-definitions-classificationWorkflow/pom.xml proj-definitions/proj-definitions-ingestWorkflow/pom.xml proj-platform/pom.xml proj-platform/proj-platform-dataEventNotifier/pom.xml proj-platform/proj-platform-workflowSupport/pom.xml proj-platform/proj-platform-status/pom.xml proj-externals/pom.xml proj-externals/proj-externals-gateway/pom.xml proj-platform/proj-platform-applicationHost/pom.xml proj-packaging/pom.xml
          [INFO] Working directory: /home/hudson/data/workspace/proj-app_commit
          [INFO] Executing: /bin/sh -c cd /home/hudson/data/workspace/proj-app_commit && git status
          [INFO] Working directory: /home/hudson/data/workspace/proj-app_commit
          [INFO] Executing: /bin/sh -c cd /home/hudson/data/workspace/proj-app_commit && git commit --verbose -F /tmp/maven-scm-1512028766.commit pom.xml proj-bp/pom.xml proj-bp/proj-bp-adiSupport/pom.xml proj-bp/proj-bp-content/pom.xml proj-bp/proj-bp-offer/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-base/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-interface/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-mercury/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-mock/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-xti/pom.xml proj-bp/proj-bp-publishing/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-base/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-interface/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-mercury/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-mock/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-xti/pom.xml proj-definitions/pom.xml proj-definitions/proj-definitions-commonSpring/pom.xml proj-definitions/proj-definitions-packWorkflow/pom.xml proj-definitions/proj-definitions-classificationWorkflow/pom.xml proj-definitions/proj-definitions-ingestWorkflow/pom.xml proj-platform/pom.xml proj-platform/proj-platform-dataEventNotifier/pom.xml proj-platform/proj-platform-workflowSupport/pom.xml proj-platform/proj-platform-status/pom.xml proj-externals/pom.xml proj-externals/proj-externals-gateway/pom.xml proj-platform/proj-platform-applicationHost/pom.xml proj-packaging/pom.xml
          [INFO] Working directory: /home/hudson/data/workspace/proj-app_commit
          [INFO] Executing: /bin/sh -c cd /home/hudson/data/workspace/proj-app_commit && git push
          [INFO] Working directory: /home/hudson/data/workspace/proj-app_commit
          [TASKS] Skipping non-existent folder '/home/hudson/data/workspace/proj-app_commit/src/main/java'...
          [TASKS] Skipping non-existent folder '/home/hudson/data/workspace/proj-app_commit/src/test/java'...
          [TASKS] Skipping non-existent folder '/home/hudson/data/workspace/proj-app_commit/src/main/resources'...
          [TASKS] Skipping non-existent folder '/home/hudson/data/workspace/proj-app_commit/src/test/resources'...
          [HUDSON] Archiving /home/hudson/data/workspace/proj-app_commit/pom.xml to /home/hudson/data/jobs/proj-app_commit/modules/com.myco.myproj$proj-app/builds/2010-09-07_15-59-14/archive/com.myco.myproj/proj-app/0.0.1-1-SNAPSHOT/pom.xml
          [INFO] ------------------------------------------------------------------------
          [ERROR] BUILD FAILURE
          [INFO] ------------------------------------------------------------------------
          [INFO] Unable to commit files
          Provider message:
          The git-push command failed.
          Command output:
          To ssh://user@mygerritserver:29418/cms/proj/proj-app.git
          ! [rejected] master -> master (non-fast-forward)
          error: failed to push some refs to 'ssh://user@mygerritserver:29418/cms/proj/proj-app.git'
          To prevent you from losing history, non-fast-forward updates were rejected
          Merge the remote changes (e.g. 'git pull') before pushing again. See the
          'Note about fast-forwards' section of 'git push --help' for details.
          </pre>

          James Nord added a comment - Still not working, relavent sections are: <pre> Checkout:proj-app_commit / /home/hudson/data/workspace/proj-app_commit - hudson.remoting.Channel@1c17335:cabci-cf-rh5-x64-01 Using strategy: Default Last Built Revision: Revision ec90272fc4b0def86159148588e4f9d602b256dc (origin/master) Checkout:proj-app_commit / /home/hudson/data/workspace/proj-app_commit - hudson.remoting.LocalChannel@a90942 GitAPI created Fetching changes from the remote Git repository Fetching upstream changes from ssh://user@mygerritserver:29418/cms/proj/proj-app.git [proj-app_commit] $ git fetch -t ssh://user@mygerritserver:29418/cms/proj/proj-app.git +refs/heads/ :refs/remotes/origin/ [proj-app_commit] $ git ls-tree HEAD Seen branch in repository origin/master Commencing build of Revision ec90272fc4b0def86159148588e4f9d602b256dc (origin/master) GitAPI created Checking out Revision ec90272fc4b0def86159148588e4f9d602b256dc (origin/master) [proj-app_commit] $ git checkout -f ec90272fc4b0def86159148588e4f9d602b256dc [proj-app_commit] $ git tag -a -f -m "Hudson Build #36" hudson-proj-app_commit-36 Recording changes in branch origin/master [proj-app_commit] $ git whatchanged --no-abbrev -M --pretty=raw ec90272fc4b0def86159148588e4f9d602b256dc..ec90272fc4b0def86159148588e4f9d602b256dc Parsing POMs <snip> [INFO] Executing: /bin/sh -c cd /home/hudson/data/workspace/proj-app_commit && git add pom.xml proj-bp/pom.xml proj-bp/proj-bp-adiSupport/pom.xml proj-bp/proj-bp-content/pom.xml proj-bp/proj-bp-offer/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-base/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-interface/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-mercury/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-mock/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-xti/pom.xml proj-bp/proj-bp-publishing/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-base/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-interface/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-mercury/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-mock/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-xti/pom.xml proj-definitions/pom.xml proj-definitions/proj-definitions-commonSpring/pom.xml proj-definitions/proj-definitions-packWorkflow/pom.xml proj-definitions/proj-definitions-classificationWorkflow/pom.xml proj-definitions/proj-definitions-ingestWorkflow/pom.xml proj-platform/pom.xml proj-platform/proj-platform-dataEventNotifier/pom.xml proj-platform/proj-platform-workflowSupport/pom.xml proj-platform/proj-platform-status/pom.xml proj-externals/pom.xml proj-externals/proj-externals-gateway/pom.xml proj-platform/proj-platform-applicationHost/pom.xml proj-packaging/pom.xml [INFO] Working directory: /home/hudson/data/workspace/proj-app_commit [INFO] Executing: /bin/sh -c cd /home/hudson/data/workspace/proj-app_commit && git status [INFO] Working directory: /home/hudson/data/workspace/proj-app_commit [INFO] Executing: /bin/sh -c cd /home/hudson/data/workspace/proj-app_commit && git commit --verbose -F /tmp/maven-scm-1512028766.commit pom.xml proj-bp/pom.xml proj-bp/proj-bp-adiSupport/pom.xml proj-bp/proj-bp-content/pom.xml proj-bp/proj-bp-offer/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-base/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-interface/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-mercury/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-mock/pom.xml proj-bp/proj-bp-offer/proj-bp-offer-xti/pom.xml proj-bp/proj-bp-publishing/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-base/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-interface/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-mercury/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-mock/pom.xml proj-bp/proj-bp-publishing/proj-bp-publishing-xti/pom.xml proj-definitions/pom.xml proj-definitions/proj-definitions-commonSpring/pom.xml proj-definitions/proj-definitions-packWorkflow/pom.xml proj-definitions/proj-definitions-classificationWorkflow/pom.xml proj-definitions/proj-definitions-ingestWorkflow/pom.xml proj-platform/pom.xml proj-platform/proj-platform-dataEventNotifier/pom.xml proj-platform/proj-platform-workflowSupport/pom.xml proj-platform/proj-platform-status/pom.xml proj-externals/pom.xml proj-externals/proj-externals-gateway/pom.xml proj-platform/proj-platform-applicationHost/pom.xml proj-packaging/pom.xml [INFO] Working directory: /home/hudson/data/workspace/proj-app_commit [INFO] Executing: /bin/sh -c cd /home/hudson/data/workspace/proj-app_commit && git push [INFO] Working directory: /home/hudson/data/workspace/proj-app_commit [TASKS] Skipping non-existent folder '/home/hudson/data/workspace/proj-app_commit/src/main/java'... [TASKS] Skipping non-existent folder '/home/hudson/data/workspace/proj-app_commit/src/test/java'... [TASKS] Skipping non-existent folder '/home/hudson/data/workspace/proj-app_commit/src/main/resources'... [TASKS] Skipping non-existent folder '/home/hudson/data/workspace/proj-app_commit/src/test/resources'... [HUDSON] Archiving /home/hudson/data/workspace/proj-app_commit/pom.xml to /home/hudson/data/jobs/proj-app_commit/modules/com.myco.myproj$proj-app/builds/2010-09-07_15-59-14/archive/com.myco.myproj/proj-app/0.0.1-1-SNAPSHOT/pom.xml [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Unable to commit files Provider message: The git-push command failed. Command output: To ssh://user@mygerritserver:29418/cms/proj/proj-app.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'ssh://user@mygerritserver:29418/cms/proj/proj-app.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes (e.g. 'git pull') before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details. </pre>

          James Nord added a comment -

          This is working if you set the Git plugin setting to merge before build (whatever that does?)

          James Nord added a comment - This is working if you set the Git plugin setting to merge before build (whatever that does?)

          James Nord added a comment -

          no it's not as the modified poms don't get commited back in as we seem to be on a local branch.

          James Nord added a comment - no it's not as the modified poms don't get commited back in as we seem to be on a local branch.

          James Nord added a comment -

          This is working if I use the m2 extra steps plugin and the following config

          Git
          "Merge before build" origin, master

          And m2 extra steps (pre-build)
          git checkout master || git checkout -b master
          git reset --hard origin/master

          James Nord added a comment - This is working if I use the m2 extra steps plugin and the following config Git "Merge before build" origin, master And m2 extra steps (pre-build) git checkout master || git checkout -b master git reset --hard origin/master

          tfnico added a comment -

          I see the same thing. By default, the workspace is in (no branch).

          If I manually run

          mvn -X -B -f /[jenkins]/jobs/[job]/workspace/pom.xml -Dresume=false release:prepare release:perform
          

          .. it ends with a

          org.apache.maven.scm.ScmException: Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref
          

          If I first do a 'git checkout master', and then repeat the command it works fine.

          Back in Jenkins, I then configured the job's - SCM section with Branch Specifier: "master", and under Advanced I entered Checkout/merge to local branch (optional): "master"

          After that it works fine. Still, it's a bit annoying that it didn't work by default. I don't know if this is the fault of the maven-release-plugin (should it be possible to make a release when not on a branch?).. but not having to configure this for each job would be nice.

          tfnico added a comment - I see the same thing. By default, the workspace is in (no branch). If I manually run mvn -X -B -f /[jenkins]/jobs/[job]/workspace/pom.xml -Dresume= false release:prepare release:perform .. it ends with a org.apache.maven.scm.ScmException: Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref If I first do a 'git checkout master', and then repeat the command it works fine. Back in Jenkins, I then configured the job's - SCM section with Branch Specifier : "master", and under Advanced I entered Checkout/merge to local branch (optional) : "master" After that it works fine. Still, it's a bit annoying that it didn't work by default. I don't know if this is the fault of the maven-release-plugin (should it be possible to make a release when not on a branch?).. but not having to configure this for each job would be nice.

          Frédéric Camblor added a comment - - edited

          I'm facing the same issue as tfnico with 1.409.2 and git plugin 1.1.12

          Frédéric Camblor added a comment - - edited I'm facing the same issue as tfnico with 1.409.2 and git plugin 1.1.12

          git plugin does checkout commits by RefID, not branches. You can force it to use a local branch (advanced section) so that maven release process will be able to commit, tag and push to remote repository

          Nicolas De Loof added a comment - git plugin does checkout commits by RefID, not branches. You can force it to use a local branch (advanced section) so that maven release process will be able to commit, tag and push to remote repository

          Jan Klass added a comment -

          What is the reason behind that decision? Why does it not check out the branch?

          This is especially confusing as you already were branch-specific when specifying the branch specifier.
          When you specify the job shall build master, why does it not check out master?

          Jan Klass added a comment - What is the reason behind that decision? Why does it not check out the branch? This is especially confusing as you already were branch-specific when specifying the branch specifier. When you specify the job shall build master, why does it not check out master?

            ndeloof Nicolas De Loof
            sannies sannies
            Votes:
            14 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved: