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

NPE during Copy Artifact in Promotion

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Copy Artifact doesn't seem to work inside promotions. For the normal build steps it is fine and copies without problem when it's in a promotion I get this:

      java.lang.NullPointerException
      	at hudson.plugins.copyartifact.CopyArtifact$EnvAction.add(CopyArtifact.java:512)
      	at hudson.plugins.copyartifact.CopyArtifact$EnvAction.access$500(CopyArtifact.java:502)
      	at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:296)
      	at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:282)
      	at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:224)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
      	at hudson.model.Run.execute(Run.java:1754)
      	at hudson.model.Run.run(Run.java:1692)
      	at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:174)
      	at hudson.model.ResourceController.execute(ResourceController.java:89)
      	at hudson.model.Executor.run(Executor.java:240)
      

      The configuration for the promotion is simple:

      <hudson.plugins.promoted__builds.PromotionProcess plugin="promoted-builds@2.19">
        <actions/>
        <keepDependencies>false</keepDependencies>
        <properties/>
        <scm class="hudson.scm.NullSCM"/>
        <canRoam>true</canRoam>
        <disabled>false</disabled>
        <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
        <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
        <triggers/>
        <concurrentBuild>false</concurrentBuild>
        <conditions/>
        <icon>star-gold</icon>
        <buildSteps>
          <hudson.plugins.copyartifact.CopyArtifact plugin="copyartifact@1.32">
            <project>some-job</project>
            <filter>**/*</filter>
            <target/>
            <excludes/>
            <selector class="hudson.plugins.copyartifact.StatusBuildSelector"/>
            <flatten>true</flatten>
            <doNotFingerprintArtifacts>false</doNotFingerprintArtifacts>
          </hudson.plugins.copyartifact.CopyArtifact>
        </buildSteps>
      </hudson.plugins.promoted__builds.PromotionProcess>
      

      When I downgraded those two plugins (because I figured the culprit was either Copy Artifact or Promoted Builds) to these versions everything worked again:

      • Copy Artifact Plugin 1.30
      • Promoted Builds Plugin 2.17

        Attachments

          Activity

          Hide
          bedge Bruce Edge added a comment - - edited

          I can confirm the same problem.
          I downgraded only the copy artifact plugin from 1.32 to 1.31 and the problem goes away.

          FWIW here's my stack trace:

           
          Promoting Reader-Android-build-develop #546
          FATAL: null
          java.lang.NullPointerException
          	at hudson.plugins.copyartifact.CopyArtifact$EnvAction.add(CopyArtifact.java:512)
          	at hudson.plugins.copyartifact.CopyArtifact$EnvAction.access$500(CopyArtifact.java:502)
          	at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:296)
          	at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:280)
          	at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:222)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
          	at hudson.model.Run.execute(Run.java:1754)
          	at hudson.model.Run.run(Run.java:1692)
          	at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:172)
          	at hudson.model.ResourceController.execute(ResourceController.java:89)
          	at hudson.model.Executor.run(Executor.java:240)
          

          and my promotion config:

            <buildSteps>
              <hudson.plugins.copyartifact.CopyArtifact plugin="copyartifact@1.30">
                <project>${PROMOTED_JOB_NAME}</project>
                <filter>**/*release*.apk,**/*-debug-unaligned*.apk</filter>
                <target>/u0/releases/Reader-Android/${GIT_BRANCH}/QA/${PROMOTED_NUMBER}</target>
                <selector class="hudson.plugins.copyartifact.PermalinkBuildSelector">
                  <id>QA</id>
                </selector>
                <flatten>true</flatten>
                <doNotFingerprintArtifacts>false</doNotFingerprintArtifacts>
              </hudson.plugins.copyartifact.CopyArtifact>
              <hudson.plugins.copyartifact.CopyArtifact plugin="copyartifact@1.30">
                <project>${PROMOTED_JOB_NAME}</project>
                <filter>**/build/outputs/proguard/**</filter>
                <target>/u0/releases/Reader-Android/${GIT_BRANCH}/QA/${PROMOTED_NUMBER}</target>
                <selector class="hudson.plugins.copyartifact.PermalinkBuildSelector">
                  <id>QA</id>
                </selector>
                <doNotFingerprintArtifacts>false</doNotFingerprintArtifacts>
              </hudson.plugins.copyartifact.CopyArtifact>
              <hudson.plugins.copyartifact.CopyArtifact plugin="copyartifact@1.30">
                <project>${PROMOTED_JOB_NAME}</project>
                <filter>**/src/androidTest/**,**/lib/**,**/build.gradle</filter>
                <target>/u0/releases/Reader-Android/${GIT_BRANCH}/QA/${PROMOTED_NUMBER}</target>
                <selector class="hudson.plugins.copyartifact.PermalinkBuildSelector">
                  <id>QA</id>
                </selector>
                <doNotFingerprintArtifacts>false</doNotFingerprintArtifacts>
              </hudson.plugins.copyartifact.CopyArtifact>
              <hudson.tasks.Shell>
                <command>git push --tag || true</command>
              </hudson.tasks.Shell>
            </buildSteps>
          
          Show
          bedge Bruce Edge added a comment - - edited I can confirm the same problem. I downgraded only the copy artifact plugin from 1.32 to 1.31 and the problem goes away. FWIW here's my stack trace: Promoting Reader-Android-build-develop #546 FATAL: null java.lang.NullPointerException at hudson.plugins.copyartifact.CopyArtifact$EnvAction.add(CopyArtifact.java:512) at hudson.plugins.copyartifact.CopyArtifact$EnvAction.access$500(CopyArtifact.java:502) at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:296) at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:280) at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:222) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533) at hudson.model.Run.execute(Run.java:1754) at hudson.model.Run.run(Run.java:1692) at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:172) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) and my promotion config: <buildSteps> <hudson.plugins.copyartifact.CopyArtifact plugin= "copyartifact@1.30" > <project> ${PROMOTED_JOB_NAME} </project> <filter> **/*release*.apk,**/*-debug-unaligned*.apk </filter> <target> /u0/releases/Reader-Android/${GIT_BRANCH}/QA/${PROMOTED_NUMBER} </target> <selector class= "hudson.plugins.copyartifact.PermalinkBuildSelector" > <id> QA </id> </selector> <flatten> true </flatten> <doNotFingerprintArtifacts> false </doNotFingerprintArtifacts> </hudson.plugins.copyartifact.CopyArtifact> <hudson.plugins.copyartifact.CopyArtifact plugin= "copyartifact@1.30" > <project> ${PROMOTED_JOB_NAME} </project> <filter> **/build/outputs/proguard/** </filter> <target> /u0/releases/Reader-Android/${GIT_BRANCH}/QA/${PROMOTED_NUMBER} </target> <selector class= "hudson.plugins.copyartifact.PermalinkBuildSelector" > <id> QA </id> </selector> <doNotFingerprintArtifacts> false </doNotFingerprintArtifacts> </hudson.plugins.copyartifact.CopyArtifact> <hudson.plugins.copyartifact.CopyArtifact plugin= "copyartifact@1.30" > <project> ${PROMOTED_JOB_NAME} </project> <filter> **/src/androidTest/**,**/lib/**,**/build.gradle </filter> <target> /u0/releases/Reader-Android/${GIT_BRANCH}/QA/${PROMOTED_NUMBER} </target> <selector class= "hudson.plugins.copyartifact.PermalinkBuildSelector" > <id> QA </id> </selector> <doNotFingerprintArtifacts> false </doNotFingerprintArtifacts> </hudson.plugins.copyartifact.CopyArtifact> <hudson.tasks.Shell> <command> git push --tag || true </command> </hudson.tasks.Shell> </buildSteps>
          Hide
          ikedam ikedam added a comment -

          Copyartifact 1.32 tries to define ""COPYARTIFACT_BUILD_NUMBER_XXXX" even for promotions, and that causes NPE.
          This is caused as promotion processes doesn't belong to Jenkins item tree hierarchy, and copyartifact fails to calculate relative paths of copied projects.

          Now work is in progress at https://github.com/jenkinsci/copyartifact-plugin/pull/52

          Show
          ikedam ikedam added a comment - Copyartifact 1.32 tries to define ""COPYARTIFACT_BUILD_NUMBER_XXXX" even for promotions, and that causes NPE. This is caused as promotion processes doesn't belong to Jenkins item tree hierarchy, and copyartifact fails to calculate relative paths of copied projects. Now work is in progress at https://github.com/jenkinsci/copyartifact-plugin/pull/52
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: ikedam
          Path:
          src/main/java/hudson/plugins/copyartifact/CopyArtifact.java
          http://jenkins-ci.org/commit/copyartifact-plugin/56a184f021bf9a81a072607466156d4c3e4996ec
          Log:
          [FIXED JENKINS-25155] Fix NPE with Promoted Builds: should use getRootProject() to get the parent builds of matrix, maven, ivy. Item#getRelativeNameFrom may return null.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: ikedam Path: src/main/java/hudson/plugins/copyartifact/CopyArtifact.java http://jenkins-ci.org/commit/copyartifact-plugin/56a184f021bf9a81a072607466156d4c3e4996ec Log: [FIXED JENKINS-25155] Fix NPE with Promoted Builds: should use getRootProject() to get the parent builds of matrix, maven, ivy. Item#getRelativeNameFrom may return null.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: ikedam
          Path:
          src/main/java/hudson/plugins/copyartifact/CopyArtifact.java
          http://jenkins-ci.org/commit/copyartifact-plugin/99d0e4f081e65bbacce6cfc400650206bb2f5ce8
          Log:
          Merge pull request #52 from ikedam/feature/JENKINS-25155_FixNpeWithPromotedBuilds

          JENKINS-25155 Fix NPE with Promoted Builds

          Compare: https://github.com/jenkinsci/copyartifact-plugin/compare/836b307a00ee...99d0e4f081e6

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: ikedam Path: src/main/java/hudson/plugins/copyartifact/CopyArtifact.java http://jenkins-ci.org/commit/copyartifact-plugin/99d0e4f081e65bbacce6cfc400650206bb2f5ce8 Log: Merge pull request #52 from ikedam/feature/ JENKINS-25155 _FixNpeWithPromotedBuilds JENKINS-25155 Fix NPE with Promoted Builds Compare: https://github.com/jenkinsci/copyartifact-plugin/compare/836b307a00ee...99d0e4f081e6
          Hide
          ikedam ikedam added a comment -

          Fixed in copyartifact 1.32.1.
          It will be available in a day.
          Please try that.

          Show
          ikedam ikedam added a comment - Fixed in copyartifact 1.32.1. It will be available in a day. Please try that.

            People

            • Assignee:
              ikedam ikedam
              Reporter:
              b_dean Ben Dean
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: