diff --git a/.github/workflows/conformance.yml b/.github/workflows/conformance.yml index c036da3f..e8d60cef 100644 --- a/.github/workflows/conformance.yml +++ b/.github/workflows/conformance.yml @@ -26,11 +26,19 @@ name: FAPI Conformance # Actions tab shows an accurate result — it just isn't wired into # anything that blocks a merge. # -# Tracks the OIDF suite's latest master/prebuilt images on every run (no -# version pin) — simplest, and consistent with how the suite is used -# locally today. Each run records the suite commit and image digests it -# tested in its job summary ("Record OIDF suite version" below), so a -# new failure can be checked against the last green run's suite. +# Runs a pinned OIDF suite release, so that only reviewed suite code +# runs here: the suite's scripts run on the runner itself, and GitHub's +# cache is shared by every workflow on main and restored by pull +# requests (ci.yml restores the Go cache setup-go saves), so code this +# job runs could poison what ci.yml restores. For the same reason the +# job saves no cache of its own and keeps no Git credentials. +# conformance/scripts/suite-version.env names the release (SUITE_TAG) +# and its commit (SUITE_COMMIT); conformance/scripts/ +# suite-pinned.override.yml pins that release's images by digest. Move +# all three together. The newer-suite job fails when a newer release is +# out; it is a separate job so that it never holds back the matrix +# results. Each run still records the suite commit and image digests it +# tested in its job summary ("Record OIDF suite version" below). on: schedule: @@ -41,20 +49,41 @@ permissions: contents: read jobs: + newer-suite: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + sparse-checkout: conformance/scripts/suite-version.env + sparse-checkout-cone-mode: false + + - name: Check for a newer suite release + run: | + . conformance/scripts/suite-version.env + newest=$(git ls-remote --tags --refs https://gitlab.com/openid/conformance-suite.git 'release-v*' | sed 's#.*refs/tags/##' | sort -V | tail -1) + if [ -z "$newest" ]; then echo "no suite release found" >&2; exit 1; fi + echo "OIDF conformance suite: pinned $SUITE_TAG, newest $newest" >> "$GITHUB_STEP_SUMMARY" + if [ "$newest" != "$SUITE_TAG" ]; then + echo "::error::The OIDF conformance suite released $newest; the matrix runs $SUITE_TAG. Review the release, then move the pin in conformance/scripts/suite-version.env and suite-pinned.override.yml." + exit 1 + fi + conformance: runs-on: ubuntu-latest timeout-minutes: 120 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 with: go-version-file: go.mod check-latest: true - # No go.sum exists — this module has zero external - # dependencies (see go.mod) — see ci.yml's identical setting - # for why this is needed instead. - cache-dependency-path: go.mod + # Neither restores nor saves the Go cache: see the top of this + # file. + cache: false - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: @@ -65,8 +94,27 @@ jobs: # name — conformance-suite_default — matches # conformance/server/docker-compose.yml's own existing default for # SUITE_NETWORK, without needing to set it explicitly. + # + # Clones the pinned release (see the top of this file) and checks + # that the tag is still at the pinned commit and that the image + # override names the same release, so the three can't drift apart. - name: Clone OIDF conformance suite - run: git clone --depth 1 https://gitlab.com/openid/conformance-suite.git /tmp/conformance-suite + run: | + . conformance/scripts/suite-version.env + : "${SUITE_TAG:?not set in suite-version.env}" "${SUITE_COMMIT:?not set in suite-version.env}" + { echo "SUITE_TAG=$SUITE_TAG"; echo "SUITE_COMMIT=$SUITE_COMMIT"; } >> "$GITHUB_ENV" + git clone --depth 1 --branch "$SUITE_TAG" https://gitlab.com/openid/conformance-suite.git /tmp/conformance-suite + got=$(git -C /tmp/conformance-suite rev-parse HEAD) + if [ "$got" != "$SUITE_COMMIT" ]; then + echo "::error::suite tag $SUITE_TAG is at $got, not the pinned $SUITE_COMMIT" + exit 1 + fi + for image in conformance-suite/nginx conformance-suite; do + if ! grep -q "registry.gitlab.com/openid/$image:$SUITE_TAG@sha256:" conformance/scripts/suite-pinned.override.yml; then + echo "::error::conformance/scripts/suite-pinned.override.yml doesn't pin $image to $SUITE_TAG by digest" + exit 1 + fi + done # The suite's scripts need what its own scripts/requirements.txt # lists (httpx and pyparsing). That list is unpinned, so this @@ -81,23 +129,27 @@ jobs: # Prebuilt images — no Java/Maven build needed, mirrors this # repo's own conformance/server/scripts/README.md "Manual test - # run" step 1. The override maps host.docker.internal for the - # suite's server container, which Linux Docker doesn't define on - # its own — see the override file's comment. + # run" step 1. suite-host-gateway.override.yml maps + # host.docker.internal for the suite's server container, which + # Linux Docker doesn't define on its own — see that file's comment; + # suite-pinned.override.yml runs the pinned release's images by + # digest instead of :latest. - name: Bring up OIDF conformance suite working-directory: /tmp/conformance-suite - run: docker compose -f docker-compose-prebuilt.yml -f "$GITHUB_WORKSPACE/conformance/scripts/suite-host-gateway.override.yml" up -d - - # Records exactly which suite this run tested: the cloned commit - # and the digest of each prebuilt image, which are built from - # master separately and can lag the commit. Since every run tracks - # the suite's latest (see the top of this file), comparing this - # with the last green run's shows straight away whether a new - # failure came with a suite change. Written to the job summary and - # to the uploaded results; runs even if bringing the suite up - # failed, so an image that couldn't be pulled shows as such. Each - # docker call is time-limited, so a stalled daemon can't hold the - # job until its timeout. + run: >- + docker compose -f docker-compose-prebuilt.yml + -f "$GITHUB_WORKSPACE/conformance/scripts/suite-host-gateway.override.yml" + -f "$GITHUB_WORKSPACE/conformance/scripts/suite-pinned.override.yml" + up -d + + # Records exactly which suite this run tested: the pinned release, + # its commit and the digest of each image the pinned override + # names, so a run's summary shows which suite a result came from + # without reading this file at that commit. Written to the job + # summary and to the uploaded results; runs even if bringing the + # suite up failed, so an image that couldn't be pulled shows as + # such. Each docker call is time-limited, so a stalled daemon + # can't hold the job until its timeout. - name: Record OIDF suite version if: always() working-directory: /tmp/conformance-suite @@ -108,8 +160,9 @@ jobs: { echo "### OIDF conformance suite under test" echo + echo "- Release: \`$SUITE_TAG\`" echo "- Commit: \`$(git rev-parse HEAD)\` ($(git log -1 --format='%cI %s'))" - images=$(timeout 30 docker compose -f docker-compose-prebuilt.yml config --images || true) + images=$(timeout 30 docker compose -f docker-compose-prebuilt.yml -f "$GITHUB_WORKSPACE/conformance/scripts/suite-pinned.override.yml" config --images || true) [ -n "$images" ] || echo "- Images: couldn't be listed" for image in $images; do digest=$(timeout 30 docker image inspect --format '{{index .RepoDigests 0}}' "$image" 2>/dev/null || echo "not pulled") @@ -156,5 +209,5 @@ jobs: - name: Tear down suite containers if: always() run: | - (cd /tmp/conformance-suite && docker compose -f docker-compose-prebuilt.yml down -v) || true + (cd /tmp/conformance-suite && docker compose -f docker-compose-prebuilt.yml -f "$GITHUB_WORKSPACE/conformance/scripts/suite-host-gateway.override.yml" -f "$GITHUB_WORKSPACE/conformance/scripts/suite-pinned.override.yml" down -v) || true (cd conformance/server && docker compose down) || true diff --git a/conformance/README.md b/conformance/README.md index e913eca8..75040183 100644 --- a/conformance/README.md +++ b/conformance/README.md @@ -50,6 +50,14 @@ Reflects the latest scheduled/manually-triggered run of [`scripts/run-all.sh`](scripts/run-all.sh) in CI (see [`../.github/workflows/conformance.yml`](../.github/workflows/conformance.yml)) — not a per-commit guarantee, since this doesn't run on every push/PR. +CI runs a pinned OIDF suite release, named in +[`scripts/suite-version.env`](scripts/suite-version.env), with that +release's images +([`scripts/suite-pinned.override.yml`](scripts/suite-pinned.override.yml)); +the workflow's `newer-suite` job fails when a newer release is out, +and moving the pin is described in +[`server/scripts/README.md`](server/scripts/README.md#manual-test-run-end-to-end)'s +step 1. Conformance testing is tracked separately per role: passing the authorization-server suite says nothing about client conformance, even diff --git a/conformance/client/scripts/README.md b/conformance/client/scripts/README.md index e1c55f0e..abe323b9 100644 --- a/conformance/client/scripts/README.md +++ b/conformance/client/scripts/README.md @@ -34,7 +34,10 @@ The suite must already be running locally (see [`../../server/scripts/README.md`](../../server/scripts/README.md)'s step 1 if you don't have it up — `docker compose -f docker-compose-prebuilt.yml up` from an OIDF `conformance-suite` -checkout, reachable at `https://localhost.emobix.co.uk:8443`). No AS +checkout, ideally of the release CI pins in +[`../../scripts/suite-version.env`](../../scripts/suite-version.env) +with [`suite-pinned.override.yml`](../../scripts/suite-pinned.override.yml) +added, reachable at `https://localhost.emobix.co.uk:8443`). No AS container, network attachment, or generated key file is needed on this side — everything the driver's plan config needs (a throwaway ES256 keypair, a unique alias, the registered `client_id`/`redirect_uri`) is diff --git a/conformance/requirements-suite.in b/conformance/requirements-suite.in index fc69c887..36904274 100644 --- a/conformance/requirements-suite.in +++ b/conformance/requirements-suite.in @@ -1,8 +1,10 @@ # What the OIDF conformance suite's own scripts/requirements.txt -# (gitlab.com/openid/conformance-suite, master) lists. The conformance -# workflow installs the hash-pinned compilation of this file, -# requirements-suite.txt, never the suite's unpinned list. To refresh -# it, after checking the suite's list still matches this one: +# (gitlab.com/openid/conformance-suite, at the release pinned in +# scripts/suite-version.env) lists. The conformance workflow installs +# the hash-pinned compilation of this file, requirements-suite.txt, +# never the suite's unpinned list. To refresh it, after checking the +# suite's list still matches this one (check again whenever the suite +# pin moves): # # pip install pip-tools # pip-compile --generate-hashes --allow-unsafe --strip-extras \ diff --git a/conformance/scripts/run-all.sh b/conformance/scripts/run-all.sh index d5bab0f6..c6daf913 100755 --- a/conformance/scripts/run-all.sh +++ b/conformance/scripts/run-all.sh @@ -153,7 +153,9 @@ # - The OIDF conformance suite itself running locally # (https://localhost.emobix.co.uk:8443 by default). # - CONFORMANCE_SUITE_CHECKOUT set to that suite's own git checkout -# (this script runs its scripts/run-test-plan.py from there). +# (this script runs its scripts/run-test-plan.py from there), +# ideally of the release CI pins in suite-version.env; the script +# warns when it isn't. # - conformance/server/oidf-config/{baseline,pairwise,message-signing,ciba-mtls,client-auth-mtls}-plan.json # already filled in (gitignored — carries private keys; run # `go run ./conformance/server/scripts/setup-config` to generate @@ -197,6 +199,16 @@ if [[ ! -f "$CONFORMANCE_SUITE_CHECKOUT/scripts/run-test-plan.py" ]]; then exit 1 fi +# The suite release CI runs (see suite-version.env). A checkout at any +# other commit still runs, with a warning: its results can differ from +# CI's for reasons that have nothing to do with this repo. +# shellcheck source=suite-version.env +. "$SCRIPT_DIR/suite-version.env" +suite_head="$(git -C "$CONFORMANCE_SUITE_CHECKOUT" rev-parse HEAD 2>/dev/null || echo unknown)" +if [[ "$suite_head" != "$SUITE_COMMIT" ]]; then + echo "warning: $CONFORMANCE_SUITE_CHECKOUT is at $suite_head, not the pinned suite release $SUITE_TAG ($SUITE_COMMIT) — see conformance/scripts/suite-version.env" >&2 +fi + WORKDIR="${WORKDIR:-$(mktemp -d)}" mkdir -p "$WORKDIR" declare -a POLLER_PIDS=() diff --git a/conformance/scripts/suite-pinned.override.yml b/conformance/scripts/suite-pinned.override.yml new file mode 100644 index 00000000..579c963f --- /dev/null +++ b/conformance/scripts/suite-pinned.override.yml @@ -0,0 +1,20 @@ +# Compose override for the OIDF conformance suite's +# docker-compose-prebuilt.yml that runs the pinned release's images by +# digest, rather than the :latest images (built from the suite's master) +# the compose file names. Used by .github/workflows/conformance.yml and +# recommended for local runs (conformance/server/scripts/README.md). +# +# The suite release is pinned in suite-version.env (SUITE_TAG and +# SUITE_COMMIT); these are that release's images. Move all three +# together: a new release's tag, its commit, and the digest of each image +# below, as the registry reports it (docker buildx imagetools inspect +# IMAGE, which reads the registry without pulling; the digest is the +# multi-platform index's). mongo is the version the release's compose +# file names. +services: + mongodb: + image: mongo:6.0.13@sha256:b415b12f638e2685d06c58ab7fb5943577c50fadec6d9340ef67d21aeac72070 + nginx: + image: registry.gitlab.com/openid/conformance-suite/nginx:release-v5.3.5@sha256:fd5ae05bf2a8f246f600b16a198dd670051bbad44f0b59d903da6e294e02707d + server: + image: registry.gitlab.com/openid/conformance-suite:release-v5.3.5@sha256:576ad9d6ea4230a6d58623a03c17c74e2ae1438cceec252f8721daa53a705961 diff --git a/conformance/scripts/suite-version.env b/conformance/scripts/suite-version.env new file mode 100644 index 00000000..6ec78720 --- /dev/null +++ b/conformance/scripts/suite-version.env @@ -0,0 +1,13 @@ +# The OIDF conformance suite release FAPIgo's conformance runs use: +# .github/workflows/conformance.yml clones SUITE_TAG and checks it is at +# SUITE_COMMIT, and run-all.sh warns when a local suite checkout isn't. +# suite-pinned.override.yml pins the same release's images by digest. +# +# Moving the pin moves all three together: SUITE_TAG, SUITE_COMMIT and +# the image digests in suite-pinned.override.yml. The workflow's +# newer-suite job fails while a newer release is out. Review the +# release's changes first (git log OLD_TAG..NEW_TAG in a suite clone). +# +# Sourced by shell scripts, so plain NAME=value lines only. +SUITE_TAG=release-v5.3.5 +SUITE_COMMIT=246b2c14b8562012b02d0ac462d667fe49e1a937 diff --git a/conformance/server/scripts/README.md b/conformance/server/scripts/README.md index 33dd26df..427370a2 100644 --- a/conformance/server/scripts/README.md +++ b/conformance/server/scripts/README.md @@ -52,12 +52,29 @@ docker compose up -d --force-recreate 1. Run the OIDF conformance suite locally, in a directory *outside* this repo (its own git history/build artifacts, no path coupling needed — `../docker-compose.yml` only references it by Docker - network name): - `git clone https://gitlab.com/openid/conformance-suite.git`, then - `docker compose -f docker-compose-prebuilt.yml up` (uses prebuilt - images — no local Maven/Java build needed; the other - `docker-compose*.yml` files in that repo all expect you to build - `./target/fapi-test-suite.jar` yourself first). Note the Docker + network name). CI runs the suite release pinned in + [`../../scripts/suite-version.env`](../../scripts/suite-version.env) + with that release's images, so to match it: + + ``` + . /path/to/fapigo/conformance/scripts/suite-version.env + git clone --branch "$SUITE_TAG" https://gitlab.com/openid/conformance-suite.git + cd conformance-suite + docker compose -f docker-compose-prebuilt.yml \ + -f /path/to/fapigo/conformance/scripts/suite-pinned.override.yml up + ``` + + (`docker-compose-prebuilt.yml` uses prebuilt images — no local + Maven/Java build needed; the other `docker-compose*.yml` files in + that repo all expect you to build `./target/fapi-test-suite.jar` + yourself first. Without the override it runs the `:latest` images, + built from the suite's master.) `run-all.sh` warns when + `CONFORMANCE_SUITE_CHECKOUT` isn't at the pinned commit. The + workflow's `newer-suite` job fails once a newer suite release is + out; moving the pin means reviewing that release's changes, then + updating `SUITE_TAG` and `SUITE_COMMIT` in `suite-version.env` and + the image digests in `suite-pinned.override.yml` together (each + file's header says how). Note the Docker network it created: `docker network ls` (usually `_default`). It's reachable at `https://localhost.emobix.co.uk:8443`.