Skip to content

Commit

Permalink
feat(gha): cache ko images
Browse files Browse the repository at this point in the history
This prevents us from seeing outages where the image cannot be
downloaded
  • Loading branch information
fredrikaverpil committed Feb 6, 2025
1 parent dece8cb commit 1f194e6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ runs:
with:
go-version: ${{ inputs.go-version }}
check-latest: ${{ inputs.check-latest }}
cache: false # cache is handled by separate actions/cache step, see https://github.com/actions/setup-go/issues/358
cache: false # cache is handled by separate actions/cache step, see https://github.com/actions/setup-go/issues/358

- name: Set KOCACHE environment variable
shell: bash
run: echo "KOCACHE=/home/runner/.ko/cache" >> $GITHUB_ENV

# NOTE: cache key and restore key is not the same;
# We want to always re-use the cache created by master in all our PRs. We also want any PR which modifies go.sum to create a new cache for itself.
Expand All @@ -63,6 +67,7 @@ runs:
/home/runner/.cache/go-build
/home/runner/go/pkg/mod
/home/runner/go/bin
/home/runner/.ko/cache
key: ${{ runner.os }}-${{ github.ref_name }}-${{ github.workflow }}-${{ github.job }}-${{ inputs.cacheKey }}-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ github.base_ref }}-${{ github.workflow }}-${{ github.job }}-${{ inputs.cacheKey }}-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}

0 comments on commit 1f194e6

Please sign in to comment.