LEAS-2795 minio: smoke with volume continuity and SOURCE template
release / release (push) Successful in 4m43s

This commit is contained in:
Pavlo Ratushnyi
2026-11-14 13:51:34 +01:00
parent 8e7ac6a659
commit f97c828500
2 changed files with 211 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
This image ships MinIO, licensed under the GNU Affero General Public License v3 (AGPL-3.0), unmodified.
It also ships mc (the MinIO Client, AGPL-3.0, unmodified) at /usr/bin/mc; its licence files and source offer are under /licenses/mc/.
Upstream project: https://github.com/minio/minio
Upstream release: @UPSTREAM_RELEASE@
Upstream commit: @UPSTREAM_COMMIT@
Corresponding source at that commit, tagged in this repository:
https://git.vezha.io/para/minio/src/tag/@UPSTREAM_RELEASE@
Source archive of that tag:
https://git.vezha.io/para/minio/archive/@UPSTREAM_RELEASE@.tar.gz
Build recipe repository: https://git.vezha.io/para/minio
Build recipe commit: @RECIPE_COMMIT@
Build recipe at that commit:
https://git.vezha.io/para/minio/src/commit/@RECIPE_COMMIT@
Go builder image: @GO_BUILDER@
Go module: @MODULE@ @MODULE_VERSION@
Go module sum: @MODULE_SUM@
Binary sha256 of /usr/bin/minio: @BINARY_SHA256@
mc image copied into this image: @MC_IMAGE@
The CA bundle /etc/ssl/certs/ca-certificates.crt is copied unmodified from the Go builder image (Debian ca-certificates; source: https://tracker.debian.org/pkg/ca-certificates).
+187
View File
@@ -0,0 +1,187 @@
#!/bin/sh
set -eu
mode=${1:?usage: smoke.sh smoke <server image> <client image> | smoke.sh continuity <old server image> <new server image> <client image>}
shift
run=${GITHUB_RUN_ID:-local}
suffix=$$
LABEL="io.vezha.smoke=$run"
NET="vezha-smoke-$run-$suffix"
VOL="vezha-smoke-$run-$suffix-data"
SRV="vezha-smoke-$run-$suffix-srv"
GATES=$(dirname "$0")/gates.sh
T=$(mktemp -d)
fail() {
printf 'REFUSED smoke: %s\n' "$1" >&2
exit 1
}
cleanup() {
docker rm -f "$SRV" > /dev/null 2>&1 || true
docker network rm "$NET" > /dev/null 2>&1 || true
docker volume rm "$VOL" > /dev/null 2>&1 || true
rm -rf "$T"
}
trap cleanup EXIT
rand() {
head -c 16 /dev/urandom | od -An -tx1 | tr -d ' \n'
}
U=$(rand | cut -c1-16)
P=$(rand)
RO_SECRET=$(rand)
echo "::add-mask::$U"
echo "::add-mask::$P"
echo "::add-mask::$RO_SECRET"
docker network create --label "$LABEL" "$NET" > /dev/null
docker volume create --label "$LABEL" "$VOL" > /dev/null
start_server() {
docker run -d --name "$SRV" --label "$LABEL" --network "$NET" --network-alias minio \
-e "MINIO_ROOT_USER=$U" -e "MINIO_ROOT_PASSWORD=$P" -v "$VOL:/data" \
"$1" server /data --console-address :9001 > /dev/null
i=0
until docker exec "$SRV" mc ready local > /dev/null 2>&1; do
i=$((i + 1))
if [ "$i" -gt 60 ]; then
docker logs "$SRV" >&2 || true
fail "mc ready local did not succeed within 60 seconds for $1"
fi
sleep 1
done
echo "smoke: $1 is ready after $i seconds"
}
stop_server() {
docker stop "$SRV" > /dev/null
docker logs "$SRV" > "$T/$1.log" 2>&1
docker rm "$SRV" > /dev/null
}
mcr() {
docker run --rm --label "$LABEL" --network "$NET" -e "MC_HOST_s=http://$U:$P@minio:9000" "$CLIENT" "$@"
}
mcr_in() {
docker run --rm -i --label "$LABEL" --network "$NET" -e "MC_HOST_s=http://$U:$P@minio:9000" "$CLIENT" "$@"
}
mcr_ro() {
docker run --rm --label "$LABEL" --network "$NET" -e "MC_HOST_r=http://rouser:$RO_SECRET@minio:9000" "$CLIENT" "$@"
}
mcr_ro_in() {
docker run --rm -i --label "$LABEL" --network "$NET" -e "MC_HOST_r=http://rouser:$RO_SECRET@minio:9000" "$CLIENT" "$@"
}
sha_of() {
sha256sum "$1" | cut -d' ' -f1
}
make_objects() {
head -c 1048576 /dev/urandom > "$T/o1"
head -c 1048576 /dev/urandom > "$T/o2"
S1=$(sha_of "$T/o1")
S2=$(sha_of "$T/o2")
[ "$S1" != "$S2" ] || fail "the two random objects are equal"
}
write_two_versions() {
mcr mb s/vbkt
mcr version enable s/vbkt
mcr_in pipe s/vbkt/key < "$T/o1"
mcr_in pipe s/vbkt/key < "$T/o2"
}
read_back_versions() {
got=$(mcr cat s/vbkt/key | sha256sum | cut -d' ' -f1)
[ "$got" = "$S2" ] || fail "cat of the key is $got, expected the second object $S2"
mcr ls --versions --json s/vbkt/key > "$T/ls.json"
count=$(jq -s '[.[] | select(.versionId != null)] | length' "$T/ls.json")
[ "$count" = 2 ] || fail "ls --versions shows $count versions, expected 2"
distinct=$(jq -s '[.[] | select(.versionId != null) | .versionId] | unique | length' "$T/ls.json")
[ "$distinct" = 2 ] || fail "the two versions share a versionId"
found=""
for id in $(jq -rs '.[] | select(.versionId != null) | .versionId' "$T/ls.json"); do
got=$(mcr cat --version-id "$id" s/vbkt/key | sha256sum | cut -d' ' -f1)
echo "smoke: version $id has sha256 $got"
found="$found $got"
done
case $found in
*"$S1"*) ;;
*) fail "no version of the key reads back as the first object $S1" ;;
esac
case $found in
*"$S2"*) ;;
*) fail "no version of the key reads back as the second object $S2" ;;
esac
echo "smoke: both versions read back by versionId with matching sha256"
}
case $mode in
smoke)
SERVER=${1:?server image}
CLIENT=${2:?client image}
make_objects
start_server "$SERVER"
if [ "${HEALTH:-no}" = yes ]; then
i=0
until [ "$(docker inspect -f '{{.State.Health.Status}}' "$SRV")" = healthy ]; do
i=$((i + 1))
[ "$i" -le 60 ] || fail "the image HEALTHCHECK did not reach healthy within 60 seconds"
sleep 1
done
echo "smoke: the image HEALTHCHECK is healthy"
fi
write_two_versions
read_back_versions
mcr admin user add s rouser "$RO_SECRET" > /dev/null
mcr admin policy attach s readonly --user rouser > /dev/null
got=$(mcr_ro cat r/vbkt/key | sha256sum | cut -d' ' -f1)
[ "$got" = "$S2" ] || fail "the read-only user cannot read the key"
code=0
mcr_ro_in pipe r/vbkt/denied < "$T/o1" > "$T/put.out" 2>&1 || code=$?
echo "smoke: the read-only PUT exited $code with:"
cat "$T/put.out"
sh "$GATES" put-denied "$code" "$T/put.out"
echo "smoke: the read-only user's PUT is denied"
for n in 1 2; do
docker run --rm --label "$LABEL" --network "$NET" --entrypoint /bin/sh "$CLIENT" -c "
mc alias set local http://minio:9000 $U $P &&
mc mb --ignore-existing local/leasevibe-attachments &&
echo 'bucket ready';
" > /dev/null || fail "the minio-init script failed on run $n"
echo "smoke: minio-init run $n exited 0"
done
;;
continuity)
OLD=${1:?old server image}
NEW=${2:?new server image}
CLIENT=${3:?client image}
make_objects
start_server "$OLD"
write_two_versions
read_back_versions
stop_server old
start_server "$NEW"
read_back_versions
stop_server new
echo "--- first-start log of the old server"
cat "$T/old.log"
echo "--- start log of the new server on the same volume"
cat "$T/new.log"
grep -q 'Formatting' "$T/old.log" || fail "the old server's first-start log has no Formatting line, the re-format assertion would be vacuous"
if grep -q 'Formatting' "$T/new.log"; then
fail "the new server re-formatted the volume"
fi
echo "smoke: the new server started on the old volume without formatting it"
;;
*)
fail "unknown mode $mode"
;;
esac
echo "smoke: all assertions passed"