Migrating sccache from Local Storage to GCP Cloud Storage
This MR transitions the Tezos CI infrastructure from using local filesystem-based sccache storage to Google Cloud Storage (GCS) for distributed compilation caching. This change enables shared caching across CI runners, significantly improving build performance and reducing redundant compilation work.
Before reviewing this MR the you can familiarize yourself with
- the sccache documentation about GCS: https://github.com/mozilla/sccache/blob/main/docs/Gcs.md
- the sccache github : https://github.com/mozilla/sccache
- the gcloud cli : https://cloud.google.com/sdk/docs/install
- how we handle authorization on the GCP buckets : https://cloud.google.com/storage/docs/authentication
Also the reviewer should have a clear understanding on the rust-* docker images and where / how are used.
Key Changes in the MR:
1. CI Pipeline Configuration Updates (40+ files changed):
-
Removed local sccache cache configuration: All GitLab CI pipeline files have been updated to remove the local filesystem cache entries:
# REMOVED: - key: sccache-$CI_JOB_NAME_SLUG paths: - $CI_PROJECT_DIR/_sccache policy: pull-push -
Added GCS configuration: Replaced with GCS bucket configuration using environment variables:
SCCACHE_GCS_BUCKET: $GCP_LINUX_PACKAGES_BUCKET SCCACHE_GCS_RW_MODE: READ_WRITE SCCACHE_GCS_KEY_PREFIX: sccache SCCACHE_IGNORE_SERVER_IO_ERROR: "1"
Benefits of This Change:
- Shared Cache: Multiple CI runners can now share the same compilation cache stored in GCS
- Persistent Cache: Cache persists beyond individual runner lifecycles
Configuration Details:
- Uses
$GCP_LINUX_PACKAGES_BUCKETas the centralized storage location - Implements cache busting with
$CI_JOB_NAME_SLUGto prevent cache pollution - Includes
SCCACHE_IGNORE_SERVER_IO_ERRORfor resilience against transient network issues - The precise path of the cache is
tezos-linux-repo/sccache. You can have a look at it on the GCP UI.
Testing
Check these lines in the logs:
$ . ./scripts/ci/sccache-start.sh
sccache: Starting the server...
$ sccache --show-stats | grep "Cache location"
Cache location gcs, name: tezos-linux-repo, prefix: /sccache/
there is a some variability considering the same job and different hit rates for the sccache.
- https://gitlab.com/tezos/tezos/-/jobs/12075550414 : 7 minutes 58 seconds / hit rate 27%
- https://gitlab.com/tezos/tezos/-/jobs/12077593340 : 6 minutes 44 seconds / hit rate 100%
- https://gitlab.com/tezos/tezos/-/jobs/12076575544 : 9 minutes 1 second / hit rate 100%