Skip to content

Commit

Permalink
show cache miss diff
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <[email protected]>
  • Loading branch information
wagoodman committed Sep 6, 2024
1 parent acf82dc commit a7d6435
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ vars:
TMP_DIR: .tmp
ORAS_CACHE: "{{ .TMP_DIR }}/oras-cache"
CACHE_PATHS_FILE: "{{ .TMP_DIR }}/cache_paths.json"
LAST_CACHE_PULL_FILE: "{{ .TMP_DIR }}/last_cache_pull"
LAST_CACHE_PULL_FILE: "{{ .TMP_DIR }}/last_cache_paths.json"

# TOOLS
ORAS: "{{ .TOOL_DIR }}/oras"
Expand Down Expand Up @@ -335,7 +335,7 @@ tasks:
echo "desired cache: $WANT_FINGERPRINT"
if [ -f {{ .LAST_CACHE_PULL_FILE }} ]; then
LAST_PULL_FINGERPRINT=$(cat {{ .LAST_CACHE_PULL_FILE }})
LAST_PULL_FINGERPRINT=$(cat {{ .LAST_CACHE_PULL_FILE }} | {{ .YQ }} -r '.digest')
else
echo -e "${BOLD}${PURPLE}empty cache, refreshing cache...${RESET}"
{{ .TASK }} clean-cache download-test-fixture-cache
Expand All @@ -360,6 +360,13 @@ tasks:
{{ .TASK }} clean-cache download-test-fixture-cache
else
echo -e "${BOLD}${PURPLE}found newer cache, but does not match what we want (skipping cache refresh)${RESET}"
git status
{{ .YQ }} eval '.paths[] | "\(.digest) \(.path)"' {{ .LAST_CACHE_PULL_FILE }} > .tmp/last_cache_lines
{{ .YQ }} eval '.paths[] | "\(.digest) \(.path)"' {{ .CACHE_PATHS_FILE }} > .tmp/cache_lines
diff .tmp/last_cache_lines .tmp/cache_lines
fi
build-fixtures:
Expand Down Expand Up @@ -389,7 +396,7 @@ tasks:
sh: docker manifest inspect {{ .CACHE_IMAGE }} | jq -r '.annotations.fingerprint'
cmds:
- "ORAS_CACHE={{ .ORAS_CACHE }} {{ .ORAS }} pull {{ .CACHE_IMAGE }}"
- "echo '{{ .CACHE_DIGEST }}' > {{ .LAST_CACHE_PULL_FILE }}"
- "cp {{ .CACHE_PATHS_FILE }} {{ .LAST_CACHE_PULL_FILE }}"

upload-test-fixture-cache:
desc: Upload the test fixture cache to ghcr.io
Expand Down

0 comments on commit a7d6435

Please sign in to comment.