Skip to content

Commit 1604353

Browse files
committed
build: gha: always use GHA cache for Linuxkit Cache in hopes of diminishing DockerHub pull-rate limits trouble
- previously, it only used GHA cache for builds running on GH-hosted runners - this now enables it for all builds, even on self-hosted runners - next few builds might still fail, but further ones will have a cache (we've `save-always: true`) and should eventually work Signed-off-by: Ricardo Pardini <[email protected]>
1 parent 45b3356 commit 1604353

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

.github/workflows/build-all-matrix.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ jobs:
151151

152152
- name: GitHub Actions Cache for 'cache' dir
153153
uses: actions/cache@v4
154-
if: ${{ matrix.gha_cache == 'yes' }} # only set to yes for GH-hosted runners; see gha-matrix bash impl
154+
if: ${{ matrix.gha_cache == 'yes' }} # effectively always yes: see gha_cache in bash/json-matrix.sh around line 84
155155
with:
156156
path: cache
157157
key: "lk-cache-${{ matrix.docker_arch }}-${{ matrix.kernel }}-${{ hashFiles('linuxkit-templates/*') }}-${{ hashFiles('bash/**/*.sh') }}"

bash/json-matrix.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ function prepare_json_matrix() {
8181
if json_matrix_tag_match "${kernel_info[TAG]}"; then
8282
declare runner="unknown-runner"
8383
runner="$(json_matrix_find_runner "${matrix_type}" "${kernel_info[DOCKER_ARCH]}")"
84-
declare gha_cache="no" # default to not using a GHA cache
85-
if [[ "${runner}" == "[\"ubuntu-latest\"]" ]]; then # enable cache if using a GH-hosted runner
86-
gha_cache="yes"
87-
fi
84+
declare gha_cache="yes" # always use GH cache; hitting DockerHub for linuxkit images is prone to rate limiting
8885

8986
all_arches["${kernel_info[DOCKER_ARCH]}"]=1
9087
json_items+=("{\"kernel\":\"${kernel}\",\"arch\":\"${kernel_info[ARCH]}\",\"docker_arch\":\"${kernel_info[DOCKER_ARCH]}\",\"runner\":${runner},\"gha_cache\":\"${gha_cache}\"}")

0 commit comments

Comments
 (0)