Given the following
queue: Hosted Linux Preview steps: - script: | false true
The expected behavior and the actual behavior differ.
Expected behavior: Build fails at the
true will not be executed.
Actual behavior: Build succeeds,
true is executed after the
I would expect the VSTS build to fail on the first command
However, VSTS executes the second command
true as well and reports success.
This means that the shell is setup incorrectly for build systems. The correct setup would be to have
errexit set. But it seems that
errexit is not set, and probably
pipefail isn't set either.
Is there a way to get the correct behavior, that is,
errexit, within the YAML file, without using
bash -c in the scripts section? I know I can easily workaround by just moving the command sequence into a shell script or
Makefile, I just want to know if there is a configuration possibility to get the YAML file execute shell commands in a shell with
pipefail set, preferably a
It seems that the bash shell created by VSTS does not have the
errexit flags set. See the following issue on GitHub about this: https://github.com/Microsoft/vsts-agent/issues/1803
But they can be set within the YAML file, like this:
queue: Hosted Linux Preview steps: - script: | set -e ; set -o pipefail false true