Files
devvm/testdata/script/bump.txtar
T
w3cjandClaude Opus 5.5 22387c5b78 fix(scripts): bump.sh --check never offers an older version as the latest
When upstream's latest is a version older than the pin (a release marker
that lags, as codex's and opencode's have), report() says the pin is newer
and neither counts it as outdated nor bumps it. Digests and dated releases
are compared as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 11:32:37 -07:00

197 lines
8.9 KiB
Plaintext

# scripts/bump.sh, on a scratch copy of the files it edits, with upstream
# answered by a curl that reads $WORK/up/ (repo.sh).
[!exec:jq] skip
env PATH=$WORK/bin:$PATH
chmod 755 bin/curl
exec bash repo.sh
# crane's version and checksums are written as they are.
exec repo/scripts/bump.sh crane
stdout '^ crane +0\.22\.1 +-> 9\.9\.9$'
stdout '^- crane: 0\.22\.1 -> 9\.9\.9$'
exec grep '^crane_' repo/assets/oci/build.sh
cmp stdout crane.want
# mise moves base's mise and devvm's host mise together.
exec repo/scripts/bump.sh mise
exec grep '^mise_' repo/assets/layers/base.sh
cmp stdout mise-base.want
exec grep -E 'miseVersion =|"(macos|linux)-' repo/internal/tools/mise.go
cmp stdout mise-go.want
# e2e-ubuntu moves the cloud image release e2e pins to the newest Ubuntu
# lists; with none listed, nothing is edited.
exec repo/scripts/bump.sh e2e-ubuntu
stdout '^ e2e-ubuntu +release-[0-9]{8} +-> release-29990101$'
exec grep '^const e2eUbuntuRelease = ' repo/tests/e2e/sandbox_test.go
stdout '^const e2eUbuntuRelease = "release-29990101"$'
exec bash repo.sh
cp repo/tests/e2e/sandbox_test.go e2e.before
cp cloud-listing-none up/cloud-listing
! exec repo/scripts/bump.sh e2e-ubuntu
stderr '^bump: upstream gave e2e_ubuntu_release an unexpected value: '''''
cmp repo/tests/e2e/sandbox_test.go e2e.before
# e2e-lima moves CI's Lima to the newest release and its Linux x86_64
# tarball's checksum, from a SHA256SUMS that matches the release notes'
# sha256; one that doesn't is refused, and nothing is edited.
exec repo/scripts/bump.sh e2e-lima
stdout '^ e2e-lima +[0-9.]+ +-> 9\.8\.7$'
exec grep -E '^ LIMA_(VERSION|SHA256):' repo/.github/workflows/e2e.yml
cmp stdout lima.want
exec bash repo.sh
cp repo/.github/workflows/e2e.yml e2e.yml.before
cp lima-sums-tampered up/lima-sums
! exec repo/scripts/bump.sh e2e-lima
stderr '^bump: Lima 9\.8\.7''s SHA256SUMS doesn''t match its release notes'' sha256$'
cmp repo/.github/workflows/e2e.yml e2e.yml.before
# Upstream values that aren't a version or a checksum are refused, and
# nothing is edited: a command for a checksum, one in a version, and a
# missing asset (an empty checksum).
exec bash repo.sh
cp repo/assets/oci/build.sh before
cp sums-hostile up/crane-sums
! exec repo/scripts/bump.sh crane
stderr '^bump: upstream gave crane_sha256_arm64 an unexpected value: '
cmp repo/assets/oci/build.sh before
cp sums-good up/crane-sums
cp latest-hostile up/crane-latest
! exec repo/scripts/bump.sh crane
stderr '^bump: upstream gave crane_version an unexpected value: '
cmp repo/assets/oci/build.sh before
cp latest-good up/crane-latest
cp sums-missing up/crane-sums
! exec repo/scripts/bump.sh crane
stderr '^bump: upstream gave crane_sha256_arm64 an unexpected value: '''''
cmp repo/assets/oci/build.sh before
! exists pwned
# The same for the host mise's pins, in Go.
cp repo/internal/tools/mise.go mise.go.before
cp mise-sums-hostile up/mise-sums
! exec repo/scripts/bump.sh mise
stderr '^bump: upstream gave mise_sha256 an unexpected value: '
cmp repo/internal/tools/mise.go mise.go.before
! exists pwned
# --check prints upstream's version without control characters.
cp latest-escape up/crane-latest
exec repo/scripts/bump.sh --check crane
stdout ' -> 9\.9\.9\[2J$'
! stdout '\x1b'
cmp repo/assets/oci/build.sh before
# An upstream latest older than the pin is never offered: the pin is
# reported as newer, and nothing is edited.
cp latest-older up/crane-latest
exec repo/scripts/bump.sh crane
stdout '^ crane +0\.22\.1 +newer than upstream''s latest, 0\.1\.0$'
! stdout ' -> '
cmp repo/assets/oci/build.sh before
# An unknown tool: refused.
! exec repo/scripts/bump.sh nope
stderr '^bump: unknown tool ''nope'''
-- repo.sh --
# A copy of the files bump.sh edits, and upstream's good answers.
set -eu
rm -rf repo up
mkdir -p repo/scripts repo/assets/oci repo/assets/layers repo/internal/tools repo/tests/e2e repo/.github/workflows up
cp "$DEVVM_REPO/scripts/bump.sh" repo/scripts/
cp "$DEVVM_REPO/.github/workflows/e2e.yml" repo/.github/workflows/
cp lima-latest up/lima-latest
cp lima-sums up/lima-sums
cp "$DEVVM_REPO/assets/oci/build.sh" repo/assets/oci/
cp "$DEVVM_REPO/assets/layers/base.sh" repo/assets/layers/
cp "$DEVVM_REPO/internal/tools/mise.go" repo/internal/tools/
cp "$DEVVM_REPO/tests/e2e/sandbox_test.go" repo/tests/e2e/
cp latest-good up/crane-latest
cp sums-good up/crane-sums
cp mise-latest up/mise-latest
cp mise-sums up/mise-sums
cp cloud-listing up/cloud-listing
-- bin/curl --
#!/bin/bash
# Answers crane's, mise's and Lima's releases and Ubuntu's list of cloud
# image releases from $WORK/up/, to stdout or -o's file; anything else fails.
out=/dev/stdout
for a in "$@"; do [[ ${o:-} == next ]] && { out=$a; o=; }; [[ $a == -o ]] && o=next; done
exec >"$out"
for a in "$@"; do case $a in
*/lima-vm/lima/releases/latest) cat "$WORK/up/lima-latest"; exit ;;
*/lima-vm/lima/*/SHA256SUMS) cat "$WORK/up/lima-sums"; exit ;;
*/go-containerregistry/releases/latest) cat "$WORK/up/crane-latest"; exit ;;
*/go-containerregistry/*/checksums.txt) cat "$WORK/up/crane-sums"; exit ;;
*/jdx/mise/releases/latest) cat "$WORK/up/mise-latest"; exit ;;
*/jdx/mise/*/SHASUMS256.txt) cat "$WORK/up/mise-sums"; exit ;;
https://cloud-images.ubuntu.com/releases/resolute/) cat "$WORK/up/cloud-listing"; exit ;;
esac; done
exit 22
-- lima-latest --
{"tag_name":"v9.8.7","body":"The sha256sum of the SHA256SUMS file itself is `58af05498b64199f1e9de8d1bc11ea71e397df7c0ece4f313dd7c4e44b9497b1` ."}
-- lima-sums --
7777777777777777777777777777777777777777777777777777777777777777 lima-9.8.7-Linux-aarch64.tar.gz
8888888888888888888888888888888888888888888888888888888888888888 lima-9.8.7-Linux-x86_64.tar.gz
-- lima-sums-tampered --
7777777777777777777777777777777777777777777777777777777777777777 lima-9.8.7-Linux-aarch64.tar.gz
9999999999999999999999999999999999999999999999999999999999999999 lima-9.8.7-Linux-x86_64.tar.gz
-- lima.want --
LIMA_VERSION: 9.8.7
LIMA_SHA256: 8888888888888888888888888888888888888888888888888888888888888888
-- cloud-listing --
<a href="release-19991231/">release-19991231/</a>
<a href="release-20000101/">release-20000101/</a> <a href="release-29990101/">release-29990101/</a>
<a href="current/">current/</a>
-- cloud-listing-none --
<a href="current/">current/</a>
-- latest-good --
{"tag_name":"v9.9.9"}
-- latest-hostile --
{"tag_name":"v1$(id)"}
-- latest-older --
{"tag_name":"v0.1.0"}
-- latest-escape --
{"tag_name":"v9.9.9\u001b[2J"}
-- sums-good --
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa go-containerregistry_Linux_arm64.tar.gz
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb go-containerregistry_Linux_x86_64.tar.gz
-- sums-hostile --
$(touch${IFS}pwned) go-containerregistry_Linux_arm64.tar.gz
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb go-containerregistry_Linux_x86_64.tar.gz
-- sums-missing --
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb go-containerregistry_Linux_x86_64.tar.gz
-- crane.want --
crane_version=9.9.9
crane_sha256_arm64=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
crane_sha256_amd64=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-- mise-latest --
{"tag_name":"v2099.1.1"}
-- mise-sums --
1111111111111111111111111111111111111111111111111111111111111111 mise-v2099.1.1-linux-arm64
2222222222222222222222222222222222222222222222222222222222222222 mise-v2099.1.1-linux-x64
3333333333333333333333333333333333333333333333333333333333333333 mise-v2099.1.1-linux-arm64-musl
4444444444444444444444444444444444444444444444444444444444444444 mise-v2099.1.1-linux-x64-musl
5555555555555555555555555555555555555555555555555555555555555555 mise-v2099.1.1-macos-arm64
6666666666666666666666666666666666666666666666666666666666666666 mise-v2099.1.1-macos-x64
-- mise-sums-hostile --
1111111111111111111111111111111111111111111111111111111111111111 mise-v2099.1.1-linux-arm64
2222222222222222222222222222222222222222222222222222222222222222 mise-v2099.1.1-linux-x64
3333333333333333333333333333333333333333333333333333333333333333 mise-v2099.1.1-linux-arm64-musl
4444444444444444444444444444444444444444444444444444444444444444 mise-v2099.1.1-linux-x64-musl
"+touch${IFS}pwned+" mise-v2099.1.1-macos-arm64
6666666666666666666666666666666666666666666666666666666666666666 mise-v2099.1.1-macos-x64
-- mise-base.want --
mise_version=2099.1.1
mise_sha256_arm64=1111111111111111111111111111111111111111111111111111111111111111
mise_sha256_amd64=2222222222222222222222222222222222222222222222222222222222222222
mise_sha256_arm64_musl=3333333333333333333333333333333333333333333333333333333333333333
mise_sha256_amd64_musl=4444444444444444444444444444444444444444444444444444444444444444
-- mise-go.want --
const miseVersion = "2099.1.1"
"macos-arm64": "5555555555555555555555555555555555555555555555555555555555555555",
"macos-x64": "6666666666666666666666666666666666666666666666666666666666666666",
"linux-arm64": "1111111111111111111111111111111111111111111111111111111111111111",
"linux-x64": "2222222222222222222222222222222222222222222222222222222222222222",