Skip to content

Commit

Permalink
ci: add the ability to use GCS backend for sccache (solana-labs#33967)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihau authored Nov 8, 2023
1 parent 29b2125 commit 5efba1f
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 @@ -51,16 +51,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
fi
Expand Down

0 comments on commit 5efba1f

Please sign in to comment.