From f12889a6c24028c1983b70aabe3c3372e4e517f7 Mon Sep 17 00:00:00 2001 From: John Coffey Date: Thu, 19 Nov 2026 22:11:30 -0700 Subject: [PATCH 1/2] The lab from nothing, in one script, on GitHub's runners (K-L1, S7) lab/e2e.sh: up.sh, then the chart with the images release/suite.yaml names, seeded, then mail, the webmail across replicas and the console, timing each part. lab/tools.sh installs kind, kubectl and Helm at pinned versions against their published checksums. .github/workflows/e2e.yml runs both on ubuntu-24.04 and ubuntu-24.04-arm (GitHub replica only). up.sh now does what a fresh machine needs: adds the Helm repositories, installs MetalLB with a pool computed from kind's network, takes KIND_NODE_IMAGE, and waits out two cold-start races (Kyverno's webhook, Garage's status) that a reused bench cluster never showed. The README gets the suite's header, badges and notes. --- .github/workflows/e2e.yml | 60 +++++++++++++ .gitignore | 1 + README.md | 47 ++++++++-- img/brand/inbuxa-lockup-light.svg | 52 +++++++++++ lab/e2e.sh | 139 ++++++++++++++++++++++++++++++ lab/tools.sh | 51 +++++++++++ lab/up.sh | 38 +++++++- 7 files changed, 379 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/e2e.yml create mode 100644 img/brand/inbuxa-lockup-light.svg create mode 100755 lab/e2e.sh create mode 100755 lab/tools.sh diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..47398dc --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,60 @@ +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +# +# The lab end to end on a fresh GitHub runner, amd64 and arm64 (S7, K-L1): +# lab/tools.sh, then lab/e2e.sh with the chart from inbuxa-charts' main. +# Runs on the GitHub replica only (vars.BUILD_ON), where the runners are; +# Gitea's runners don't run it. +# +# The full matrix (three Kubernetes minors, nightly, chart PRs) is K-L8. +name: e2e + +on: + workflow_dispatch: + # Every branch: the lab's PRs are on Gitea, its branches reach GitHub by + # the push mirror + push: + +permissions: + contents: read + +concurrency: + group: e2e-${{ github.ref }} + cancel-in-progress: true + +jobs: + e2e: + if: ${{ vars.BUILD_ON == 'github' }} + strategy: + fail-fast: false + matrix: + runner: [ubuntu-24.04, ubuntu-24.04-arm] + runs-on: ${{ matrix.runner }} + timeout-minutes: 40 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: inbuxa-k8s-lab + persist-credentials: false + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: inbuxa/inbuxa-charts + # main, unless the repo variable CHART_REF names a chart branch + ref: ${{ vars.CHART_REF || 'main' }} + path: inbuxa-charts + persist-credentials: false + - name: Tools (pinned, checksummed) + run: | + inbuxa-k8s-lab/lab/tools.sh "$HOME/.local/bin" + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + - name: The runner + run: | + nproc; free -h | head -2; df -h / | tail -1 + docker version --format 'docker {{.Server.Version}}' + - name: Lab end to end + run: inbuxa-k8s-lab/lab/e2e.sh + - name: Memory at the end + if: always() + run: | + free -h | head -2 + docker stats --no-stream --format '{{.Name}} {{.MemUsage}}' || true diff --git a/.gitignore b/.gitignore index c18dd8d..dda99be 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ __pycache__/ +lab/.policy-apply.err diff --git a/README.md b/README.md index 91e19e0..aa0ab65 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,49 @@ -# inbuxa-k8s-lab +

+ inbuxa +

-Test lab for inbuxa on Kubernetes: end-to-end, chaos, upgrade and soak tests. +

+ The test lab for inbuxa on Kubernetes +

