-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): re-use cache key from build workflow (#11299)
This makes build cache key generation reusable across different workflows. The test and release workflows now use the same "recipe" for cache key generation--no more copy/paste.
- Loading branch information
Showing
5 changed files
with
88 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Build Cache Key | ||
|
||
description: > | ||
Generates a cache key suitable for save/restore of Kong builds. | ||
inputs: | ||
prefix: | ||
description: 'String prefix applied to the build cache key' | ||
required: false | ||
default: 'build' | ||
|
||
outputs: | ||
cache-key: | ||
description: 'The generated cache key' | ||
value: ${{ steps.cache-key.outputs.CACHE_KEY }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Generate cache key | ||
id: cache-key | ||
shell: bash | ||
run: | | ||
# please keep these sorted | ||
FILE_HASHES=( | ||
${{ hashFiles('.bazelignore') }} | ||
${{ hashFiles('.bazelrc') }} | ||
${{ hashFiles('.bazelversion') }} | ||
${{ hashFiles('.github/actions/build-cache-key/**') }} | ||
${{ hashFiles('.github/workflows/build.yml') }} | ||
${{ hashFiles('.requirements') }} | ||
${{ hashFiles('BUILD.bazel') }} | ||
${{ hashFiles('WORKSPACE') }} | ||
${{ hashFiles('bin/kong') }} | ||
${{ hashFiles('bin/kong-health') }} | ||
${{ hashFiles('build/**') }} | ||
${{ hashFiles('kong-*.rockspec') }} | ||
${{ hashFiles('kong.conf.default') }} | ||
${{ hashFiles('kong/**') }} | ||
) | ||
HASH=$(sha256sum - <<< "${FILE_HASHES[*]}" | awk '{print $1}' ) | ||
CACHE_KEY=${{ inputs.prefix }}::${HASH} | ||
echo "cache-key: ${CACHE_KEY}" | ||
echo "CACHE_KEY=${CACHE_KEY}" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68b7b6f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bazel Build
Docker image available
kong/kong:68b7b6f9cb9eb52af0ed558b2952a3239926b5b7
Artifacts available https://github.com/Kong/kong/actions/runs/5684056729