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

Git plugin prevents build display on missing header entries in changelog.xml

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      jenkins 1.608
      git-plugin 2.3.5
      git-client 1.17.0
      git 1.9.2/FreeBSD 9.1 on master or git 2.3.1/FreeBSD10.1 on slaves
    • Similar Issues:

      Description

      When the changelog.xml is missing entries, specifically parent a giant stacktrace appears in the build page. This also breaks wallboards which call fetchJobViews.

      To test, take a changelog and delete the parent SHA1 id, ensure a trailing space is left after parent, so "parent " as opposed to "parent 8d79986e611a81aa3ace7036b8b52351541604d6".

      I still don't know why the headers were missing, any information about where the changelog.xml is generated would be helpful, since a git log --pretty=raw $SHA1 shows the parent correctly. (I should note that the master is an older git because maintenance is downtime and the slaves are all ansible'ized and up to date.) Created JENKINS-28291 to track.

      I should note that this is NOT caused by the lack of the Mail plugin being properly configured - JENKINS-19045 - it is present, enabled and configured: it works fine.

      javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: jar:file:/usr/home/hudson/hudson/war/WEB-INF/lib/jenkins-core-1.608.jar!/hudson/model/AbstractBuild/index.jelly:67:61: <st:include> No page found 'digest.jelly' for class hudson.matrix.MatrixBuild
      	at org.kohsuke.stapler.jelly.JellyClassTearOff.serveIndexJelly(JellyClassTearOff.java:117)
      	at org.kohsuke.stapler.jelly.JellyFacet.handleIndexRequest(JellyFacet.java:127)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:735)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
             [...]
      Caused by: org.apache.commons.jelly.JellyTagException: jar:file:/usr/home/hudson/hudson/war/WEB-INF/lib/jenkins-core-1.608.jar!/hudson/model/AbstractBuild/index.jelly:67:61: <st:include> No page found 'digest.jelly' for class hudson.matrix.MatrixBuild
      	at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:124)
      	at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269)
      	at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
             [...]
      

      In the jenkins http://jenkins/log/all what appears is:

      Caught exception evaluating: it.changeSet in /job/4.9.1/2/TARGET_ARCH=amd64,label=xipos9/. Reason: java.lang.reflect.InvocationTargetException
      java.lang.reflect.InvocationTargetException
      	at sun.reflect.GeneratedMethodAccessor357.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      [...]
      	at java.lang.Thread.run(Thread.java:724)
      Caused by: java.lang.ArrayIndexOutOfBoundsException
      

      Separately, the JiraIssueIndexer failed with this stacktrace

      SEVERE: Timer task hudson.plugins.jiraapi.IssueIndexerThread@8e3484d failed
      java.lang.ArrayIndexOutOfBoundsException: 1
              at hudson.plugins.git.GitChangeSet.parseCommit(GitChangeSet.java:104)
              at hudson.plugins.git.GitChangeSet.<init>(GitChangeSet.java:89)
              at hudson.plugins.git.GitChangeLogParser.parseCommit(GitChangeLogParser.java:73)
              at hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:57)
              at hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:44)
              at hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:25)
              at hudson.scm.ChangeLogParser.parse(ChangeLogParser.java:57)
              at hudson.model.AbstractBuild.calcChangeSet(AbstractBuild.java:906)
              at hudson.model.AbstractBuild.getChangeSet(AbstractBuild.java:874)
              at hudson.plugins.jiraapi.index.IssueIndexer.findBuildRelatedIssues(IssueIndexer.java:209)
              at hudson.plugins.jiraapi.index.IssueIndexer.fullIndex(IssueIndexer.java:171)
              at hudson.plugins.jiraapi.IssueIndexerThread.doRun(IssueIndexerThread.java:68)
              at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:51)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      [...]
              at java.lang.Thread.run(Thread.java:724)
      

      Inspecting these lines:

      GitChangeSet.java
                  if (line.startsWith("commit ")) {
                      this.id = line.split(" ")[1];
                  } else if (line.startsWith("tree ")) {
                  } else if (line.startsWith("parent ")) {
                      this.parentCommit = line.split(" ")[1];
                  } else if (line.startsWith(PREFIX_COMMITTER)) {
      

      makes it pretty obvious the code is going to fail in these conditions. (Line 104 is actually the line after the "parent " test.) This was verified in a debugger which led to the files being obviously incorrect. Hand editing these changelog.xml files and adding any value corrects the issue - the parent attribute is used for gitweb and not elsewhere from what I can see, so was sufficient to test the theory even if it is not the correct SHA1 and breaks web links.

      This code lacks robustness by assuming the input is correct. A simple patch would test the array length and report an error, I can do it it's more understanding the correct erroring (or ignoring and logging) methods, advice appreciated.

      An example changelog.xml

      changelog.xml
      commit 452eada08db501e04f3de9441065bb72728dbc9b
      tree 9b346ed5ba67deaec8f8c608fe03530afa900334
      parent 
      author J. Longman <longman@foo.com> 2015-05-05 14:40:55 -0400
      committer J. Longman <longman@foo.com> 2015-05-05 14:57:20 -0400
      
          CORE-6830 another empty commit - will rewrite branch
      
      :000000 100644 0000000000000000000000000000000000000000 5a6b53c58b4df185b955f46b7ffdfb26671242a5 A      .gitignore
      :000000 100644 0000000000000000000000000000000000000000 49d479c60ef90e82eae181f33c6f12ade0a6687d A      .gitmodules
      [...etc]
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ndeloof Nicolas De Loof
                Reporter:
                jlongman jlongman
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: