Commit 02a70960 authored by Cédric OLIVIER's avatar Cédric OLIVIER Committed by Pierre Smeyers
Browse files

fix(url): revert to wget method and fallback to netcat on error for busybox

parent e97441a5
Loading
Loading
Loading
Loading
+20 −13
Original line number Diff line number Diff line
@@ -290,9 +290,15 @@ stages:
      protocol=$(echo "$url" | cut -d':' -f1)
      if command -v busybox > /dev/null && [ "${protocol}" == "http" ]
      then
        output=$(mktemp)
        decoded=$(mktemp)
        errors=$(mktemp)
        if wget -T 5 -O "${decoded}" "$url" 2> "${errors}"
        then
          # shellcheck disable=SC2086
          export ${name}="$(cat ${decoded})"
          log_info "Successfully wget'd secret \\e[33;1m${name}\\e[0m"
        else
          output=$(mktemp)
          host_port=$(echo "$url" | cut -d'/' -f3)
          host=$(echo "$host_port" | cut -d':' -f1)
          port=$(echo "$host_port" | cut -d':' -s -f2)
@@ -309,6 +315,7 @@ stages:
          else
            log_warn "Failed getting secret \\e[33;1m${name}\\e[0m (${status_code} ${status_message}):\\n$(sed 's/^/... /g' "${decoded}")\\n... -----\\n$(sed 's/^/... /g' "${errors}")"
          fi
        fi
      elif command -v curl > /dev/null
      then
        decoded=$(mktemp)