From 16f16876fda8527189464613509188d873bf5e7f Mon Sep 17 00:00:00 2001 From: Andrey Talman Date: Tue, 1 Sep 2026 16:29:23 -0400 Subject: [PATCH] [CI] Read the CRCR report token from a Buildkite secret (#54605) Signed-off-by: Andrey Talman --- .buildkite/scripts/crcr-report.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.buildkite/scripts/crcr-report.sh b/.buildkite/scripts/crcr-report.sh index 913d43654e..a7d74fbcda 100644 --- a/.buildkite/scripts/crcr-report.sh +++ b/.buildkite/scripts/crcr-report.sh @@ -37,9 +37,16 @@ fi # read_builds only. Needed because a job cannot see its siblings' outcomes: # the agent exposes only its own step, so the job list comes from the REST API. +TOKEN_SECRET_KEY="${CRCR_BUILDKITE_TOKEN_SECRET_KEY:-CRCR_BUILDKITE_API_TOKEN}" BK_TOKEN="${BUILDKITE_API_TOKEN:-}" +if [[ -z "${BK_TOKEN}" ]] && command -v buildkite-agent >/dev/null 2>&1; then + # Not in the job environment, so read it from a Buildkite secret. The agent + # redacts values fetched this way from the log. + BK_TOKEN="$(buildkite-agent secret get "${TOKEN_SECRET_KEY}" 2>/dev/null)" || BK_TOKEN="" +fi if [[ -z "${BK_TOKEN}" ]]; then - echo "BUILDKITE_API_TOKEN unset -- skipping report" + echo "no Buildkite API token (env BUILDKITE_API_TOKEN or secret" \ + "'${TOKEN_SECRET_KEY}') -- skipping report" exit 0 fi