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

PowerShell Script Runs Fail (nullPointerException)

    • Jenkins 2.249

      I have for some time had my builds all run the following PowerShell command:

      if (!(Invoke-Command -computername serverName {rename-item -path C:\fileToBeRenamed -newname C:\renamedFile -ErrorAction Stop; Return $? })) { $LASTEXITCODE = 1 }

      In versions prior to 2.248, the script executes successfully, and after a reversion to 2.245, the script still executes successfully.

      Here is the error when it attempted to run the PowerShell script in 2.248. The script did not execute (as in, it did not perform the rename as intended.)

      C:\Program Files (x86)\Jenkins\workspace\app>exit 0
      ERROR: Build step failed with exception
      java.lang.NullPointerException
      at java.util.ArrayList.<init>(Unknown Source)
      at hudson.tasks.CommandInterpreter.buildEnvVarsFilterRules(CommandInterpreter.java:79)
      at hudson.Launcher.prepareFilterRules(Launcher.java:123)
      at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:133)
      at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:90)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
      at hudson.model.Build$BuildExecution.build(Build.java:206)
      at hudson.model.Build$BuildExecution.doRun(Build.java:163)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
      at hudson.model.Run.execute(Run.java:1880)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:428)
      Build step 'PowerShell' marked build as failure
      Finished: FAILURE

      This requires a downgrade to 2.245.

          [JENKINS-63168] PowerShell Script Runs Fail (nullPointerException)

          Kasey Krehbiel created issue -

          Oleg Nenashev added a comment -

          Most likely a regression after JENKINS-62014 . Cc danielbeck

          Oleg Nenashev added a comment - Most likely a regression after  JENKINS-62014 . Cc danielbeck

          Oleg Nenashev added a comment -

          kaseykrehbiel regarding security, 2.245 includes the security fixes but not other changes in 2.248. Have you tried it?

          Oleg Nenashev added a comment - kaseykrehbiel regarding security, 2.245 includes the security fixes but not other changes in 2.248. Have you tried it?

          oleg_nenashev I can confirm that 2.245 does not have this issue, so it only exists in 2.248. Thanks for checking it out.

          Kasey Krehbiel added a comment - oleg_nenashev I can confirm that 2.245 does not have this issue, so it only exists in 2.248. Thanks for checking it out.
          Kasey Krehbiel made changes -
          Description Original: I have for some time had my builds all run the following PowerShell command:

          if (!(Invoke-Command -computername serverName \{rename-item -path C:\fileToBeRenamed -newname C:\renamedFile -ErrorAction Stop; Return $? })) \{ $LASTEXITCODE = 1 }

          In versions prior to 2.248, the script executes successfully, and after a reversion to 2.244, the script still executes successfully.

          Here is the error when it attempted to run the PowerShell script in 2.248. The script did not execute (as in, it did not perform the rename as intended.)

          C:\Program Files (x86)\Jenkins\workspace\app>exit 0
          ERROR: Build step failed with exception
          java.lang.NullPointerException
           at java.util.ArrayList.<init>(Unknown Source)
           at hudson.tasks.CommandInterpreter.buildEnvVarsFilterRules(CommandInterpreter.java:79)
           at hudson.Launcher.prepareFilterRules(Launcher.java:123)
           at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:133)
           at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:90)
           at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
           at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
           at hudson.model.Build$BuildExecution.build(Build.java:206)
           at hudson.model.Build$BuildExecution.doRun(Build.java:163)
           at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
           at hudson.model.Run.execute(Run.java:1880)
           at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
           at hudson.model.ResourceController.execute(ResourceController.java:97)
           at hudson.model.Executor.run(Executor.java:428)
          Build step 'PowerShell' marked build as failure
          Finished: FAILURE

          This requires a downgrade to 2.244, which is insecure. There is no workaround for this as we must use PowerShell scripts in our builds.
          New: I have for some time had my builds all run the following PowerShell command:

          if (!(Invoke-Command -computername serverName \{rename-item -path C:\fileToBeRenamed -newname C:\renamedFile -ErrorAction Stop; Return $? })) \{ $LASTEXITCODE = 1 }

          In versions prior to 2.248, the script executes successfully, and after a reversion to 2.244, the script still executes successfully.

          Here is the error when it attempted to run the PowerShell script in 2.248. The script did not execute (as in, it did not perform the rename as intended.)

          C:\Program Files (x86)\Jenkins\workspace\app>exit 0
           ERROR: Build step failed with exception
           java.lang.NullPointerException
           at java.util.ArrayList.<init>(Unknown Source)
           at hudson.tasks.CommandInterpreter.buildEnvVarsFilterRules(CommandInterpreter.java:79)
           at hudson.Launcher.prepareFilterRules(Launcher.java:123)
           at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:133)
           at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:90)
           at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
           at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
           at hudson.model.Build$BuildExecution.build(Build.java:206)
           at hudson.model.Build$BuildExecution.doRun(Build.java:163)
           at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
           at hudson.model.Run.execute(Run.java:1880)
           at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
           at hudson.model.ResourceController.execute(ResourceController.java:97)
           at hudson.model.Executor.run(Executor.java:428)
           Build step 'PowerShell' marked build as failure
           Finished: FAILURE

          This requires a downgrade to 2.245.
          Kasey Krehbiel made changes -
          Description Original: I have for some time had my builds all run the following PowerShell command:

          if (!(Invoke-Command -computername serverName \{rename-item -path C:\fileToBeRenamed -newname C:\renamedFile -ErrorAction Stop; Return $? })) \{ $LASTEXITCODE = 1 }

          In versions prior to 2.248, the script executes successfully, and after a reversion to 2.244, the script still executes successfully.

          Here is the error when it attempted to run the PowerShell script in 2.248. The script did not execute (as in, it did not perform the rename as intended.)

          C:\Program Files (x86)\Jenkins\workspace\app>exit 0
           ERROR: Build step failed with exception
           java.lang.NullPointerException
           at java.util.ArrayList.<init>(Unknown Source)
           at hudson.tasks.CommandInterpreter.buildEnvVarsFilterRules(CommandInterpreter.java:79)
           at hudson.Launcher.prepareFilterRules(Launcher.java:123)
           at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:133)
           at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:90)
           at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
           at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
           at hudson.model.Build$BuildExecution.build(Build.java:206)
           at hudson.model.Build$BuildExecution.doRun(Build.java:163)
           at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
           at hudson.model.Run.execute(Run.java:1880)
           at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
           at hudson.model.ResourceController.execute(ResourceController.java:97)
           at hudson.model.Executor.run(Executor.java:428)
           Build step 'PowerShell' marked build as failure
           Finished: FAILURE

          This requires a downgrade to 2.245.
          New: I have for some time had my builds all run the following PowerShell command:

          if (!(Invoke-Command -computername serverName \{rename-item -path C:\fileToBeRenamed -newname C:\renamedFile -ErrorAction Stop; Return $? })) \{ $LASTEXITCODE = 1 }

          In versions prior to 2.248, the script executes successfully, and after a reversion to 2.245, the script still executes successfully.

          Here is the error when it attempted to run the PowerShell script in 2.248. The script did not execute (as in, it did not perform the rename as intended.)

          C:\Program Files (x86)\Jenkins\workspace\app>exit 0
           ERROR: Build step failed with exception
           java.lang.NullPointerException
           at java.util.ArrayList.<init>(Unknown Source)
           at hudson.tasks.CommandInterpreter.buildEnvVarsFilterRules(CommandInterpreter.java:79)
           at hudson.Launcher.prepareFilterRules(Launcher.java:123)
           at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:133)
           at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:90)
           at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
           at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
           at hudson.model.Build$BuildExecution.build(Build.java:206)
           at hudson.model.Build$BuildExecution.doRun(Build.java:163)
           at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
           at hudson.model.Run.execute(Run.java:1880)
           at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
           at hudson.model.ResourceController.execute(ResourceController.java:97)
           at hudson.model.Executor.run(Executor.java:428)
           Build step 'PowerShell' marked build as failure
           Finished: FAILURE

          This requires a downgrade to 2.245.
          Daniel Beck made changes -
          Assignee New: Daniel Beck [ danielbeck ]
          Daniel Beck made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Daniel Beck added a comment - - edited

          Looks like https://plugins.jenkins.io/powershell/ is the plugin.

          We added a new field in the common supertype in core that readResolves to an object in the core subtypes, but that isn't done in external implementations, and methods accessing the field cannot deal with null values Huge oversight.

           

          Daniel Beck added a comment - - edited Looks like https://plugins.jenkins.io/powershell/ is the plugin. We added a new field in the common supertype in core that readResolves to an object in the core subtypes, but that isn't done in external implementations, and methods accessing the field cannot deal with null values Huge oversight.  

          Daniel Beck added a comment -

          I expect that the problem goes away if affected job configurations are saved without changes.

          Unfortunately any automation writing "old data" will break.

          Daniel Beck added a comment - I expect that the problem goes away if affected job configurations are saved without changes. Unfortunately any automation writing "old data" will break.

            danielbeck Daniel Beck
            kaseykrehbiel Kasey Krehbiel
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: