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

NoSuchElementException

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When I try to run my project with the plugin enabled I get this error:

      Started by user joan
      [EnvInject] - Loading node environment variables.
      Building remotely on sonarqube01 (dpkg puppet java7 java8 puppet4 linux) in workspace /home/jenkins/workspace/jcpv2-resources-bgm
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url git@gitlab.xxxxx.ofi:product/jcpv2-resources-bgm.git # timeout=10
      Cleaning workspace
       > git rev-parse --verify HEAD # timeout=10
      Resetting working tree
       > git reset --hard # timeout=10
       > git clean -fdx # timeout=10
      Fetching upstream changes from git@gitlab.xxx.ofi:product/jcpv2-resources-bgm.git
       > git --version # timeout=10
      using GIT_SSH to set credentials jenkins ssh to slaves and git
       > git -c core.askpass=true fetch --tags --progress git@gitlab.xxx.ofi:product/jcpv2-resources-bgm.git +refs/tags/*:refs/tags/*
      Seen branch in repository origin/V8
      Seen branch in repository origin/master
      Seen 2 remote branches
      Checking out Revision aec06608a9427dbb7c643db7368e49260dff5c42 ()
       > git config core.sparsecheckout # timeout=10
       > git checkout -f aec06608a9427dbb7c643db7368e49260dff5c42
      First time build. Skipping changelog.
      FATAL: null
      java.util.NoSuchElementException
      	at java.util.ArrayList$Itr.next(ArrayList.java:834)
      	at org.jenkinsci.plugins.gittagmessage.GitTagMessageExtension.onCheckoutCompleted(GitTagMessageExtension.java:44)
      	at hudson.plugins.git.extensions.GitSCMExtension.onCheckoutCompleted(GitSCMExtension.java:161)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1152)
      	at hudson.scm.SCM.checkout(SCM.java:485)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
      	at hudson.model.Run.execute(Run.java:1738)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      Archiving artifacts
      Finished: FAILURE
      

      If I ssh to the jenkins slave a go the the project folder to check status:

      > git branch 
      * (no branch)
      

        Attachments

          Activity

          Hide
          orrc Christopher Orr added a comment -

          Thanks for the report!

          However, I'm having a hard time reproducing this myself. From your log I see that the repo seems to have somehow gotten checked out in a detached HEAD state: Checking out Revision aec06608a9427dbb7c643db7368e49260dff5c42 () indicates that there is no branch name, i.e. the parentheses are empty.
          Your refspec seems odd as well (no mention of origin), but that appears to be unrelated.

          The Git plugin does seem to allow for this situation — i.e. no branch can be associated with the checked-out revision — so even although I can't reproduce this, I can fix this plugin by adding the same sort of behaviour.

          It would, however, be nice if I could reproduce your situation, and add an automated test to guard against it. Also, it would just be nice to know what causes this situation to arise in the first place!
          Could you possibly grab the config XML for this Jenkins job, i.e. something like https://jenkins.example.com/job/jcpv2-resources-bgm/config.xml and post at least the contents of the <scm> tag here (with the sensitive parts of the URI masked, as above)?

          Thanks.

          Show
          orrc Christopher Orr added a comment - Thanks for the report! However, I'm having a hard time reproducing this myself. From your log I see that the repo seems to have somehow gotten checked out in a detached HEAD state: Checking out Revision aec06608a9427dbb7c643db7368e49260dff5c42 () indicates that there is no branch name, i.e. the parentheses are empty. Your refspec seems odd as well (no mention of origin ), but that appears to be unrelated. The Git plugin does seem to allow for this situation — i.e. no branch can be associated with the checked-out revision — so even although I can't reproduce this, I can fix this plugin by adding the same sort of behaviour. It would, however, be nice if I could reproduce your situation, and add an automated test to guard against it. Also, it would just be nice to know what causes this situation to arise in the first place! Could you possibly grab the config XML for this Jenkins job, i.e. something like https://jenkins.example.com/job/jcpv2-resources-bgm/config.xml and post at least the contents of the <scm> tag here (with the sensitive parts of the URI masked, as above)? Thanks.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Christopher Orr
          Path:
          src/main/java/org/jenkinsci/plugins/gittagmessage/GitTagMessageExtension.java
          http://jenkins-ci.org/commit/git-tag-message-plugin/d954a1ad633f73d683b54bb1ec0e8c317fc300ee
          Log:
          [FIXED JENKINS-34429] Allow for empty branch list in the build revision.

          We only need the branch name as an optimisation, and the Git SCM plugin handles
          this without crashing, so we should do the same and allow for an empty list.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christopher Orr Path: src/main/java/org/jenkinsci/plugins/gittagmessage/GitTagMessageExtension.java http://jenkins-ci.org/commit/git-tag-message-plugin/d954a1ad633f73d683b54bb1ec0e8c317fc300ee Log: [FIXED JENKINS-34429] Allow for empty branch list in the build revision. We only need the branch name as an optimisation, and the Git SCM plugin handles this without crashing, so we should do the same and allow for an empty list.
          Hide
          orrc Christopher Orr added a comment -

          Version 1.5 of the plugin has been released, which fixes this issue.

          Show
          orrc Christopher Orr added a comment - Version 1.5 of the plugin has been released, which fixes this issue.
          Hide
          jfisbein Joan Fisbein added a comment -

          Hi,
          I really don't know how we arrived to have no branch.
          Here it's the scm part of the configuration

          <scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.4">
          	<configVersion>2</configVersion>
          	<userRemoteConfigs>
          		<hudson.plugins.git.UserRemoteConfig>
          			<refspec>+refs/tags/*:refs/tags/*</refspec>
          			<url>git@gitlab.xxx.ofi:product/jcpv2-resources-bgm.git</url>
          			<credentialsId>cccccccccccc-xxx-yyy-zzz-wwwwwwwwwwwwwww</credentialsId>
          		</hudson.plugins.git.UserRemoteConfig>
          	</userRemoteConfigs>
          	<branches>
          		<hudson.plugins.git.BranchSpec>
          			<name>refs/tags/*</name>
          		</hudson.plugins.git.BranchSpec>
          	</branches>
          	<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
          	<submoduleCfg class="list"/>
          	<extensions>
          		<org.jenkinsci.plugins.gittagmessage.GitTagMessageExtension plugin="git-tag-message@1.4"/>
          		<hudson.plugins.git.extensions.impl.CleanBeforeCheckout/>
          	</extensions>
          </scm>
          

          hope it helps.

          If you need soemthing more don't hesitate in asking.

          Regards,
          Joan

          Show
          jfisbein Joan Fisbein added a comment - Hi, I really don't know how we arrived to have no branch. Here it's the scm part of the configuration <scm class= "hudson.plugins.git.GitSCM" plugin= "git@2.4.4" > <configVersion>2</configVersion> <userRemoteConfigs> <hudson.plugins.git.UserRemoteConfig> <refspec>+refs/tags/*:refs/tags/*</refspec> <url>git@gitlab.xxx.ofi:product/jcpv2-resources-bgm.git</url> <credentialsId>cccccccccccc-xxx-yyy-zzz-wwwwwwwwwwwwwww</credentialsId> </hudson.plugins.git.UserRemoteConfig> </userRemoteConfigs> <branches> <hudson.plugins.git.BranchSpec> <name>refs/tags/*</name> </hudson.plugins.git.BranchSpec> </branches> <doGenerateSubmoduleConfigurations> false </doGenerateSubmoduleConfigurations> <submoduleCfg class= "list" /> <extensions> <org.jenkinsci.plugins.gittagmessage.GitTagMessageExtension plugin= "git-tag-message@1.4" /> <hudson.plugins.git.extensions.impl.CleanBeforeCheckout/> </extensions> </scm> hope it helps. If you need soemthing more don't hesitate in asking. Regards, Joan

            People

            • Assignee:
              orrc Christopher Orr
              Reporter:
              jfisbein Joan Fisbein
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: