diff options
| author | Your Name <you@example.com> | 2026-04-26 21:02:47 +0800 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-04-26 21:02:47 +0800 |
| commit | d3e770254de0bb301815ca87257c8b1a357d06c4 (patch) | |
| tree | 358c814be2a06b9e2009905f14938243286b8d82 /scripts/resolve-digests.sh | |
Diffstat (limited to 'scripts/resolve-digests.sh')
| -rwxr-xr-x | scripts/resolve-digests.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/resolve-digests.sh b/scripts/resolve-digests.sh new file mode 100755 index 0000000..526d463 --- /dev/null +++ b/scripts/resolve-digests.sh | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | # Resolve an image tag to a content-addressable digest for pinning. | ||
| 3 | # | ||
| 4 | # Usage: | ||
| 5 | # scripts/resolve-digests.sh public.ecr.aws/q9t5s3a7/vllm-cpu-release-repo:latest | ||
| 6 | # scripts/resolve-digests.sh # default image | ||
| 7 | # | ||
| 8 | # Prints three lines: | ||
| 9 | # repo: public.ecr.aws/q9t5s3a7/vllm-cpu-release-repo | ||
| 10 | # digest: sha256:abc123... | ||
| 11 | # pin: public.ecr.aws/q9t5s3a7/vllm-cpu-release-repo@sha256:abc123... | ||
| 12 | # | ||
| 13 | # Paste the digest into the env's terraform (var.image_digest) to pin. | ||
| 14 | set -euo pipefail | ||
| 15 | |||
| 16 | IMG="${1:-public.ecr.aws/q9t5s3a7/vllm-cpu-release-repo:latest}" | ||
| 17 | |||
| 18 | engine="" | ||
| 19 | if command -v podman >/dev/null 2>&1; then engine=podman | ||
| 20 | elif command -v docker >/dev/null 2>&1; then engine=docker | ||
| 21 | else | ||
| 22 | echo "need podman or docker on PATH" >&2; exit 1 | ||
| 23 | fi | ||
| 24 | |||
| 25 | "$engine" pull --quiet "$IMG" >/dev/null | ||
| 26 | digest="$("$engine" image inspect "$IMG" --format '{{.Digest}}')" | ||
| 27 | repo="${IMG%:*}" | ||
| 28 | |||
| 29 | printf 'repo: %s\n' "$repo" | ||
| 30 | printf 'digest: %s\n' "$digest" | ||
| 31 | printf 'pin: %s@%s\n' "$repo" "$digest" | ||
