Files
bau-pm-pdf-tools/.gitea/workflows/ci.yml
T
magdevandClaude Opus 5 d0a2feff20 Pull the base images fresh on every build (bau-pm BAU-191)
Finding 41 of bau-pm's v0.22.3 security review called this a pin to move.
It is not a pin: both bases here are floating tags, so what ships is
whatever the runner had cached. v0.1.0 went out with nginx 1.31.6 while
quay.io/nginx/nginx-unprivileged:alpine-slim had already moved to 1.31.8,
past five October CVEs - none of them reachable in a static file server
configured like this one, which is why --pull is the fix rather than a pin.

The CI build gets it too: a gate running against a months-old cached base
is not testing what the release builds.

A release is what applies this. The running image does not change until one
is cut.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-24 00:36:26 +02:00

53 lines
2.2 KiB
YAML

# CI - every push to dev and every pull request: the scripts linted, the image
# built from BentoPDF's pinned commit, and the gate this repository exists for
# (README, "The gate"): a page may talk to its own origin and to nobody else.
name: CI
on:
push:
branches: [dev]
pull_request:
jobs:
gate:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
# Over stdin: the runner passes the host's Docker socket through, so a
# mounted workspace would resolve on the host and be empty.
- name: shellcheck
run: |
for f in scripts/*.sh; do
echo "-- $f"
docker run --rm -i koalaman/shellcheck:v0.11.0 - < "$f"
done
# npm ci and the Vite build are the slow part, several minutes on the
# shared runner; the vendor stage downloads about 60 MB from npm.
- name: build the image
timeout-minutes: 60
# --pull, as in the release workflow (bau-pm BAU-191): both bases are
# floating tags, and a gate that runs against a months-old cached base
# is not testing what the release builds.
run: docker build --pull --build-arg VERSION="ci-${GITHUB_SHA::8}" -t bau-pm-pdf-tools:ci .
- name: build the gate
timeout-minutes: 15
run: docker build -f test/Dockerfile -t bau-pm-pdf-tools-gate:ci .
- name: gate - nothing leaves the origin
timeout-minutes: 40
run: |
net="bau-pm-pdf-tools-ci-${GITHUB_RUN_ID}"
docker network create "$net" >/dev/null
trap 'docker rm -f -v "$net-app" >/dev/null 2>&1; docker network rm "$net" >/dev/null 2>&1' EXIT
docker run -d --name "$net-app" --network "$net" --network-alias pdf-tools bau-pm-pdf-tools:ci >/dev/null
for i in $(seq 1 30); do
docker run --rm --network "$net" bau-pm-pdf-tools-gate:ci wget -q --spider http://pdf-tools:8080/ && break
[ "$i" -eq 30 ] && { echo "the image never answered" >&2; exit 1; }
sleep 2
done
docker run --rm --network "$net" bau-pm-pdf-tools-gate:ci node test/zero-hosts.mjs http://pdf-tools:8080