Skip to content

Commit 2dbc3fa

Browse files
authored
ci(health-check): rewire cache to match docker-new restructure (#7032)
* ci(health-check): rewire cache to match docker-new restructure - Switch buildcache-new tag to its own scope `health-check-<build-type>-humble-<platform>-<ref>` (instead of the ci-universe tags that no longer populate), with current-ref + main fallback reads and a current-ref write, mirroring docker-build-new.yaml's pattern. - Add read-only `buildkit-cache-dance` injection fed by the `buildkit-mounts-ci-universe-humble-<platform>-*` tarballs the main pipeline saves, so health-check reuses the same apt / ccache / pip / pipx mount state without writing back. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org> * docs(health-check): shorten cache-restore comment Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
1 parent 6969ed2 commit 2dbc3fa

1 file changed

Lines changed: 51 additions & 2 deletions

File tree

.github/workflows/health-check-reusable.yaml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ jobs:
2929
- name: 📥 Check out repository
3030
uses: actions/checkout@v6
3131

32+
- name: 🏷️ Compute cache ref
33+
id: meta
34+
run: echo "ref_name=${GITHUB_REF_NAME//\//-}" >> "$GITHUB_OUTPUT"
35+
3236
- name: 💻 Runner specs
3337
run: |
3438
echo "::group::CPU"
@@ -72,6 +76,50 @@ jobs:
7276
[worker.oci]
7377
max-parallelism = 2
7478
79+
# Read-only: reuses the mount cache saved by docker-new's `ci-universe` group.
80+
- name: 💾 Restore BuildKit cache mounts (read-only)
81+
id: cache-restore
82+
uses: actions/cache/restore@v5
83+
with:
84+
path: cache-mounts
85+
key: buildkit-mounts-ci-universe-humble-${{ matrix.platform }}-${{ github.sha }}
86+
restore-keys: |
87+
buildkit-mounts-ci-universe-humble-${{ matrix.platform }}-
88+
89+
- name: 💉 Inject BuildKit cache mounts
90+
uses: reproducible-containers/buildkit-cache-dance@v3
91+
with:
92+
cache-map: |
93+
{
94+
"cache-mounts/apt-cache": {
95+
"id": "apt-cache-humble",
96+
"target": "/var/cache/apt"
97+
},
98+
"cache-mounts/apt-lists": {
99+
"id": "apt-lists-humble",
100+
"target": "/var/lib/apt/lists"
101+
},
102+
"cache-mounts/ccache": {
103+
"id": "ccache-humble",
104+
"target": "/home/aw/.ccache",
105+
"uid": "1000",
106+
"gid": "1000"
107+
},
108+
"cache-mounts/pip": {
109+
"id": "pip-cache",
110+
"target": "/home/aw/.cache/pip",
111+
"uid": "1000",
112+
"gid": "1000"
113+
},
114+
"cache-mounts/pipx": {
115+
"id": "pipx-cache",
116+
"target": "/home/aw/.cache/pipx",
117+
"uid": "1000",
118+
"gid": "1000"
119+
}
120+
}
121+
skip-extraction: ${{ steps.cache-restore.outputs.cache-hit }}
122+
75123
- name: 🔑 Login to GitHub Container Registry
76124
uses: docker/login-action@v4
77125
with:
@@ -89,8 +137,9 @@ jobs:
89137
files: docker-new/docker-bake.hcl
90138
provenance: false
91139
set: |
92-
*.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache-new:humble-${{ matrix.platform }}-main
93-
*.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache-new:${{ matrix.build-type }}-humble-${{ matrix.platform }}-main
140+
*.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache-new:health-check-${{ matrix.build-type }}-humble-${{ matrix.platform }}-${{ steps.meta.outputs.ref_name }}
141+
*.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache-new:health-check-${{ matrix.build-type }}-humble-${{ matrix.platform }}-main
142+
*.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache-new:health-check-${{ matrix.build-type }}-humble-${{ matrix.platform }}-${{ steps.meta.outputs.ref_name }},mode=max,ignore-error=true
94143
95144
- name: 📊 Disk space
96145
if: always()

0 commit comments

Comments
 (0)