Files
container-gobuilder/pre-commit.sh
T
unkin-agent c90a0e1fe3
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline failed
ci/woodpecker/pr/test Pipeline failed
Take the estate repo name from distro.env
Keeps the test assertions distro-agnostic so a non-el9 matrix entry needs no
script edit.
2026-09-27 18:07:07 +10:00

28 lines
1017 B
Bash
Executable File

#!/usr/bin/env bash
# Guards the one mistake this layout invites: a distro added under distros/ but left
# out of a .woodpecker matrix, so it silently never gets built.
set -uo pipefail
REQUIRED_KEYS="BASE_IMAGE_NAME IMAGE TAG_SUFFIX DEFAULT ESTATE_REPO PACKAGES GO_MIN"
WORKFLOWS=".woodpecker/build.yaml .woodpecker/test.yaml .woodpecker/docker.yaml"
fail=0
for d in distros/*/; do
n=${d#distros/}; n=${n%/}
for k in $REQUIRED_KEYS; do
grep -q "^${k}=" "${d}distro.env" || { echo "${d}distro.env: missing ${k}"; fail=1; }
done
for wf in $WORKFLOWS; do
grep -q "DISTRO: ${n}\$" "$wf" || { echo "${wf}: distro ${n} missing from matrix"; fail=1; }
done
done
# Exactly one distro owns the unsuffixed :<version> and :latest tags.
n=$(grep -l 'DEFAULT="true"' distros/*/distro.env | wc -l)
[ "$n" -eq 1 ] || { echo "expected exactly one distro with DEFAULT=\"true\", found ${n}"; fail=1; }
for s in ./*.sh; do bash -n "$s" || fail=1; done
[ "$fail" -eq 0 ] || { echo "FAILED"; exit 1; }
echo "PASS"