Files
home-network-k3s-impl/ci/lint.sh
T
jakman85andClaude Opus 5.5 aacf361bb8
gate / gate (pull_request) Failing after 1m58s
gate / conformance (pull_request) Has been skipped
fix(renovate): the workflow still named renovate.json, so every run since #79 died with ENOENT
#79 renamed the config to renovate.json5 and left configurationFile pointing at the old
name. Runs 315-322 (2026-10-22..29) all failed in ~1s before Renovate started.

Also add a ci/lint.sh assertion that every workflow configurationFile: resolves to a real
path — valid YAML, so yamllint could not catch it, and the gate stayed green throughout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 20:58:15 -05:00

45 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# ci/lint.sh — Stage 1: yaml/lint. Runs in CI without a cluster (live now).
# Lints all YAML in the repo against ci/yamllint.yaml.
set -euo pipefail
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck disable=SC1091
source "${CI_DIR}/lib.sh"
log "Stage: yaml/lint"
require_tool yamllint "Install: pip install 'yamllint==${YAMLLINT_VERSION}'"
# Lint tracked + untracked (not yet committed) YAML; skip .git and artifact dirs.
cd "$REPO_ROOT"
mapfile -t files < <(
{ git ls-files '*.yaml' '*.yml' 2>/dev/null
git ls-files --others --exclude-standard '*.yaml' '*.yml' 2>/dev/null
} | sort -u
)
# Fallback for a non-git checkout.
if [ "${#files[@]}" -eq 0 ]; then
mapfile -t files < <(find . -path ./.git -prune -o \( -name '*.yaml' -o -name '*.yml' \) -print)
fi
if [ "${#files[@]}" -eq 0 ]; then
ok "no YAML files to lint"
exit 0
fi
yamllint -c "${CI_DIR}/yamllint.yaml" -f "${YAMLLINT_FORMAT:-standard}" "${files[@]}"
ok "yaml/lint passed (${#files[@]} files)"
# A workflow's `configurationFile:` must name a file that exists. Renovate's did not after #79
# renamed renovate.json -> renovate.json5, and every scheduled run failed with ENOENT for 11 days
# while the gate stayed green. Valid YAML, so yamllint cannot see it.
missing=0
while IFS=: read -r wf _ value; do
value="${value#*configurationFile:}"
value="$(echo "$value" | sed -E 's/#.*//; s/^[[:space:]"'\'']+//; s/[[:space:]"'\'']+$//')"
if [ -n "$value" ] && [ ! -e "$value" ]; then
err "${wf}: configurationFile '${value}' does not exist in the repo"
missing=1
fi
done < <(grep -nE '^[[:space:]]*configurationFile:' .gitea/workflows/*.y*ml 2>/dev/null || true)
[ "$missing" -eq 0 ] || exit 1
ok "workflow configurationFile references resolve"