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

Promoting build with custom workspace results in NullPointerException

XMLWordPrintable

      Promoting a build with a custom workspace results in:

      java.lang.NullPointerException
          at hudson.plugins.promoted_builds.Promotion.getUrl(Promotion.java:61)
          at hudson.model.Run.getEnvironment(Run.java:1771)
          at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:725)
          at hudson.plugins.promoted_builds.Promotion.getEnvironment(Promotion.java:74)
          at hudson.plugins.promoted_builds.Promotion$RunnerImpl.decideWorkspace(Promotion.java:107)
          ...
      

      When a build with a custom workspace is promoted, decideWorkspace(...) attempts to build the environment, which eventually results in a call to getUrl() before the target build number has been initialized. Promotion guards against this in its own getEnvironment(TaskListener) implementation, however, it still ends up getting called by Run.getEnvironment(TaskListener).

      Several people have also reported this in the comments on the plugin wiki.

      I'll be submitting a pull request in GitHub shortly with a proposed solution.

            petehayes Peter Hayes
            mrobinet mrobinet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: