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

          sannies created issue -

          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.
          sannies made changes -
          Component/s New: git [ 15543 ]

          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 made changes -
          Attachment New: allLog.txt [ 19315 ]

          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
          James Nord made changes -
          Assignee Original: James Nord [ teilo ] New: magnayn [ magnayn ]

          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.

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

              Created:
              Updated:
              Resolved: