Skip to content

fix(deps): update module github.com/go-playground/validator/v10 to v10.30.6 #457

fix(deps): update module github.com/go-playground/validator/v10 to v10.30.6

fix(deps): update module github.com/go-playground/validator/v10 to v10.30.6 #457

Workflow file for this run

name: E2E - Full Stack
# The browser suite against a real stack: compose brings up postgres, redis,
# backend, collect, frontend and proxy, and the specs drive the interface as
# real personas signed in through the real Logto form.
#
# Not part of ci-main.yml on purpose. That workflow answers in seconds and gates
# every branch; this builds four images, boots six services and provisions a
# shared Logto tenant, so it takes minutes and mutates external state. On a pull
# request it runs only when asked, by adding the `run-e2e` label, or by itself on
# every commit of a Renovate pull request, and it reports the verdict as the
# `e2e/fullstack` commit status on the pull request's head commit. Branch protection requires that status, and e2e-gate.yml resets it on
# every push, so a pull request merges only after the suite passed on its last
# commit.
on:
# Every merge, so an interaction between pull requests merged one after the
# other is caught by the commit that completes it. Docs-only pushes are
# skipped: the job costs minutes and holds the CI tenant for all of them.
push:
branches: [ main ]
paths-ignore:
- '**.md'
- 'docs/**'
# On request only: adding `run-e2e` starts a run, and the run removes the
# label when it ends so adding it again starts another. Renovate pull
# requests need no request: their automerge waits on the status, so every
# commit Renovate opens or pushes is tested unasked. Docs-only pull requests
# are skipped, as on main: e2e-gate.yml already reports them as passing.
pull_request:
branches: [ main ]
types: [ labeled, opened, synchronize, reopened ]
paths-ignore:
- '**.md'
- 'docs/**'
workflow_dispatch:
schedule:
# Weekly drift canary: catches breakage with no commit behind it, such as a
# Logto setting changed by hand. Weekly rather than nightly — a scheduled
# failure nobody caused is the fastest way to teach people to ignore a suite.
# Off the top of the hour: GitHub delays or drops scheduled runs under load,
# and the start of each hour is when it is busiest.
- cron: '23 4 * * 1'
# One global queue, and never cancel a run past the queue: the `queue` job
# below lets a run through only once every run of this workflow started before
# it has finished.
#
# Global because every run provisions the same fixture keys, with the same
# persona emails, in the same CI tenant: `prefix` comes from authz/fixture.yml
# and has no per-run override, so two runs at once would fight over the same
# Logto users. A per-ref queue would let two pull requests collide.
#
# Never cancel past the queue because a run stopped after `authz provision`
# loses the registry recording what it created — that lives on the runner —
# leaving orgs no teardown can find, which the next provisioning trips over as
# a name collision. Waiting lets every run reach its teardown.
#
# A job rather than a workflow-level `concurrency` group: GitHub keeps at most
# one run pending per group and cancels the previously pending one, so a burst
# — Renovate opens its pull requests together, and each automerge pushes to
# main — would leave the runs in between cancelled and their status pending
# for good. The job waits on a runner instead, which costs nothing in a public
# repository.
#
# A run still waiting in the queue has touched nothing, so a newer run on the
# same branch or pull request supersedes it: the `queue` job's own concurrency
# group, per ref, cancels the older one. On main the newer commit contains the
# older, and a pull request's status is read on its head only, so nothing is
# lost; a burst of merges then costs one suite, not one per merge.
env:
GH_TOKEN: ${{ github.token }}
# Only pull_request runs report a status: the one branch protection
# requires, on the head commit rather than on GitHub's merge commit.
STATUS_CONTEXT: e2e/fullstack
STATUS_SHA: ${{ github.event.pull_request.head.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
jobs:
queue:
name: Wait for earlier runs
runs-on: ubuntu-latest
timeout-minutes: 250
# Per branch or pull request, and on this job only: a newer run on the same
# ref cancels one still waiting here, never one already provisioning. A
# scheduled or dispatched run shares main's group with the pushes to it.
concurrency:
group: ${{ github.workflow }}-queue-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# Any other label on a pull request is not a request for a run. A Renovate
# pull request needs no label, its commits start the run; `run-e2e` on one
# still asks for another.
if: >-
github.event_name != 'pull_request' ||
github.event.label.name == 'run-e2e' ||
(github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]')
permissions:
actions: read
statuses: write
pull-requests: write
steps:
- name: Refuse a pull request from a fork
# A fork gets neither the E2E_* secrets nor a token that can write a
# status. Push the branch to this repository and label that pull request.
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "::error::the browser suite runs only on branches of ${GITHUB_REPOSITORY}"
exit 1
- name: Report the run as queued on the pull request
if: github.event_name == 'pull_request'
run: |
gh api "repos/${GITHUB_REPOSITORY}/statuses/${STATUS_SHA}" \
-f state=pending -f context="$STATUS_CONTEXT" \
-f description="browser suite queued" -f target_url="$RUN_URL" > /dev/null
- name: Wait until every earlier run has finished
# Well above a Monday's worth of runs, about ten at twelve minutes each.
timeout-minutes: 240
run: |
set -uo pipefail
# Runs are ordered by when their current attempt started, not by run
# number: a re-run keeps its number but joins the back of the queue.
# Ties, possible to the second, go to the lower run id. Only queued and
# in_progress are looked up — no environment makes a run wait and no
# concurrency group holds one pending — to keep each poll at two calls,
# well inside the token's hourly budget with several runs waiting.
workflow=$(basename "${GITHUB_WORKFLOW_REF%@*}")
started=$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" --jq .run_started_at)
ahead_of_me=".workflow_runs[]
| select(.id != ${GITHUB_RUN_ID})
| select(.run_started_at < \"${started}\" or (.run_started_at == \"${started}\" and .id < ${GITHUB_RUN_ID}))
| .html_url"
while :; do
if ahead=$(for status in queued in_progress; do
gh api --paginate "repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow}/runs?status=${status}&per_page=100" \
--jq "$ahead_of_me" || exit 1
done); then
[ -z "$ahead" ] && break
echo "Waiting for:"
echo "$ahead" | sed 's/^/ /'
else
# A failed lookup says nothing about who is ahead; ask again rather than
# risk two runs sharing the tenant.
echo "::warning::could not list the runs of ${workflow}, retrying"
fi
sleep 120
done
echo "No earlier run left, starting"
- name: Report a run that never started on the pull request
if: failure() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
run: |
gh api "repos/${GITHUB_REPOSITORY}/statuses/${STATUS_SHA}" \
-f state=error -f context="$STATUS_CONTEXT" \
-f description="browser suite never started" -f target_url="$RUN_URL" > /dev/null
gh api -X DELETE "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels/run-e2e" > /dev/null 2>&1 || true
fullstack:
name: Full-stack browser suite
needs: queue
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: read
statuses: write
pull-requests: write
env:
# The only origin registered as a Logto sign-in redirect URI, which is why
# docker-compose.e2e.yml publishes the proxy there.
APP_URL: http://localhost:5173
BACKEND_URL: http://127.0.0.1:18080/api
steps:
- name: Report the run on the pull request
if: github.event_name == 'pull_request'
run: |
gh api "repos/${GITHUB_REPOSITORY}/statuses/${STATUS_SHA}" \
-f state=pending -f context="$STATUS_CONTEXT" \
-f description="browser suite running" -f target_url="$RUN_URL" > /dev/null
- uses: actions/checkout@v7
- name: Check the tested commit is the one the status lands on
if: github.event_name == 'pull_request'
run: |
set -euo pipefail
# GitHub's merge commit has main as first parent and the pull request
# head as second. A push while the run was queued would make it merge
# a newer head than the one the status is written on. Parents
# are read from the object itself: the clone is shallow.
merged=$(git cat-file -p HEAD | awk '/^parent / { print $2 }' | sed -n 2p)
if [ "$merged" != "$STATUS_SHA" ]; then
echo "::error::merge commit tests ${merged:-nothing}, the pull request head is ${STATUS_SHA}"
exit 1
fi
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.27'
cache: false
- name: Write service configuration
env:
LOGTO_TENANT_ID: ${{ secrets.E2E_LOGTO_TENANT_ID }}
LOGTO_TENANT_DOMAIN: ${{ secrets.E2E_LOGTO_TENANT_DOMAIN }}
LOGTO_BACKEND_APP_ID: ${{ secrets.E2E_LOGTO_BACKEND_APP_ID }}
LOGTO_BACKEND_APP_SECRET: ${{ secrets.E2E_LOGTO_BACKEND_APP_SECRET }}
JWT_SECRET: ${{ secrets.E2E_JWT_SECRET }}
LOGTO_ENDPOINT: ${{ secrets.E2E_LOGTO_ENDPOINT }}
LOGTO_APP_ID: ${{ secrets.E2E_LOGTO_APP_ID }}
LOGTO_API_RESOURCE: ${{ secrets.E2E_LOGTO_API_RESOURCE }}
run: |
set -euo pipefail
# Compose overrides DATABASE_URL and REDIS_URL itself; these files carry
# the identity provider configuration and the signing key.
#
# Deliberately no SMTP_*: creating a user makes the backend send a
# welcome email with a temporary password, and the users spec creates
# one per run. With no relay configured nothing is sent. Do not add
# SMTP secrets to this job.
cat > backend/.env <<EOF
LOGTO_TENANT_ID=${LOGTO_TENANT_ID}
LOGTO_TENANT_DOMAIN=${LOGTO_TENANT_DOMAIN}
LOGTO_BACKEND_APP_ID=${LOGTO_BACKEND_APP_ID}
LOGTO_BACKEND_APP_SECRET=${LOGTO_BACKEND_APP_SECRET}
LOGTO_API_RESOURCE=${LOGTO_API_RESOURCE}
LOGTO_FRONTEND_APP_ID=${LOGTO_APP_ID}
JWT_SECRET=${JWT_SECRET}
APP_URL=${APP_URL}
API_BASE_URL=/api
EOF
cp backend/.env collect/.env
# Consumed by the frontend image build. Secrets reach the script
# through env: above rather than being interpolated into it, so none of
# them is ever part of the workflow body GitHub renders.
cat > .env <<EOF
VITE_LOGTO_ENDPOINT=${LOGTO_ENDPOINT}
VITE_LOGTO_APP_ID=${LOGTO_APP_ID}
VITE_LOGTO_API_RESOURCE=${LOGTO_API_RESOURCE}
EOF
- name: Start the stack
run: |
docker compose -f docker-compose.yml -f docker-compose.e2e.yml up -d --build
- name: Wait for the stack to be ready
run: |
set -euo pipefail
for name in "backend ${BACKEND_URL}/health" "frontend ${APP_URL}/"; do
set -- $name
echo "Waiting for $1 at $2"
for attempt in $(seq 1 60); do
if curl -fsS -o /dev/null "$2"; then
echo " $1 is up"
break
fi
if [ "$attempt" -eq 60 ]; then
echo "::error::$1 did not come up at $2"
docker compose -f docker-compose.yml -f docker-compose.e2e.yml logs --tail=100
exit 1
fi
sleep 5
done
done
- name: Supply the RBAC vocabulary
run: |
# sync/configs/*.yml is gitignored (the per-environment files carry
# tenant ids and SMTP credentials), so a fresh checkout has no
# config.yml — and `apitool authz provision` reads the role vocabulary
# from it. config.ci.yml is tracked for exactly this: the same roles,
# permissions and resources as the deployed tenants, and nothing else.
cp sync/configs/config.ci.yml sync/configs/config.yml
- name: Put the RBAC vocabulary in the tenant
env:
LOGTO_TENANT_ID: ${{ secrets.E2E_LOGTO_TENANT_ID }}
LOGTO_BACKEND_APP_ID: ${{ secrets.E2E_LOGTO_BACKEND_APP_ID }}
LOGTO_BACKEND_APP_SECRET: ${{ secrets.E2E_LOGTO_BACKEND_APP_SECRET }}
LOGTO_API_RESOURCE: ${{ secrets.E2E_LOGTO_API_RESOURCE }}
working-directory: sync
run: |
set -euo pipefail
# The API resource the whole run is bound to has to exist in the
# tenant: Logto refuses an authorization request that names an unknown
# resource, and that refusal only surfaces later as a missing
# interaction session. `sync` names each resource
# {API_BASE_URL}/{container} and the vocabulary has one container,
# "permissions", so API_BASE_URL is the indicator minus that suffix.
case "${LOGTO_API_RESOURCE}" in
*/permissions) ;;
*) echo "::error::E2E_LOGTO_API_RESOURCE must end in /permissions"; exit 1 ;;
esac
export API_BASE_URL="${LOGTO_API_RESOURCE%/permissions}"
# No --cleanup: it deletes whatever the config does not define, and
# this tenant also carries the applications the suite signs in with.
make build
./build/sync sync -c configs/config.yml
- name: Provision the persona fixture
env:
OWNER_EMAIL: ${{ secrets.E2E_OWNER_EMAIL }}
OWNER_PASSWORD: ${{ secrets.E2E_OWNER_PASSWORD }}
LOGTO_ENDPOINT: ${{ secrets.E2E_LOGTO_ENDPOINT }}
LOGTO_APP_ID: ${{ secrets.E2E_LOGTO_APP_ID }}
LOGTO_API_RESOURCE: ${{ secrets.E2E_LOGTO_API_RESOURCE }}
working-directory: backend
run: |
set -euo pipefail
make apitool
# `apitool init` is interactive, so write the registry directly. Only
# the configuration and owner credentials are needed; `authz provision`
# fills in the organizations, personas and their generated passwords.
jq -n \
--arg endpoint "${LOGTO_ENDPOINT}" \
--arg appId "${LOGTO_APP_ID}" \
--arg resource "${LOGTO_API_RESOURCE}" \
--arg authBase "${APP_URL}" \
--arg backend "${BACKEND_URL}" \
--arg email "${OWNER_EMAIL}" \
--arg password "${OWNER_PASSWORD}" \
'{config: {logto_endpoint: $endpoint, logto_app_id: $appId, logto_resource: $resource, auth_base_url: $authBase, backend_url: $backend},
owner: {email: $email, password: $password},
orgs: {}, users: {}}' > .api-registry.json
chmod 600 .api-registry.json
./apitool authz provision
- name: Install browser suite dependencies
working-directory: frontend
run: |
npm ci
npx playwright install --with-deps chromium
- name: Run the suite
working-directory: frontend
# No base URL to pass: the suite is pinned to 5173, and `webServer` reuses
# what compose already publishes there rather than starting a dev server.
run: npx playwright test --project=fullstack
# The repository is public, so the artifact is readable by anyone signed
# in to GitHub. The script reads the passwords from the registry, still in
# place here: the fixture is removed only after the upload.
- name: Check the report carries no password
id: redaction
if: always()
working-directory: frontend
run: bash e2e/check-no-passwords.sh
- name: Upload report, screenshots, video and traces
if: always() && steps.redaction.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: |
frontend/playwright-report/
frontend/test-results/
retention-days: 30
- name: Remove the fixture from the tenant
if: always()
working-directory: backend
run: |
# The specs clean up after themselves; this removes the persona fixture,
# so a failed run never leaves organizations or users behind.
./apitool authz teardown --yes || echo "::warning::teardown failed, check the tenant for authz-* leftovers"
- name: Stop the stack
if: always()
run: |
docker compose -f docker-compose.yml -f docker-compose.e2e.yml logs --tail=200 || true
docker compose -f docker-compose.yml -f docker-compose.e2e.yml down -v
- name: Report the verdict on the pull request
if: always() && github.event_name == 'pull_request'
env:
JOB_STATUS: ${{ job.status }}
run: |
case "$JOB_STATUS" in
success) state=success; description="browser suite passed" ;;
failure) state=failure; description="browser suite failed" ;;
*) state=error; description="browser suite ${JOB_STATUS}" ;;
esac
gh api "repos/${GITHUB_REPOSITORY}/statuses/${STATUS_SHA}" \
-f state="$state" -f context="$STATUS_CONTEXT" \
-f description="$description" -f target_url="$RUN_URL" > /dev/null
# So that adding the label again asks for another run.
gh api -X DELETE "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/labels/run-e2e" > /dev/null 2>&1 || true