-`lab/up.sh` brings up a kind cluster with the data layer, Kyverno and the -policies. It needs the Helm repositories `cnpg`, `nats`, `metallb` and -`kyverno` (https://kyverno.github.io/kyverno/); the versions are pinned in -`lab/versions.env`. +

+ License: Apache-2.0 + End to end + Forum: community.coffeylabs.org + Chat on Discord +

+ +--- + +> [!NOTE] +> Development happens on [git.coffeylabs.org/inbuxa/inbuxa-k8s-lab](https://git.coffeylabs.org/inbuxa/inbuxa-k8s-lab); the copy on GitHub is a read-only mirror, and where the end-to-end runs happen. +> Report issues at **[git.coffeylabs.org/inbuxa/inbuxa-k8s-lab/issues](https://git.coffeylabs.org/inbuxa/inbuxa-k8s-lab/issues)**, join discussions at **[community.coffeylabs.org](https://community.coffeylabs.org)**, or chat on **[Discord](https://discord.gg/nqcY4TKfAn)**. + +Where [the inbuxa Helm chart](https://git.coffeylabs.org/inbuxa/inbuxa-charts) +is tested on real clusters: end to end, upgrades, failures and load. It's +for developing the chart, not for running mail; the chart's repository says +how to install it. + +`lab/e2e.sh` is the whole lab from nothing: the cluster, the chart with the +images the next chart release names (inbuxa-charts `release/suite.yaml`), +seeded, then mail, the webmail and the console, timing each part. It wants +inbuxa-charts checked out next to this repository (or `CHART_REPO=`), and +kind, kubectl and Helm, which `lab/tools.sh` installs at pinned versions, +each checked against its published checksum. CI runs it on GitHub's amd64 +and arm64 runners (`.github/workflows/e2e.yml`). + +`lab/up.sh` is just the cluster: kind, Kyverno and the policies, MetalLB, +and the data layer (CloudNativePG, NATS, Garage). It adds the Helm +repositories it needs; the versions are pinned in `lab/versions.env`. +`lab/down.sh` removes it all. The `inbuxa` namespace enforces Pod Security "restricted" and the policies in `lab/policy/defaults.yaml`: a read-only root, no service-account token (except the upgrade Job's), secrets never in the environment, and a deny-all NetworkPolicy over every pod. `lab/policy/policy-test.sh` checks that the chart passes them and that a bad value is refused. + +## License + +Free software under the [Apache License 2.0](LICENSE), and a Coffey Labs +project. diff --git a/img/brand/inbuxa-lockup-light.svg b/img/brand/inbuxa-lockup-light.svg new file mode 100644 index 0000000..a912d18 --- /dev/null +++ b/img/brand/inbuxa-lockup-light.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lab/e2e.sh b/lab/e2e.sh new file mode 100755 index 0000000..c02768b --- /dev/null +++ b/lab/e2e.sh @@ -0,0 +1,139 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +# +# The lab end to end, from nothing (K-L1, S7): the kind cluster and data +# layer (up.sh), then the chart with the released images the next chart +# release names (inbuxa-charts release/suite.yaml), seeded, then +# +# 1. mail: in over SMTP, found over IMAPS, through the mail Service +# 2. the webmail: signing in across both replicas +# 3. the console: signing in as its browser would +# +# and how long each part took. CI runs this on a fresh runner; on the bench +# it builds the lab from scratch too, so take the lab down first +# (lab/down.sh) unless you mean to reuse it. +# +# lab/e2e.sh # chart in ../inbuxa-charts +# CHART_REPO=path lab/e2e.sh +# KIND_NODE_IMAGE=kindest/node:v1.35.4 lab/e2e.sh +# +# Prints a summary, also to $GITHUB_STEP_SUMMARY when it's set, and on a +# failure what the pods and events were. +set -euo pipefail + +here=$(cd "$(dirname "$0")" && pwd) +. "$here/versions.env" +CHART_REPO="${CHART_REPO:-$here/../../inbuxa-charts}" +CHART="$CHART_REPO/charts/inbuxa" +SUITE="$CHART_REPO/release/suite.yaml" +STATE="${STATE:-$HOME/.cache/inbuxa-lab}" +K=(kubectl --context "kind-$KIND_CLUSTER" -n inbuxa) +P="${PORTS:-18080}" +PIDS=() +t0=$SECONDS +SUMMARY=() +lap() { SUMMARY+=("| $1 | $(( SECONDS - ${2:-$t0} ))s |"); } +report() { + { echo "| Part | Took |"; echo "|---|---|"; printf '%s\n' "${SUMMARY[@]}"; } > "$STATE/e2e-summary.md" + cat "$STATE/e2e-summary.md" + [ -n "${GITHUB_STEP_SUMMARY:-}" ] && { echo "### inbuxa lab, $(uname -m)"; cat "$STATE/e2e-summary.md"; } >> "$GITHUB_STEP_SUMMARY" + return 0 +} +on_exit() { + rc=$? + for p in "${PIDS[@]}"; do kill "$p" 2>/dev/null || true; done + if [ "$rc" != 0 ]; then + SUMMARY+=("| **failed** | after $(( SECONDS - t0 ))s |") + echo "== failed: pods and events" + kubectl --context "kind-$KIND_CLUSTER" get pods -A -o wide 2>/dev/null || true + "${K[@]}" get events --sort-by=.lastTimestamp 2>/dev/null | tail -40 || true + "${K[@]}" logs -l app.kubernetes.io/component=server --tail=30 --prefix 2>/dev/null | grep -v '^\s*$' | tail -60 || true + fi + report + exit "$rc" +} +trap on_exit EXIT +pin() { awk -v k="$1:" '$1 == k {print $2}' "$SUITE"; } +SERVER="$(pin server)"; WEBMAIL="$(pin webmail)"; CONSOLE="$(pin console)" +[ -n "$SERVER" ] && [ -n "$WEBMAIL" ] && [ -n "$CONSOLE" ] || { echo "!! no images in $SUITE" >&2; exit 1; } +echo "== images: server $SERVER, webmail $WEBMAIL, console $CONSOLE" +mkdir -p "$STATE" && chmod 700 "$STATE" + +echo "== the cluster and the data layer" +s=$SECONDS +"$here/up.sh" +lap "kind, Kyverno, MetalLB, CloudNativePG, NATS, Garage" "$s" + +echo "== the seed's passwords and setup" +umask 077 +new_password() { python3 -c 'import secrets; print(secrets.token_urlsafe(24))'; } +new_password > "$STATE/admin.password" +new_password > "$STATE/alice.password" +"${K[@]}" get secret inbuxa-s3 -o jsonpath='{.data.access-key}' | base64 -d > "$STATE/s3-access-key" +"${K[@]}" create secret generic inbuxa-seed \ + --from-file=admin-password="$STATE/admin.password" \ + --from-file=alice-password="$STATE/alice.password" \ + --from-file=s3-access-key="$STATE/s3-access-key" --dry-run=client -o yaml | "${K[@]}" apply -f - >/dev/null +rm -f "$STATE/s3-access-key" +"${K[@]}" create configmap inbuxa-lab-seed --from-file="$here/chart/seed.json" --dry-run=client -o yaml \ + | "${K[@]}" apply -f - >/dev/null +umask 022 + +echo "== the chart: seeded, two replicas of everything" +s=$SECONDS +helm --kube-context "kind-$KIND_CLUSTER" -n inbuxa upgrade --install inbuxa "$CHART" \ + -f "$here/chart/values-lab.yaml" -f "$here/chart/values-frontends.yaml" \ + --set server.image.repository=ghcr.io/inbuxa/inbuxa-server --set server.image.tag="$SERVER" \ + --set server.image.pullPolicy=IfNotPresent \ + --set webmail.image.repository=ghcr.io/inbuxa/inbuxa-webmail --set webmail.image.tag="$WEBMAIL" \ + --set webmail.image.pullPolicy=IfNotPresent \ + --set console.image.repository=ghcr.io/inbuxa/inbuxa-admin --set console.image.tag="$CONSOLE" \ + --set console.image.pullPolicy=IfNotPresent \ + --wait --timeout 15m >/dev/null +"${K[@]}" get pods --no-headers -o wide | awk '{print " " $1, $3, $7}' +lap "chart install (seed, server, webmail, console)" "$s" + +echo "== 1. mail" +s=$SECONDS +lb="" +for _ in $(seq 1 30); do + lb="$("${K[@]}" get svc inbuxa-mail -o jsonpath='{.status.loadBalancer.ingress[0].ip}')" + [ -n "$lb" ] && break + sleep 2 +done +[ -n "$lb" ] || { echo "!! the mail Service has no address" >&2; exit 1; } +ACCOUNT=alice@lab.test PASSWORD_FILE="$STATE/alice.password" timeout 150 python3 "$here/chart/mailtest.py" "$lb" +lap "mail: SMTP in, IMAPS found" "$s" + +forward() { # + if ss -ltn "sport = :$1" | grep -q LISTEN; then + echo "!! port $1 is in use: PORTS= $0" >&2 + exit 1 + fi + "${K[@]}" port-forward "$2" "$1:8080" >/dev/null 2>&1 & + PIDS+=($!) +} +mapfile -t webmail < <("${K[@]}" get pods -l app.kubernetes.io/component=webmail \ + --field-selector status.phase=Running -o name | sort) +[ "${#webmail[@]}" -ge 2 ] || { echo "!! fewer than two webmail pods" >&2; exit 1; } +forward $((P + 1)) "${webmail[0]}" +forward $((P + 2)) "${webmail[1]}" +forward "$P" svc/inbuxa-http +forward $((P + 3)) svc/inbuxa-console +sleep 3 + +echo "== 2. webmail: start on ${webmail[0]#pod/}, finish on ${webmail[1]#pod/}" +s=$SECONDS +python3 "$here/chart/signin.py" "http://127.0.0.1:$((P + 1))" "http://127.0.0.1:$((P + 2))" \ + "http://127.0.0.1:$P" alice@lab.test "$STATE/alice.password" +lap "webmail sign-in across replicas" "$s" + +echo "== 3. console" +s=$SECONDS +python3 "$here/chart/console-signin.py" "http://127.0.0.1:$((P + 3))" "http://127.0.0.1:$P" \ + https://admin.lab.test https://mail.lab.test admin@lab.test "$STATE/admin.password" +lap "console sign-in" "$s" + +lap "**total**" +echo "== passed in $(( SECONDS - t0 ))s" diff --git a/lab/tools.sh b/lab/tools.sh new file mode 100755 index 0000000..43ac582 --- /dev/null +++ b/lab/tools.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +# +# The tools the lab runs with, at pinned versions, each checked against the +# project's published SHA-256 (K-L1): kind, kubectl and Helm, for linux/amd64 +# or linux/arm64, into DIR (default ~/.local/bin). +# +# lab/tools.sh [DIR] +# +# To move a pin, change the version and both of its sums together. +set -euo pipefail + +DIR="${1:-$HOME/.local/bin}" +case "$(uname -m)" in + x86_64) ARCH=amd64 ;; + aarch64|arm64) ARCH=arm64 ;; + *) echo "linux/amd64 or linux/arm64 only" >&2; exit 2 ;; +esac + +KIND_VERSION=v0.33.0 +KIND_SHA256_amd64=aee6151561422756b764a4ae28e7f44cda5af5a9eead3cc9985112b1de8d8e0d +KIND_SHA256_arm64=20022bee6cfcd5086cb7234d218e3454e6090022f2a8f55d1fa7fcf42c3867a2 +KUBECTL_VERSION=v1.37.2 +KUBECTL_SHA256_amd64=c04487523e7aa7d1493f7808174c899db93d7a9cf57531420cd76b9bd415f8f4 +KUBECTL_SHA256_arm64=fcc16f63186659d9722014b7e02d5fdd2d4e669cb8c0ab66365d7d3b8ba03509 +HELM_VERSION=v4.3.2 +HELM_SHA256_amd64=d1c0278d46beab79582d7e50f5b3dc206944ba8e577cde618513fd07daa53983 +HELM_SHA256_arm64=df31cb61680ef728f82c770e5280dd565617bee6b039d37e85c677288be4bbb0 + +mkdir -p "$DIR" +WORK="$(mktemp -d)" +trap 'rm -rf "$WORK"' EXIT +sum() { local v="$1_SHA256_$ARCH"; echo "${!v}"; } +# fetch URL SHA256 FILE: download URL to $WORK/FILE and check its hash +fetch() { + curl -fsSL --retry 3 --proto '=https' -o "$WORK/$3" "$1" + echo "$2 $WORK/$3" | sha256sum -c --quiet - +} + +fetch "https://github.com/kubernetes-sigs/kind/releases/download/$KIND_VERSION/kind-linux-$ARCH" "$(sum KIND)" kind +install -m 0755 "$WORK/kind" "$DIR/kind" +fetch "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/$ARCH/kubectl" "$(sum KUBECTL)" kubectl +install -m 0755 "$WORK/kubectl" "$DIR/kubectl" +fetch "https://get.helm.sh/helm-$HELM_VERSION-linux-$ARCH.tar.gz" "$(sum HELM)" helm.tgz +tar -xzf "$WORK/helm.tgz" -C "$WORK" "linux-$ARCH/helm" +install -m 0755 "$WORK/linux-$ARCH/helm" "$DIR/helm" + +"$DIR/kind" version +"$DIR/kubectl" version --client | head -1 +"$DIR/helm" version --short diff --git a/lab/up.sh b/lab/up.sh index b07f8ed..8e75d53 100755 --- a/lab/up.sh +++ b/lab/up.sh @@ -10,8 +10,18 @@ t0=$SECONDS step() { printf '\n== %s (%ss)\n' "$1" "$((SECONDS - t0))"; } rand() { head -c 24 /dev/urandom | base64 | tr -d '/+=' ; } +step "Helm repositories" +helm repo add cnpg https://cloudnative-pg.github.io/charts --force-update >/dev/null +helm repo add nats https://nats-io.github.io/k8s/helm/charts/ --force-update >/dev/null +helm repo add metallb https://metallb.github.io/metallb --force-update >/dev/null +helm repo add kyverno https://kyverno.github.io/kyverno/ --force-update >/dev/null +helm repo update >/dev/null + step "kind cluster" -kind get clusters 2>/dev/null | grep -qx "$KIND_CLUSTER" || kind create cluster --name "$KIND_CLUSTER" --config "$here/kind.yaml" --wait 120s +# KIND_NODE_IMAGE picks the Kubernetes version (CI's matrix); unset, kind's own +kind get clusters 2>/dev/null | grep -qx "$KIND_CLUSTER" || + kind create cluster --name "$KIND_CLUSTER" --config "$here/kind.yaml" --wait 120s \ + ${KIND_NODE_IMAGE:+--image "$KIND_NODE_IMAGE"} kubectl config use-context "kind-$KIND_CLUSTER" >/dev/null for ns in data inbuxa; do kubectl create namespace "$ns" --dry-run=client -o yaml | kubectl apply -f - >/dev/null; done # inbuxa's pods run under Pod Security "restricted", enforced (K-C4), and @@ -19,10 +29,25 @@ for ns in data inbuxa; do kubectl create namespace "$ns" --dry-run=client -o yam kubectl label --overwrite namespace inbuxa inbuxa.org/policy=enforce \ pod-security.kubernetes.io/enforce=restricted pod-security.kubernetes.io/warn=restricted >/dev/null +step "MetalLB" +# LoadBalancer addresses from the top of kind's Docker network, which the +# host reaches: computed, since that network's subnet differs by machine +helm upgrade --install metallb metallb/metallb --version "$METALLB_CHART" -n metallb-system --create-namespace --wait >/dev/null +subnet=$(docker network inspect kind -f '{{range .IPAM.Config}}{{.Subnet}} {{end}}' | tr ' ' '\n' | grep -v ':' | head -1) +pool=$(python3 -c 'import ipaddress,sys; n=ipaddress.ip_network(sys.argv[1]); print(f"{n.broadcast_address-55}-{n.broadcast_address-5}")' "$subnet") +sed "s|172.19.255.200-172.19.255.250|$pool|" "$here/network/metallb-pool.yaml" | kubectl apply -f - >/dev/null +echo " LoadBalancer pool $pool ($subnet)" + step "Kyverno" helm upgrade --install kyverno kyverno/kyverno --version "$KYVERNO_CHART" -n kyverno --create-namespace \ --set cleanupController.enabled=false --set reportsController.enabled=false --wait >/dev/null -kubectl apply -f "$here/policy/defaults.yaml" >/dev/null +# Helm's --wait returns before the webhook answers on a new cluster +for i in $(seq 1 30); do + kubectl apply -f "$here/policy/defaults.yaml" >/dev/null 2>"$here/.policy-apply.err" && break + [ "$i" = 30 ] && { cat "$here/.policy-apply.err" >&2; rm -f "$here/.policy-apply.err"; exit 1; } + sleep 3 +done +rm -f "$here/.policy-apply.err" step "CloudNativePG operator" helm upgrade --install cnpg cnpg/cloudnative-pg --version "$CNPG_CHART" -n cnpg-system --create-namespace --wait >/dev/null @@ -38,7 +63,14 @@ sed "s|GARAGE_IMAGE|$GARAGE_IMAGE|" "$here/data-layer/garage.yaml" | kubectl -n kubectl -n data rollout status deploy/garage --timeout=180s >/dev/null g() { kubectl -n data exec deploy/garage -- /garage "$@"; } if ! g bucket info inbuxa-blobs >/dev/null 2>&1; then - node=$(g status 2>/dev/null | awk '/^[0-9a-f]{16}/{print $1; exit}') + # Ready to Kubernetes isn't ready to answer: wait for Garage to list itself + node="" + for _ in $(seq 1 30); do + node=$( (g status 2>/dev/null || true) | awk '/^[0-9a-f]{16}/{print $1; exit}') + [ -n "$node" ] && break + sleep 2 + done + [ -n "$node" ] || { echo "!! Garage never listed its node" >&2; exit 1; } g layout assign -z lab -c 2G "$node" >/dev/null g layout apply --version 1 >/dev/null g bucket create inbuxa-blobs >/dev/null -- 2.54.0 From 905c3ae0f7afe74567296df712fb10b115737c27 Mon Sep 17 00:00:00 2001 From: John Coffey Date: Thu, 19 Nov 2026 22:28:28 -0700 Subject: [PATCH 2/2] Gitea CI: the scripts parse and the YAML loads Also keeps Gitea from running .github/workflows/e2e.yml itself, which it does when .gitea/workflows is missing: its jobs waited for GitHub runners. --- .gitea/workflows/ci.yml | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..4ff29fe --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,63 @@ +# SPDX-FileCopyrightText: 2026 Coffey Labs LLC +# SPDX-License-Identifier: Apache-2.0 +# +# The quick checks, on every pull request and on main: every script parses +# (bash -n, Python compile), and every YAML file and workflow loads. The +# end-to-end runs need Docker and kind, so they're on the GitHub replica +# (.github/workflows/e2e.yml). +# +# This file being here also keeps Gitea from running .github/workflows +# itself: it reads those only when .gitea/workflows doesn't exist, and their +# jobs would wait for GitHub's runners for ever. +name: ci + +on: + push: + branches: [main] + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +defaults: + run: + shell: bash + +jobs: + check: + runs-on: light + container: + image: mirror.gcr.io/library/debian:trixie-slim@sha256:a72b4433de1cf7d6bae0c4cee74d0547f58601a643b3375f070c51600d63b6b2 # trixie-slim + steps: + - name: Packages + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update -qq + apt-get install -y -qq --no-install-recommends ca-certificates git python3-minimal python3-yaml >/dev/null + - uses: coffey-labs/actions/checkout@fab0c4d45e0162963965f1555df27b7bed5e20ec + - name: Scripts parse + run: | + fail=0 + while IFS= read -r -d '' f; do bash -n "$f" || { echo "::error file=$f::doesn't parse"; fail=1; }; done \ + < <(find lab -name '*.sh' -print0) + while IFS= read -r -d '' f; do python3 -c 'import ast,sys; ast.parse(open(sys.argv[1]).read(), sys.argv[1])' "$f" \ + || { echo "::error file=$f::doesn't parse"; fail=1; }; done < <(find lab -name '*.py' -print0) + exit $fail + - name: YAML loads + run: | + python3 - <<'PY' + import pathlib, sys, yaml + bad = 0 + for p in sorted(pathlib.Path(".").rglob("*.y*ml")): + if ".git" in p.parts: + continue + try: + list(yaml.safe_load_all(p.read_text())) + except yaml.YAMLError as e: + print(f"::error file={p}::{e}".replace("\n", " ")); bad = 1 + sys.exit(bad) + PY -- 2.54.0