• Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • None
    • Tasks
    • None
    • 2
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Issue Summary

      Currently, Bamboo is only looking for a successful response code with a PowerShell script. So, by default, if you run a PowerShell script task with some non existing command, Bamboo will mark this task as successful.

      Steps to Reproduce

      1. Create a script task with powershell interpreter and coma content like "idonotexist"
      2. Run the plan

      Expected Results

      Script task fails

      Actual Results

      Script task is green even though the above command will cause an error.

      Workaround

      There's a workaround of handing errors in a PowerShell script, for example, check exit code of commands or/and set $ErrorActionPreference = "Stop"

            [BAM-21162] Better handle PowerShell command execution in Bamboo

            This feature request implementation will be reverted at 10.2.3 because of unexpected break of existing workflows. We will focus at implementing that feature targeted for future major release

            Alexey Chystoprudov added a comment - This feature request implementation will be reverted at 10.2.3 because of unexpected break of existing workflows. We will focus at implementing that feature targeted for future major release

            Hello ffe0d2d1b4e6. We are sorry to hear you are having issues while running PS1 scripts in Bamboo. Unfortunately, we could not reproduce the problem you have described. Can you please reach out to Atlassian Support at https://support.atlassian.com/contact and provide us with more details about your environment, including the PowerShell script contents? Please don't share it here as this is a public website.

            Eduardo Alvarenga added a comment - Hello ffe0d2d1b4e6 . We are sorry to hear you are having issues while running PS1 scripts in Bamboo. Unfortunately, we could not reproduce the problem you have described. Can you please reach out to Atlassian Support at https://support.atlassian.com/contact and provide us with more details about your environment, including the PowerShell script contents? Please don't share it here as this is a public website.

            Hi 73868399605e! Our build and deployments started failing after upgrading from 9.6.8 to 10.2.2

            It looks like the command generated by Bamboo for executing INLINE POWERSHELL scripts has changed, and is no longer valid.

            Previously, it looks like you execute the raw script

            &('C:\Program Files\Atlassian\Bamboo Build Agent\temp\14385153-27656196-42762584-ScriptBuildTask-14708832898906923431.ps1')

            Now it appears to pass the file with call operator to a powershell command line

            powershell -NonInteractive -ExecutionPolicy Bypass -File &('C:\Program Files\Atlassian\Bamboo Build Agent\temp\14385153-27656196-46006278-ScriptBuildTask-6297293055849768387.ps1')

            And this fails with 

            Processing -File '&('C:\Program Files\Atlassian\Bamboo Build Agent\temp\14385153-27656196-46006278-ScriptBuildTask-6297293055849768387.ps1')' failed: The given path's format is not supported. Specify a valid path for the -File parameter.
            
            Failing task since return code of [powershell -NonInteractive -ExecutionPolicy Bypass -File &('C:\Program Files\Atlassian\Bamboo Build Agent\temp\14385153-27656196-46006278-ScriptBuildTask-6297293055849768387.ps1')] was -196608 while expected 0

            I see no mention of anyone else suffering from this, but it seems like a catastrophic bug??? This is affecting both build and deployment projects. Any thoughts? 

            Chris Heale added a comment - Hi 73868399605e ! Our build and deployments started failing after upgrading from 9.6.8 to 10.2.2 It looks like the command generated by Bamboo for executing INLINE POWERSHELL scripts has changed, and is no longer valid. Previously, it looks like you execute the raw script &('C:\Program Files\Atlassian\Bamboo Build Agent\temp\14385153-27656196-42762584-ScriptBuildTask-14708832898906923431.ps1') Now it appears to pass the file with call operator to a powershell command line powershell -NonInteractive -ExecutionPolicy Bypass -File &('C:\Program Files\Atlassian\Bamboo Build Agent\temp\14385153-27656196-46006278-ScriptBuildTask-6297293055849768387.ps1') And this fails with  Processing -File '&('C:\Program Files\Atlassian\Bamboo Build Agent\temp\14385153-27656196-46006278-ScriptBuildTask-6297293055849768387.ps1')' failed: The given path's format is not supported. Specify a valid path for the -File parameter. Failing task since return code of [powershell -NonInteractive -ExecutionPolicy Bypass -File &('C:\Program Files\Atlassian\Bamboo Build Agent\temp\14385153-27656196-46006278-ScriptBuildTask-6297293055849768387.ps1')] was -196608 while expected 0 I see no mention of anyone else suffering from this, but it seems like a catastrophic bug??? This is affecting both build and deployment projects. Any thoughts? 

            From Bamboo 10.2.2, customers can benefit from the following Script Tasks options linked to the PowerShell Interpreter:

            • Enable PowerShell exit code handling – Append exit $LastExitCode to ensure the script exits with the final command’s status. Applicable only when the interpreter is set as Windows PowerShell.
            • Enable PowerShell Stop error action – Prepend $ErrorActionPreference = "Stop" to halt the script execution immediately on non-terminating errors. Usually applies to failed cmdlets. Applicable only when the interpreter is set as Windows PowerShell.

            Settings are also available via Bamboo Specs.

            Eduardo Alvarenga added a comment - From Bamboo 10.2.2 , customers can benefit from the following Script Tasks options linked to the PowerShell Interpreter: Enable PowerShell exit code handling – Append  exit $LastExitCode  to ensure the script exits with the final command’s status. Applicable only when the interpreter is set as Windows PowerShell. Enable PowerShell Stop error action – Prepend  $ErrorActionPreference = "Stop"  to halt the script execution immediately on non-terminating errors. Usually applies to failed cmdlets. Applicable only when the interpreter is set as Windows PowerShell. Settings are also available via Bamboo Specs.

              73868399605e Eduardo Alvarenga
              c64f33b2bce3 Yevhen
              Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: