From 6cebf1a5a6f4f1c70c893fc9d9eecc5e96dddde9 Mon Sep 17 00:00:00 2001 From: Nicholas Andrew Date: Sun, 11 Oct 2026 00:52:02 -0400 Subject: [PATCH] Jenkinsfile: tolerate unregistered parameters on a job's first run A new job's first run has no PORTAL_REQUEST_ID/PORTAL_USER/CHANGELOG yet, which tripped set -u in Preflight. Default them to empty everywhere. Co-Authored-By: Claude Opus 5.5 --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a519e53..e2da9d8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -134,7 +134,7 @@ pipeline { set -Eeuo pipefail [[ "$DEVICE" =~ ^[A-Za-z0-9_]+$ ]] || { echo "ERROR: bad DEVICE '$DEVICE'"; exit 1; } - [[ -z "$PORTAL_REQUEST_ID" || "$PORTAL_REQUEST_ID" =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ ]] \ + [[ -z "${PORTAL_REQUEST_ID:-}" || "${PORTAL_REQUEST_ID:-}" =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ ]] \ || { echo "ERROR: bad PORTAL_REQUEST_ID"; exit 1; } if [ -z "$TEST_JOB" ] && [ "$MANIFEST_REF" != "$MANIFEST_BRANCH" ]; then echo "ERROR: MANIFEST_REF is only allowed on cms- test jobs" @@ -838,7 +838,7 @@ PYEOF --arg tree_commit "$TREE_COMMIT" \ --arg tree_subject "$TREE_SUBJECT" \ --arg operator_changelog "${CHANGELOG:-$CHANGELOG_DEFAULT}" \ - --arg portal_request_id "$PORTAL_REQUEST_ID" \ + --arg portal_request_id "${PORTAL_REQUEST_ID:-}" \ '{ project: $project, project_name: $project_name, @@ -897,7 +897,7 @@ PYEOF exit 1 fi - if [ -n "$PORTAL_REQUEST_ID" ] && ! jq -e '.started_by' "$RESPONSE_FILE" >/dev/null 2>&1; then + if [ -n "${PORTAL_REQUEST_ID:-}" ] && ! jq -e '.started_by' "$RESPONSE_FILE" >/dev/null 2>&1; then echo "WARNING: portal did not attribute this build: $(jq -r '.attribution_warning // empty' "$RESPONSE_FILE")" fi