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 <wagoodman@users.noreply.github.com>
  • Loading branch information
wagoodman committed Sep 6, 2024
1 parent acf82dc commit 78a9d79
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 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,11 @@ 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}"
{{ .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 +394,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 78a9d79

Please sign in to comment.