Commit 942890ac authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

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

parent 008229b1
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ variables:

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

  function log_info() {
      echo -e "[\\e[1;94mINFO\\e[0m] $*"
@@ -259,7 +259,7 @@ variables:
    log_info "sonar-report installed"

    # Download yq
    YQ_VERSION=$(curl -sI "https://github.com/mikefarah/yq/releases/latest" | grep -i "^location:" | sed "s|.*/||" | tr -d '\r' | tr -d '\n')
    YQ_VERSION=$(curl -sI "https://github.com/mikefarah/yq/releases/latest" | awk -F '/' -v RS='\r\n' '/^location: / {print $NF}')
    curl -sL -o ./yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64"
    chmod +x ./yq
    log_info "YQ installed"
@@ -860,7 +860,8 @@ variables:
  }

  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"