Files
minio/.gitea/workflows/release.yml
T
Pavlo Ratushnyi feb5276108
release / release (push) Failing after 2m52s
LEAS-2795 mutant m4a
2026-11-14 14:38:47 +01:00

237 lines
11 KiB
YAML

name: release
on:
push:
branches: ['**']
workflow_dispatch:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 90
permissions:
contents: read
env:
KIND: minio
BIN: minio
PKG: minio
REGISTRY: git.vezha.io
steps:
- name: AC1 checkout the recipe
uses: https://git.vezha.io/actions/checkout@v4
with:
persist-credentials: false
- name: AC2 pins are complete and well formed
id: pins
run: sh vezha/gates.sh pins "$KIND" | tee -a "$GITHUB_ENV" | tee -a "$GITHUB_OUTPUT"
- name: AC3 no unpinned reference and workflow lint
run: sh vezha/gates.sh refs "$KIND"
- name: tools docker cli and jq
run: |
command -v docker >/dev/null 2>&1 || { apt-get update -qq; DEBIAN_FRONTEND=noninteractive apt-get install -y -qq docker.io >/dev/null; }
command -v jq >/dev/null 2>&1 || { apt-get update -qq; DEBIAN_FRONTEND=noninteractive apt-get install -y -qq jq >/dev/null; }
docker version --format 'client {{.Client.Version}} server {{.Server.Version}}'
jq --version
- name: AC1 provenance of the import, anonymous
run: sh vezha/gates.sh provenance-remote
- name: AC1 checkout the pinned upstream source
uses: https://git.vezha.io/actions/checkout@v4
with:
ref: ${{ steps.pins.outputs.UPSTREAM_COMMIT }}
path: src
fetch-depth: 1
persist-credentials: false
- name: AC1 source tree is at the pinned commit
run: sh vezha/gates.sh provenance-src
- name: mutant dirty tracked file in src
run: echo "// mutant" >> src/main.go
- name: AC7 source offer URLs answer anonymously
run: sh vezha/gates.sh source-urls
- name: negative controls, every gate must refuse its planted input
run: sh vezha/gates.sh self-test
- name: names and build arguments
run: |
TAG=$(sh vezha/gates.sh make-tag)
{ echo "TAG=$TAG"; echo "IMG=$REGISTRY/para/$PKG:$TAG"; echo "LOCAL=vezha-build-$KIND:$GITHUB_RUN_ID"; } >> "$GITHUB_ENV"
mkdir -p out
sh vezha/gates.sh pins "$KIND" | sed 's/^/--build-arg=/' > out/build-args
echo "tag $TAG"
- name: AC2 pins stage proves the source tree and the module
run: |
mapfile -t ARGS < out/build-args
docker build --target pins -f vezha/Dockerfile "${ARGS[@]}" -t "$LOCAL-pins" .
- name: AC4 build stage and binary hash A
run: |
mapfile -t ARGS < out/build-args
docker build --target build -f vezha/Dockerfile "${ARGS[@]}" -t "$LOCAL-build" .
cid=$(docker create "$LOCAL-build")
docker cp "$cid:/out/$BIN" "out/$BIN.a"
docker cp "$cid:/out/$BIN.sha256" out/sha.a
docker rm "$cid" > /dev/null
A=$(sha256sum "out/$BIN.a" | cut -d' ' -f1)
if [ "$A" != "$(cat out/sha.a)" ]; then
echo "REFUSED build: the extracted binary does not match the build stage's sha file"
exit 1
fi
echo "BINARY_SHA256=$A" >> "$GITHUB_ENV"
echo "binary sha256 A: $A"
- name: AC6 final image and content check
run: |
mapfile -t ARGS < out/build-args
sh vezha/gates.sh render-source vezha/SOURCE.tmpl vezha/SOURCE
docker build -f vezha/Dockerfile "${ARGS[@]}" "--build-arg=RECIPE_COMMIT=$GITHUB_SHA" "--build-arg=BINARY_SHA256=$BINARY_SHA256" -t "$IMG" .
RECIPE_COMMIT="$GITHUB_SHA" sh vezha/check-image.sh "$KIND" "$IMG"
- name: AC4 version output carries the pinned release and commit
run: |
out=$(docker run --rm --label "io.vezha.smoke=$GITHUB_RUN_ID" "$IMG" --version)
echo "$out"
case "$out" in
*"$UPSTREAM_RELEASE"*"commit-id=$UPSTREAM_COMMIT"*) echo "version output names $UPSTREAM_RELEASE and $UPSTREAM_COMMIT" ;;
*) echo "REFUSED version: --version does not name $UPSTREAM_RELEASE and commit-id=$UPSTREAM_COMMIT"; exit 1 ;;
esac
- name: AC5 reproducible, second no-cache build of the build stage
run: |
mapfile -t ARGS < out/build-args
docker build --no-cache --target build -f vezha/Dockerfile "${ARGS[@]}" -t "$LOCAL-build2" .
cid=$(docker create "$LOCAL-build2")
docker cp "$cid:/out/$BIN" "out/$BIN.b"
docker rm "$cid" > /dev/null
B=$(sha256sum "out/$BIN.b" | cut -d' ' -f1)
if [ "$B" != "$BINARY_SHA256" ]; then
echo "REFUSED reproducible: second build has sha256 $B, first has $BINARY_SHA256"
exit 1
fi
echo "both builds have sha256 $B"
- name: AC7 source offer in the image resolves anonymously
run: sh vezha/gates.sh source-offer "$IMG" "$KIND" "$UPSTREAM_RELEASE"
- name: AC4 the mc inside the image is the pinned mc release
run: |
out=$(docker run --rm --entrypoint /usr/bin/mc --label "io.vezha.smoke=$GITHUB_RUN_ID" "$IMG" --version)
echo "$out"
case "$out" in
*RELEASE.2025-08-13T08-35-41Z*) echo "mc --version names RELEASE.2025-08-13T08-35-41Z" ;;
*) echo "REFUSED version: /usr/bin/mc --version does not name RELEASE.2025-08-13T08-35-41Z"; exit 1 ;;
esac
- name: AC8 smoke of the built server with the mc image
run: HEALTH=yes sh vezha/smoke.sh smoke "$IMG" "$MC_IMAGE"
- name: AC9 volume continuity from the stopgap server to the built server
run: sh vezha/smoke.sh continuity git.vezha.io/para/minio@sha256:a1a8bd4ac40ad7881a245bab97323e18f971e4d4cba2c2007ec1bedd21cbaba2 "$IMG" "$MC_IMAGE"
- name: AC10 preflight, write-once tag and the stopgap tags before
run: |
sh vezha/gates.sh preflight "$KIND" "$GITHUB_REF" "${MC_IMAGE:-}"
sh vezha/gates.sh tag "$PKG" "$TAG"
sh vezha/gates.sh stopgap | tee out/stopgap.before
- name: publish tools, pinned syft and oras installed before any login
if: github.ref == 'refs/heads/vezha'
run: |
curl -fsSLO https://github.com/anchore/syft/releases/download/v1.50.0/syft_1.50.0_linux_amd64.tar.gz
echo "bf7b29ff57f06da30918266a0e1c2885a8f99784798d1bdb1628886aa015d788 syft_1.50.0_linux_amd64.tar.gz" | sha256sum -c -
tar -xzf syft_1.50.0_linux_amd64.tar.gz syft
install -m 0755 syft /usr/local/bin/syft
curl -fsSLO https://github.com/oras-project/oras/releases/download/v1.3.3/oras_1.3.3_linux_amd64.tar.gz
echo "9ce999f8d2de03fc03968b29d743077a58783e545e5eaa53917ca177352d0e59 oras_1.3.3_linux_amd64.tar.gz" | sha256sum -c -
tar -xzf oras_1.3.3_linux_amd64.tar.gz oras
install -m 0755 oras /usr/local/bin/oras
syft version
oras version
- name: publish SBOM generated before the image
if: github.ref == 'refs/heads/vezha'
run: |
syft "docker:$IMG" -o "spdx-json=out/sbom.spdx.json"
test -s out/sbom.spdx.json
- name: publish login to the registry
if: github.ref == 'refs/heads/vezha'
env:
REGISTRY_USER: ${{ secrets.REGISTRY_USER || github.actor }}
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
sh vezha/gates.sh login-guard
echo "$REGISTRY_TOKEN" | docker login "$REGISTRY" -u "$REGISTRY_USER" --password-stdin
- name: publish SBOM artifact pushed before the image
if: github.ref == 'refs/heads/vezha'
run: cd out && oras push "$REGISTRY/para/$PKG-sbom:$TAG" --artifact-type application/spdx+json sbom.spdx.json:application/spdx+json
- name: publish the image and cross-check its digest
if: github.ref == 'refs/heads/vezha'
run: |
docker push "$IMG" | tee out/push.log
D=$(sed -n 's/.*digest: \(sha256:[0-9a-f]\{64\}\).*/\1/p' out/push.log | tail -1)
if [ -z "$D" ]; then
echo "REFUSED push: no digest in the push output"
exit 1
fi
R=$(sh vezha/gates.sh digest "$PKG" "$TAG")
if [ "$R" != "$D" ]; then
echo "REFUSED push: docker push printed $D but the registry serves $R for $TAG"
exit 1
fi
echo "DIGEST=$D" >> "$GITHUB_ENV"
- name: publish AC11 digest proof, pull by digest and compare the binary
if: github.ref == 'refs/heads/vezha'
run: |
REF="$REGISTRY/para/$PKG@$DIGEST"
docker rmi "$IMG" > /dev/null
sh vezha/gates.sh prove "$REF" "$BIN" "$BINARY_SHA256"
docker run --rm --label "io.vezha.smoke=$GITHUB_RUN_ID" "$REF" --version
oras pull "$REGISTRY/para/$PKG-sbom:$TAG" -o out/sbom-back
grep -q '"spdxVersion"' out/sbom-back/sbom.spdx.json
echo "the SBOM was pulled back and is SPDX JSON"
- name: publish AC11 the PUBLISHED line
if: github.ref == 'refs/heads/vezha'
run: |
LINE="PUBLISHED $REGISTRY/para/$PKG@$DIGEST tag=$TAG binary-sha256=$BINARY_SHA256"
echo "$LINE" | grep -Eq '^PUBLISHED git\.vezha\.io/para/(minio|minio-mc)@sha256:[0-9a-f]{64} tag=[a-z0-9._-]+ binary-sha256=[0-9a-f]{64}$' || { echo "REFUSED published: malformed line"; exit 1; }
echo "$LINE"
echo "$LINE" > out/published.txt
cd out && oras push "$REGISTRY/para/$PKG-published:$TAG" published.txt:text/plain
- name: publish AC10 stopgap tags unchanged after the run
if: github.ref == 'refs/heads/vezha'
run: |
sh vezha/gates.sh stopgap > out/stopgap.after
diff out/stopgap.before out/stopgap.after
echo "the stopgap tags resolve to the same digests as before the run"
- name: publish AC7 source offer of the pulled digest resolves anonymously
if: github.ref == 'refs/heads/vezha'
run: sh vezha/gates.sh source-offer "$REGISTRY/para/$PKG@$DIGEST" "$KIND" "$UPSTREAM_RELEASE"
- name: cleanup of this run's containers, networks, volumes and images
if: always()
run: |
for c in $(docker ps -aq --filter "label=io.vezha.smoke=$GITHUB_RUN_ID"); do docker rm -f "$c" > /dev/null 2>&1 || true; done
for n in $(docker network ls -q --filter "label=io.vezha.smoke=$GITHUB_RUN_ID"); do docker network rm "$n" > /dev/null 2>&1 || true; done
for v in $(docker volume ls -q --filter "label=io.vezha.smoke=$GITHUB_RUN_ID"); do docker volume rm "$v" > /dev/null 2>&1 || true; done
for i in "${LOCAL:-none}-pins" "${LOCAL:-none}-build" "${LOCAL:-none}-build2" "${IMG:-none}" "${REGISTRY}/para/${PKG}@${DIGEST:-none}"; do docker rmi "$i" > /dev/null 2>&1 || true; done
docker logout "$REGISTRY" > /dev/null 2>&1 || true