Files
container-gobuilder/pre-commit.sh
T
unkin-agent d2040789e5
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline failed
Add matrixed gobuilder image build
Replace the packer-images gobuilder with a Dockerfile matrix built on each
container-base distro image, on a single repo semver.

- install golang, gcc and nfpm
- bake the sha256-pinned go-cache-plugin v0.1.0 binary onto PATH
- run in-image assertions as a --target test build stage
- add pull_request build/test/pre-commit and tag-triggered docker workflows
2026-09-27 17:55:29 +10:00

28 lines
1005 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 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"