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

Build is not failing when powershell script exits with "MissingMandatoryParameter" or "CommandNotFoundException"

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      1.36

      Description

       A build will not fail when a powershell script encounters an error "MissingMandatoryParameter" or "CommandNotFoundException".

      I would expect an error code other than 0, or, for the script to fail.

      Here are some examples:

      powershell "gobbledygook"
      

      Results in something similar to:

      [Pipeline] echo
      
          Running powershell command:
          gobbledygook
        
      [Pipeline] powershell
      powershell.exe : gobbledygook : The term 'gobbledygook' is not recognized as the name of a cmdlet, function, script file, or operable 
      At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-25a0caf8\powershellWrapper.ps1:3 char:1
      + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (gobbledygook : ...e, or operable :String) [], RemoteException
          + FullyQualifiedErrorId : NativeCommandError
       
      program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
      At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git 
      branch@tmp\durable-25a0caf8\powershellScript.ps1:3 char:5
      +     gobbledygook
      +     ~~~~~~~~~~~~
      
          + CategoryInfo          : ObjectNotFound: (gobbledygook:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
      
       
      
      [Pipeline] echo
      Powershell exit status: 0

      and

      powershell "buildVS 'Release' -nuget $true"
      

      Results in something similar to:

      [Pipeline] echo
      
          Running powershell command:
          buildVS  'Release' -nuget $true
        
      [Pipeline] powershell
      powershell.exe : buildVS : Cannot process command because of one or more missing mandatory parameters: config.
      At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-9137f721\powershellWrapper.ps1:3 char:1
      + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (buildVS : Canno...meters: config.:String) [], RemoteException
          + FullyQualifiedErrorId : NativeCommandError
       
      At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git 
      branch@tmp\durable-9137f721\powershellScript.ps1:3 char:5
      
      +     buildVS  'Release' -nuget $true
      
      +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
          + CategoryInfo          : InvalidArgument: (:) [buildVS], ParameterBindingException
      
          + FullyQualifiedErrorId : MissingMandatoryParameter,buildVS
      
       
      
      [Pipeline] echo
      Powershell exit status: 0

       

        Attachments

          Activity

          brent_zeiss Brent Zeiss created issue -
          brent_zeiss Brent Zeiss made changes -
          Field Original Value New Value
          Description The powershell command is:

          buildVS 'Release' -nuget $true

           

          [Pipeline] echo Running powershell command:
              buildVS 'Release' -nuget $true [Pipeline] powershellpowershell.exe : buildVS : Cannot process command because of one or more missing mandatory parameters: config.
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-d4ee0605\powershellWrapper.ps1:3 char:1
          + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              + CategoryInfo : NotSpecified: (buildVS : Canno...meters: config.:String) [], RemoteException
              + FullyQualifiedErrorId : NativeCommandError
           
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
          branch@tmp\durable-d4ee0605\powershellScript.ps1:3 char:5

          + buildVS 'Release' -nuget $true
          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

              + CategoryInfo : InvalidArgument: (:) [buildVS], ParameterBindingException

              + FullyQualifiedErrorId : MissingMandatoryParameter,buildVS
           

           

          [Pipeline] echo Running powershell command:
           buildVS 'Release' -nuget $true [Pipeline] powershellpowershell.exe : buildVS : Cannot process command because of one or more missing mandatory parameters: config.
           At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-d4ee0605\powershellWrapper.ps1:3 char:1
           + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           + CategoryInfo : NotSpecified: (buildVS : Canno...meters: config.:String) [], RemoteException
           + FullyQualifiedErrorId : NativeCommandError

          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
           branch@tmp\durable-d4ee0605\powershellScript.ps1:3 char:5

          + buildVS 'Release' -nuget $true
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          + CategoryInfo : InvalidArgument: (:) [buildVS], ParameterBindingException

          + FullyQualifiedErrorId : MissingMandatoryParameter,buildVS
          brent_zeiss Brent Zeiss made changes -
          Description  

           

          [Pipeline] echo Running powershell command:
           buildVS 'Release' -nuget $true [Pipeline] powershellpowershell.exe : buildVS : Cannot process command because of one or more missing mandatory parameters: config.
           At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-d4ee0605\powershellWrapper.ps1:3 char:1
           + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           + CategoryInfo : NotSpecified: (buildVS : Canno...meters: config.:String) [], RemoteException
           + FullyQualifiedErrorId : NativeCommandError

          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
           branch@tmp\durable-d4ee0605\powershellScript.ps1:3 char:5

          + buildVS 'Release' -nuget $true
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          + CategoryInfo : InvalidArgument: (:) [buildVS], ParameterBindingException

          + FullyQualifiedErrorId : MissingMandatoryParameter,buildVS
           A build will not fail when a powershell script encounters an error "MissingMandatoryParameter" or "CommandNotFoundException".

          I would expect an error code other than 0, or, for the script to fail.

          Here are some examples:
          {code:java}
          powershell "buildVS 'Release' -nuget $true"
          {code}
           

          Results in something similar to:
          {noformat}
          [Pipeline] echo Running powershell command:
           buildVS 'Release' -nuget $true [Pipeline] powershellpowershell.exe : buildVS : Cannot process command because of one or more missing mandatory parameters: config.
           At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-d4ee0605\powershellWrapper.ps1:3 char:1
           + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           + CategoryInfo : NotSpecified: (buildVS : Canno...meters: config.:String) [], RemoteException
           + FullyQualifiedErrorId : NativeCommandError
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
           branch@tmp\durable-d4ee0605\powershellScript.ps1:3 char:5
          + buildVS 'Release' -nuget $true
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo : InvalidArgument: ( [buildVS], ParameterBindingException
          + FullyQualifiedErrorId : MissingMandatoryParameter,buildVS{noformat}
          and
          {code:java}
          powershell "gobbledygook"
          {code}
          Results in something similar to:
          {noformat}
          [Pipeline] echo

              Running powershell command:
              gobbledygook
            
          [Pipeline] powershell
          powershell.exe : gobbledygook : The term 'gobbledygook' is not recognized as the name of a cmdlet, function, script file, or operable
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-25a0caf8\powershellWrapper.ps1:3 char:1
          + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              + CategoryInfo : NotSpecified: (gobbledygook : ...e, or operable :String) [], RemoteException
              + FullyQualifiedErrorId : NativeCommandError
           
          program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
          branch@tmp\durable-25a0caf8\powershellScript.ps1:3 char:5
          + gobbledygook
          + ~~~~~~~~~~~~

              + CategoryInfo : ObjectNotFound: (gobbledygook:String) [], CommandNotFoundException
              + FullyQualifiedErrorId : CommandNotFoundException

           

          [Pipeline] echo
          Powershell exit status: 0{noformat}
           

           
          brent_zeiss Brent Zeiss made changes -
          Description  A build will not fail when a powershell script encounters an error "MissingMandatoryParameter" or "CommandNotFoundException".

          I would expect an error code other than 0, or, for the script to fail.

          Here are some examples:
          {code:java}
          powershell "buildVS 'Release' -nuget $true"
          {code}
           

          Results in something similar to:
          {noformat}
          [Pipeline] echo Running powershell command:
           buildVS 'Release' -nuget $true [Pipeline] powershellpowershell.exe : buildVS : Cannot process command because of one or more missing mandatory parameters: config.
           At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-d4ee0605\powershellWrapper.ps1:3 char:1
           + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           + CategoryInfo : NotSpecified: (buildVS : Canno...meters: config.:String) [], RemoteException
           + FullyQualifiedErrorId : NativeCommandError
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
           branch@tmp\durable-d4ee0605\powershellScript.ps1:3 char:5
          + buildVS 'Release' -nuget $true
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo : InvalidArgument: ( [buildVS], ParameterBindingException
          + FullyQualifiedErrorId : MissingMandatoryParameter,buildVS{noformat}
          and
          {code:java}
          powershell "gobbledygook"
          {code}
          Results in something similar to:
          {noformat}
          [Pipeline] echo

              Running powershell command:
              gobbledygook
            
          [Pipeline] powershell
          powershell.exe : gobbledygook : The term 'gobbledygook' is not recognized as the name of a cmdlet, function, script file, or operable
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-25a0caf8\powershellWrapper.ps1:3 char:1
          + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              + CategoryInfo : NotSpecified: (gobbledygook : ...e, or operable :String) [], RemoteException
              + FullyQualifiedErrorId : NativeCommandError
           
          program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
          branch@tmp\durable-25a0caf8\powershellScript.ps1:3 char:5
          + gobbledygook
          + ~~~~~~~~~~~~

              + CategoryInfo : ObjectNotFound: (gobbledygook:String) [], CommandNotFoundException
              + FullyQualifiedErrorId : CommandNotFoundException

           

          [Pipeline] echo
          Powershell exit status: 0{noformat}
           

           
           A build will not fail when a powershell script encounters an error "MissingMandatoryParameter" or "CommandNotFoundException".

          I would expect an error code other than 0, or, for the script to fail.

          Here are some examples:
          {code:java}
          powershell "gobbledygook"
          {code}
          Results in something similar to:
          {noformat}
          [Pipeline] echo

              Running powershell command:
              gobbledygook
            
          [Pipeline] powershell
          powershell.exe : gobbledygook : The term 'gobbledygook' is not recognized as the name of a cmdlet, function, script file, or operable
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-25a0caf8\powershellWrapper.ps1:3 char:1
          + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              + CategoryInfo : NotSpecified: (gobbledygook : ...e, or operable :String) [], RemoteException
              + FullyQualifiedErrorId : NativeCommandError
           
          program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
          branch@tmp\durable-25a0caf8\powershellScript.ps1:3 char:5
          + gobbledygook
          + ~~~~~~~~~~~~

              + CategoryInfo : ObjectNotFound: (gobbledygook:String) [], CommandNotFoundException
              + FullyQualifiedErrorId : CommandNotFoundException

           

          [Pipeline] echo
          Powershell exit status: 0{noformat}
          and
          {code:java}
          powershell "buildVS 'Release' -nuget $true"
          {code}
          Results in something similar to:
          {noformat}
          [Pipeline] echo Running powershell command:
           buildVS 'Release' -nuget $true [Pipeline] powershellpowershell.exe : buildVS : Cannot process command because of one or more missing mandatory parameters: config.
           At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-d4ee0605\powershellWrapper.ps1:3 char:1
           + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           + CategoryInfo : NotSpecified: (buildVS : Canno...meters: config.:String) [], RemoteException
           + FullyQualifiedErrorId : NativeCommandError
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
           branch@tmp\durable-d4ee0605\powershellScript.ps1:3 char:5
          + buildVS 'Release' -nuget $true
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo : InvalidArgument: ( [buildVS], ParameterBindingException
          + FullyQualifiedErrorId : MissingMandatoryParameter,buildVS{noformat}
           
          brent_zeiss Brent Zeiss made changes -
          Description  A build will not fail when a powershell script encounters an error "MissingMandatoryParameter" or "CommandNotFoundException".

          I would expect an error code other than 0, or, for the script to fail.

          Here are some examples:
          {code:java}
          powershell "gobbledygook"
          {code}
          Results in something similar to:
          {noformat}
          [Pipeline] echo

              Running powershell command:
              gobbledygook
            
          [Pipeline] powershell
          powershell.exe : gobbledygook : The term 'gobbledygook' is not recognized as the name of a cmdlet, function, script file, or operable
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-25a0caf8\powershellWrapper.ps1:3 char:1
          + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              + CategoryInfo : NotSpecified: (gobbledygook : ...e, or operable :String) [], RemoteException
              + FullyQualifiedErrorId : NativeCommandError
           
          program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
          branch@tmp\durable-25a0caf8\powershellScript.ps1:3 char:5
          + gobbledygook
          + ~~~~~~~~~~~~

              + CategoryInfo : ObjectNotFound: (gobbledygook:String) [], CommandNotFoundException
              + FullyQualifiedErrorId : CommandNotFoundException

           

          [Pipeline] echo
          Powershell exit status: 0{noformat}
          and
          {code:java}
          powershell "buildVS 'Release' -nuget $true"
          {code}
          Results in something similar to:
          {noformat}
          [Pipeline] echo Running powershell command:
           buildVS 'Release' -nuget $true [Pipeline] powershellpowershell.exe : buildVS : Cannot process command because of one or more missing mandatory parameters: config.
           At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-d4ee0605\powershellWrapper.ps1:3 char:1
           + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           + CategoryInfo : NotSpecified: (buildVS : Canno...meters: config.:String) [], RemoteException
           + FullyQualifiedErrorId : NativeCommandError
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
           branch@tmp\durable-d4ee0605\powershellScript.ps1:3 char:5
          + buildVS 'Release' -nuget $true
           + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo : InvalidArgument: ( [buildVS], ParameterBindingException
          + FullyQualifiedErrorId : MissingMandatoryParameter,buildVS{noformat}
           
           A build will not fail when a powershell script encounters an error "MissingMandatoryParameter" or "CommandNotFoundException".

          I would expect an error code other than 0, or, for the script to fail.

          Here are some examples:
          {code:java}
          powershell "gobbledygook"
          {code}
          Results in something similar to:
          {noformat}
          [Pipeline] echo

              Running powershell command:
              gobbledygook
            
          [Pipeline] powershell
          powershell.exe : gobbledygook : The term 'gobbledygook' is not recognized as the name of a cmdlet, function, script file, or operable
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-25a0caf8\powershellWrapper.ps1:3 char:1
          + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              + CategoryInfo : NotSpecified: (gobbledygook : ...e, or operable :String) [], RemoteException
              + FullyQualifiedErrorId : NativeCommandError
           
          program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
          branch@tmp\durable-25a0caf8\powershellScript.ps1:3 char:5
          + gobbledygook
          + ~~~~~~~~~~~~

              + CategoryInfo : ObjectNotFound: (gobbledygook:String) [], CommandNotFoundException
              + FullyQualifiedErrorId : CommandNotFoundException

           

          [Pipeline] echo
          Powershell exit status: 0{noformat}
          and
          {code:java}
          powershell "buildVS 'Release' -nuget $true"
          {code}
          Results in something similar to:
          {noformat}
          [Pipeline] echo

              Running powershell command:
              buildVS 'Release' -nuget $true
            
          [Pipeline] powershell
          powershell.exe : buildVS : Cannot process command because of one or more missing mandatory parameters: config.
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git branch@tmp\durable-9137f721\powershellWrapper.ps1:3 char:1
          + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Comm ...
          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              + CategoryInfo : NotSpecified: (buildVS : Canno...meters: config.:String) [], RemoteException
              + FullyQualifiedErrorId : NativeCommandError
           
          At C:\jenkins_workspace\Jenkins Playground\WebAppTest - Deploy from Git
          branch@tmp\durable-9137f721\powershellScript.ps1:3 char:5

          + buildVS 'Release' -nuget $true

          + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

              + CategoryInfo : InvalidArgument: (:) [buildVS], ParameterBindingException

              + FullyQualifiedErrorId : MissingMandatoryParameter,buildVS

           

          [Pipeline] echo
          Powershell exit status: 0{noformat}
           
          carroll Carroll Chiou made changes -
          Released As 1.36
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            brent_zeiss Brent Zeiss
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: