Skip to content

Commit bcfd453

Browse files
committed
calculate-cache.sh: add some descriptions
Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
1 parent f9feb6e commit bcfd453

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

hack/calculate-cache.sh

+28
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,34 @@
66

77
# usage: [DEBUG=1] ./hack/calculate-cache.sh
88
# DEBUG=1 will save the collected information in .calculate-cache-collected-info-{before,after}.yaml
9+
#
10+
# This script does:
11+
# 1. extracts `runs_on` and `template` from workflow file (.github/workflows/test.yml)
12+
# 2. check each template for image and nerdctl
13+
# 3. detect size of image and nerdctl (responses from remote are cached for faster iteration)
14+
# 4. print content size, actual cache size (if available), by cache key
15+
#
16+
# The major differences for reducing cache usage are as follows:
17+
# - it is now cached `~/.cache/lima/download/by-url-sha256/$sha256` instead of caching `~/.cache/lima/download`
18+
# - the cache keys are now based on the image digest and nerdctl digest instead of the template file's hash
19+
# - enables the use of cache regardless of the operating system used to execute CI.
20+
#
21+
# The script requires the following commands:
22+
# - gh: GitHub CLI.
23+
# Using to get the cache information
24+
# - jq: Command-line JSON processor
25+
# Parse the workflow file and print runs-on and template.
26+
# Parse output from gh cache list
27+
# Calculate the expected content size, actual cached size, and cache-keys used.
28+
# - limactl: lima CLI.
29+
# Using to validate the template file for getting nerdctl location and digest.
30+
# - sha256sum: Print or check SHA256 (256-bit) checksums
31+
# - xxd: make a hexdump or do the reverse.
32+
# Using to simulate the 'hashFile()' function in the workflow.
33+
# - yq: Command-line YAML processor.
34+
# Parse the template file for image and nerdctl location, digest, and size.
35+
# Parse the cache response file for the cache.
36+
# Convert the collected information to JSON.
937

1038
set -u -o pipefail
1139

0 commit comments

Comments
 (0)