Commit 43bf1592 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

fix: shell scripting errors (not supported by Alpine Ash)

- unescaped parentheses in regex
- unescaped pipe in regex
- unsupported Here String
- var testing fixed
parent cb7cae5e
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ stages:
  set -eo pipefail

  function log_debug() {
    if [[ -n ${TRACE+x} ]]; then 
    if [[ "$TRACE" ]]; then 
      >&2 echo -e "[\\e[1;95mDEBUG\\e[0m] $*"
    fi
  }
@@ -595,7 +595,7 @@ stages:
    # Basic HEAD/GET probe (handles plain endpoint or index.json)
    local code
    code=$(curl -fsS -o /dev/null --connect-timeout 5 -m 11 --retry 2 -w "%{http_code}" "$url" || echo "000")
    if [[ "$code" =~ ^2|3[0-9][0-9]$ ]]; then
    if [[ "$code" =~ ^[2-3][0-9][0-9]$ ]]; then
      log_debug "... source ${name} reachable (HTTP ${code})"
    else
      log_error "... source ${name} unreachable (HTTP ${code})"
@@ -749,7 +749,7 @@ stages:
    local path="${1}"
    local lower_path
    lower_path=$(echo "$path" | tr '[:upper:]' '[:lower:]')
    if [[ -f "${CI_PROJECT_DIR}/${path}" ]] && [[ "${lower_path}" =~ .*\.(sln) ]]; then
    if [[ -f "${CI_PROJECT_DIR}/${path}" ]] && [[ "${lower_path}" =~ .*\.sln ]]; then
      return 0
    else
      return 1
@@ -1810,12 +1810,12 @@ stages:
        note_ids=$(echo "${existing_notes}" | jq -r --arg first_line "${first_line}" '.[] | select(.body | startswith($first_line)) | .id')
        
        if [[ -n "${note_ids}" ]]; then
          while IFS= read -r note_id; do
          echo "${note_ids}" | while IFS= read -r note_id; do
            if [[ -n "${note_id}" ]]; then
              log_info "Deleting existing comment ${note_id}..."
              glab api -X DELETE "projects/${CI_PROJECT_ID}/merge_requests/${CI_MERGE_REQUEST_IID}/notes/${note_id}" 2>/dev/null || true
            fi
          done <<< "${note_ids}"
          done
        fi
      fi