Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5856

Unable to Release a Git Project

    XMLWordPrintable

Details

    Description

      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

      Attachments

        Issue Links

          Activity

            teilo 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

            teilo 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 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 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.
            fcamblor 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

            fcamblor 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

            ndeloof 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
            jk 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?

            jk 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?

            People

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

              Dates

                Created:
                Updated:
                Resolved: