#!/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 : 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"