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

AbstractBuild#getEnvironment returns NPE if build isn't running

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None

      This relates to JENKINS-7915. I can workaround the problem in clearcase plugin, but I believe this should be fixed in core.
      Thing is, AbstractBuild#getEnvironment relies on Run#getEnvironment which retrieves the computer the build occurs using

      Computer.currentComputer()

      However, it only works if the current thread is an executor, that is, only if the build is running. In AbstractBuild, using getBuiltOn().toComputer(), we can actually retrieve a valid reference for the computer the build executed even if it isn't running anymore.

            kohsuke Kohsuke Kawaguchi
            vlatombe Vincent Latombe
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: