From 34bdf14882701426e2d3e43c638d71ef6f079730 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Thu, 11 Dec 2025 11:36:56 +0100 Subject: [PATCH] scrips: add auth for sccache on protected branches --- scripts/ci/sccache-start.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/ci/sccache-start.sh b/scripts/ci/sccache-start.sh index 103dba7769c4..8a27d2252483 100755 --- a/scripts/ci/sccache-start.sh +++ b/scripts/ci/sccache-start.sh @@ -34,3 +34,17 @@ if [ "${attempts}" = 0 ]; then echo "Could not start sccache after ${max_attempts}, running without sccache." export RUSTC_WRAPPER="" fi + +# get access to GCS backend to store the cache on protected branches +if [ "$CI_COMMIT_REF_PROTECTED" = "true" ]; then + echo "### Logging into protected repo ..." + echo "${GCP_PROTECTED_SERVICE_ACCOUNT}" | base64 -d > protected_sa.json + gcloud auth activate-service-account --key-file=protected_sa.json + + # + GOOGLE_OAUTH_ACCESS_TOKEN=$(gcloud auth print-access-token) + export GOOGLE_OAUTH_ACCESS_TOKEN +else + echo "### Logging into standard repo ..." + # Nothing to do +fi -- GitLab