2017-03-16 - starting a script

some time ago we had an issue on CI build machines. on test environment, failed builds did not fail. all CI did was to run a simple bash script – sth along these lines:

#!/bin/bash -ex
cd /build/path
cmake /source/dir
ninja
ctest

we double-checked that build errors failed the script locally, but not on our CI. after a bit of digging it turned out that CI is running scripts like this:

bash /path/to/ci/script

while we run these “the usual way”:

cd /path/to/ci
./script

difference? when source-running, bash-bang is ignored! :) this in turn means that stopping on error was not honored – the rest you already know.

answer? update your script:

#!/bin/bash
set -ex       # NOTE: changing shell settings inside the script, not bash-bang
cd /build/path
cmake /source/dir
ninja
ctest
blog/2017/03/16/2017-03-16_-_starting_a_script.txt · Last modified: 2021/06/15 20:09 by 127.0.0.1
Back to top
Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0