Skip to content

Commit

Permalink
Fix Bazel cache trimming for rules_oci blobs. (#1371)
Browse files Browse the repository at this point in the history
rules_oci outputs additional layer blobs that result in the Bazel cache being too large. See bazel-contrib/rules_oci#439
  • Loading branch information
SanjayVas authored Dec 16, 2023
1 parent 4ce2224 commit 2aebc7a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ jobs:
with:
cache-version: 1

# This is a hack to utilize the undocumented relatively large empty
# scratch disk mounted at /mnt. It's currently needed to work around
# bazel-contrib/rules_oci#439 as that's what is pushing our usage over the
# limit. The alternative is to use a runner with more disk space.
- name: Mount scratch disk
env:
BAZEL_CACHE_PATH: ${{ steps.get-cache-params.outputs.cache-path }}
Expand Down Expand Up @@ -160,12 +164,15 @@ jobs:
name: cluster-logs
path: ${{ env.CLUSTER_LOGS_PATH }}

# Delete large files that are cheap to re-create.
# Delete large files that are relatively cheap to re-create.
- name: Trim Bazel cache
if: github.event_name == 'push'
run: |
bazel_out="$(bazelisk info output_path)"
find "${bazel_out}" -type f \( -iname '*.tar' -o -iname '*.tar.gz' \) -delete
find "${bazel_out}" -type d -name blobs -exec chmod -R +w "{}" \;
find "${bazel_out}" -type f -path '*/blobs/*' -delete
- name: Save Bazel cache
if: github.event_name == 'push'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/push-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/free-disk-space

- id: get-image-tag
name: Get image tag
run: |
Expand Down

0 comments on commit 2aebc7a

Please sign in to comment.