Commit 6bb1accd authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

fix(bash mode): unmask errors in shell pipelines with 'set -o pipefail'

parent 156a4275
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ stages:

.go-scripts: &go-scripts |
  # BEGSCRIPT
  set -e
  set -eo pipefail

  function log_info() {
    >&2 echo -e "[\\e[1;94mINFO\\e[0m] $*"
@@ -455,7 +455,8 @@ stages:
  }

  function eval_all_secrets() {
    encoded_vars=$(env | grep -v '^scoped__' | awk -F '=' '/^[a-zA-Z0-9_]*=@(b64|hex|url)@/ {print $1}')
    # exclude scoped variables and their copies passed to container services (`<service_name>_ENV_scoped__xxx`)
    encoded_vars=$(env | awk -F '=' '$1 !~ /(^|_ENV_)scoped__/ && $2 ~ /^@(b64|hex|url)@/ {print $1}')
    for var in $encoded_vars
    do
      eval_secret "$var"
@@ -539,7 +540,7 @@ stages:
    # shellcheck disable=SC2086
    go test $GO_TEST_FLAGS "-coverprofile=reports/go-coverage.native.out" $GO_TEST_PACKAGES > "$go_text_report"
    test_rc=$?
    set -e
    set -eo pipefail

    # dump text report in the console
    cat "$go_text_report" || (echo "Display of go test report file failed; Display of last 100 lines." && tail -n100 "$go_text_report")