Why does Bamboo build system not respect PowerShell return codes?

I am using Bamboo Server 7.2.3.

Whenever I use WINDOWS_POWER_SHELL as the interpreter for scripts that I am running (either in the UI, or in YAML), I do not get a failed job / task when the script fails.

Example YAML (does not fail the build):

- script:
    interpreter: WINDOWS_POWER_SHELL
    scripts:
      - $env:DOCKER_HOST="${bamboo.docker_host}"
      - docker exec <FAILING COMMAND>

I would expect the above code to fail the job that is running this script task, but it does not.

The following code, however, DOES fail the build- notice that I am using the native script interpreter, BINSH_OR_CMDEXE.

Example YAML (fails correctly):

- script:
    interpreter: BINSH_OR_CMDEXE
    scripts:
      - SET DOCKER_HOST=${bamboo.docker_host} 
      - docker exec <FAILING COMMAND>

This is pretty annoying, and I am wondering if I am crazy, or if there is a known bug in bamboo that would speak to this, or even hopefully a solution to this problem.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum