Skip to content

Commit

Permalink
v1.17: ci: add the ability to use GCS backend for sccache (backport of
Browse files Browse the repository at this point in the history
…#33967) (#33984)

ci: add the ability to use GCS backend for sccache (#33967)

(cherry picked from commit 5efba1f)

Co-authored-by: Yihau Chen <a122092487@gmail.com>
  • Loading branch information
mergify[bot] and yihau authored Nov 11, 2023
1 parent 7089f1e commit 99e8310
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
8 changes: 7 additions & 1 deletion .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,11 @@ fi

export SBF_TOOLS_VERSION

SCCACHE_S3_KEY_PREFIX="${rust_stable}_${rust_nightly}_${SBF_TOOLS_VERSION}"
SCCACHE_KEY_PREFIX="${rust_stable}_${rust_nightly}_${SBF_TOOLS_VERSION}"
export SCCACHE_KEY_PREFIX

SCCACHE_S3_KEY_PREFIX="$SCCACHE_KEY_PREFIX"
export SCCACHE_S3_KEY_PREFIX

SCCACHE_GCS_KEY_PREFIX="$SCCACHE_KEY_PREFIX"
export SCCACHE_GCS_KEY_PREFIX
30 changes: 24 additions & 6 deletions ci/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,34 @@ if [[ -n $CI ]]; then
# sccache-related bugs
echo "--- $0 ... (with sccache being DISABLED due to many (${BUILDKITE_RETRY_COUNT}) retries)"
else
echo "--- $0 ... (with sccache enabled with prefix: $SCCACHE_S3_KEY_PREFIX)"
echo "--- $0 ... (with sccache enabled with prefix: $SCCACHE_KEY_PREFIX)"

# sccache
ARGS+=(
--env "RUSTC_WRAPPER=/usr/local/cargo/bin/sccache"
--env AWS_ACCESS_KEY_ID
--env AWS_SECRET_ACCESS_KEY
--env SCCACHE_BUCKET
--env SCCACHE_REGION
--env SCCACHE_S3_KEY_PREFIX
)

# s3
if [ -n "$AWS_ACCESS_KEY_ID" ]; then
ARGS+=(
--env AWS_ACCESS_KEY_ID
--env AWS_SECRET_ACCESS_KEY
--env SCCACHE_BUCKET
--env SCCACHE_REGION
--env SCCACHE_S3_KEY_PREFIX
)
fi

# gcs
if [ -n "$SCCACHE_GCS_KEY_PATH" ]; then
ARGS+=(
--env SCCACHE_GCS_KEY_PATH
--volume "$SCCACHE_GCS_KEY_PATH:$SCCACHE_GCS_KEY_PATH"
--env SCCACHE_GCS_BUCKET
--env SCCACHE_GCS_RW_MODE
--env SCCACHE_GCS_KEY_PREFIX
)
fi
fi
fi
else
Expand Down

0 comments on commit 99e8310

Please sign in to comment.