diff --git a/.github/workflows/README.md b/.github/workflows/README.md index e07b082b49..1c013893f4 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -266,10 +266,17 @@ the other entry points take the defaults. flowchart TB prclose["pull_request_target: closed, converted_to_draft"] --> eprcancel["entry-pr-closed-cancel-workflows.yml"] branchdelete["delete: branch"] --> delbranch["entry-delete-branch.yml"] + newcommit["push (not main) / pull_request_target: opened, synchronize, reopened, ready_for_review, labeled"] --> superseded["entry-cancel-superseded.yml"] eprcancel -.->|"cancels concurrency group"| runningci["running entry + child workflow runs"] delbranch -.->|"cancels concurrency group"| runningci + superseded -.->|"cancels via API what the group left behind"| runningci ``` +The concurrency group stays the primary mechanism; it reaps within seconds of a +run being created and needs no runner. `entry-cancel-superseded.yml` is the +fallback for the case where it does not, and carries no group of its own, +because the run holding a group cannot be the run that frees it. + ## Scheduled and standalone ```mermaid diff --git a/.github/workflows/call-orchestrator.yml b/.github/workflows/call-orchestrator.yml index 72ec5338c2..be528068fd 100644 --- a/.github/workflows/call-orchestrator.yml +++ b/.github/workflows/call-orchestrator.yml @@ -87,15 +87,10 @@ on: required: false type: boolean default: false - force_cancel_in_progress: - description: "When true, a new run always cancels the running orchestrator on the same ref, ignoring the CI_CANCEL_IN_PROGRESS repository variable." - required: false - type: boolean - default: false concurrency: group: infinito-test-${{ github.ref }} - cancel-in-progress: ${{ inputs.force_cancel_in_progress || vars.CI_CANCEL_IN_PROGRESS != 'false' }} + cancel-in-progress: ${{ github.event_name == 'workflow_dispatch' || github.ref != 'refs/heads/main' }} permissions: actions: read diff --git a/.github/workflows/entry-cancel-superseded.yml b/.github/workflows/entry-cancel-superseded.yml new file mode 100644 index 0000000000..c0f789cc82 --- /dev/null +++ b/.github/workflows/entry-cancel-superseded.yml @@ -0,0 +1,76 @@ +# Deliberately without a `concurrency:` block: this workflow frees the very +# groups that block other runs, so a group of its own would deadlock it. + +name: "๐Ÿšซ Cancel: Superseded Runs" + +on: + push: + branches: + - "feature/**" + - "hotfix/**" + - "fix/**" + - "update/**" + - "chore/**" + - "alert-autofix-*" + pull_request_target: + types: + - opened + - synchronize + - reopened + - ready_for_review + - labeled + +permissions: + contents: read + +jobs: + cancel-branch-runs: + name: ๐Ÿšซ Cancel superseded branch runs + if: ${{ github.event_name == 'push' && github.ref_name != 'main' }} + runs-on: ubuntu-latest + permissions: + actions: write + contents: read + steps: + - name: โฌ‡๏ธ Checkout repository + uses: actions/checkout@v7.0.0 + + - name: ๐Ÿšซ Cancel branch runs superseded by a newer one + shell: bash + env: + BRANCH: ${{ github.ref_name }} + CURRENT_RUN_ID: ${{ github.run_id }} + KEEP_NEWEST_PER: all + FORCE_CANCEL_AFTER_SECONDS: "60" + INCLUDE_PATHS: | + .github/workflows/entry-push-latest.yml + .github/workflows/entry-manual-steer.yml + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPOSITORY: ${{ github.repository }} + run: bash scripts/github/cancel/branch_runs.sh + + cancel-pull-request-runs: + name: ๐Ÿšซ Cancel superseded pull request runs + if: ${{ github.event_name == 'pull_request_target' }} + runs-on: ubuntu-latest + permissions: + actions: write + contents: read + pull-requests: read + steps: + - name: โฌ‡๏ธ Checkout repository + uses: actions/checkout@v7.0.0 + + - name: ๐Ÿšซ Cancel pull request runs superseded by a newer one + shell: bash + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} + PR_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }} + CURRENT_RUN_ID: ${{ github.run_id }} + KEEP_NEWEST_PER: event + FORCE_CANCEL_AFTER_SECONDS: "60" + INCLUDE_PATHS: .github/workflows/entry-pr-change-orchestrate.yml + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPOSITORY: ${{ github.repository }} + run: bash scripts/github/cancel/pull_request_runs.sh diff --git a/.github/workflows/entry-delete-branch.yml b/.github/workflows/entry-delete-branch.yml index 080b2b3234..66f1f9e538 100644 --- a/.github/workflows/entry-delete-branch.yml +++ b/.github/workflows/entry-delete-branch.yml @@ -32,4 +32,4 @@ jobs: BRANCH: ${{ github.event.ref }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} REPOSITORY: ${{ github.repository }} - run: bash scripts/github/cancel/deleted_branch_runs.sh + run: bash scripts/github/cancel/branch_runs.sh diff --git a/.github/workflows/entry-manual-steer.yml b/.github/workflows/entry-manual-steer.yml index b3e261655c..af8ab6b095 100644 --- a/.github/workflows/entry-manual-steer.yml +++ b/.github/workflows/entry-manual-steer.yml @@ -123,5 +123,4 @@ jobs: workspace_track: ${{ inputs.workspace_track }} instructions: ${{ inputs.instructions }} tor: ${{ inputs.tor }} - force_cancel_in_progress: true secrets: inherit diff --git a/.github/workflows/entry-pr-closed-cancel-workflows.yml b/.github/workflows/entry-pr-closed-cancel-workflows.yml index 029568fc84..2fa6071c79 100644 --- a/.github/workflows/entry-pr-closed-cancel-workflows.yml +++ b/.github/workflows/entry-pr-closed-cancel-workflows.yml @@ -13,6 +13,7 @@ concurrency: permissions: actions: write contents: read + pull-requests: read jobs: cancel-pr-runs: diff --git a/.github/workflows/entry-push-latest.yml b/.github/workflows/entry-push-latest.yml index 0065fa6b76..171be265b0 100644 --- a/.github/workflows/entry-push-latest.yml +++ b/.github/workflows/entry-push-latest.yml @@ -2,7 +2,7 @@ name: "๐Ÿ“ค Push" concurrency: group: global-ci-${{ github.repository }}-${{ github.ref_name }} - cancel-in-progress: ${{ vars.CI_CANCEL_IN_PROGRESS != 'false' }} + cancel-in-progress: ${{ github.ref_name != 'main' }} on: push: diff --git a/CHANGELOG.md b/CHANGELOG.md index db1af5103b..3ccaf1302e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,152 @@ # Changelog +## [13.0.0] - 2026-08-26 + +* **Tor as a first-class deployment axis.** The new *svc-net-tor* role routes onion + names through Tor via DNS instead of per-app proxies, offers a chutney flavor for + private-net test deployments, and ties its dnsmasq listener to ownership rather than + the deploy mode. Applications follow: server-side OIDC discovery and token exchange + reach plaintext onion issuers through the SOCKS proxy (WordPress, Joomla, PeerTube, + Mobilizon, EspoCRM, Nextcloud), session cookies drop the *Secure* flag where an onion + cannot carry it (Taiga, Pixelfed, Joomla), and mail authenticates on the submission + port the onion relay actually serves. The deploy matrix gained a tor axis with an + onion marker plus enforced and exclusive modes, and lint now requires the onion in + every variant. See the [svc-net-tor](roles/svc-net-tor/README.md) README. + +* **Single sign-on across protocols and domains.** Keycloak imports a SAML client for + every app that asks for one; SuiteCRM authenticates against it via SAML instead of a + proxy, and Shopware provisions its admin through AdminOpenAuth with the front and + back channel split. Sessions are shared across app domains, the issuer is pinned to + the canonical OIDC URL, each consumer's redirect scheme resolves on its own side, and + the logout sweep runs where the visitor is looking. Directory users are read through + one lookup so seeding cannot diverge. + +* **One CI chain instead of four workflows.** The deploy workflows collapse into a + single chunk chain gated by one validation job, with every variant getting its own + row and rotating distro, filesystem and tor axes. Selection tokens pin deploy axes, + retriggers reproduce the exact selection of the source run in every mode, and the + regular line resumes where the source stopped. Fork code no longer runs with the base + repository token, workflow tokens are scoped to the jobs that need them, superseded + runs are force-cancelled, and a mid-run budget SIGKILL is counted as skipped rather + than green. Apt call sites are bounded so a stalled mirror cannot burn a job budget. + +* **Restore verified against real dumps.** The *recover* CLI replays a generation's + database and cluster dumps, reads the generation's own layout instead of guessing it, + and places each dump by the engine the backup observed rather than by name alone. The + *svc-bkp-volume-2-local* drill now empties every volume it claims to test, fails on a + database that was never dumped, and stops the backup timers before it goes + destructive. Baudolo is pinned per host, its contract read from baudolo itself. + +* **A probe for every container.** Health checks are composed from prefixes and are + mandatory: every declared image either carries a probe or states why it cannot have + one, enforced from both sides. Probes hit the port the container actually binds, no + longer derive an HTTP Host from a kernel hostname, and are defined once instead of per + proxy. Rescue diagnostics pin the dnsmasq listener loss to its moment, sample what the + resolver answers rather than just its socket, probe the daemon.json upstreams, and + record the whole boot instead of the last 10 000 lines. + +* **Single points of truth, enforced by lint.** The new *sys-lint* role pins the + GitHub-release lint tools. Every mount target has one spot in *meta/volumes.yml* and + container paths are derived from it, *default.env* is the enforced source of the + primary domain, *container_backup* is rejected where no volume exists, and role + credentials live at *meta/secrets.yml*. Linters no longer read gitignored build + output, comments are checked in every file rather than only changed ones, and every + shipped script requires a mirrored unit test. + +* **Tests in every language the project ships.** The quality gate parses each shipped + language and runs its unit suite; the PHP and Ruby interpreters are baked into the + image, and the JavaScript, PHP and Ruby suites are reported in the CI summary + alongside Python. Playwright stages the persona flows once per run and mounts them + read-only, and the workspace environment suite splits into base, compose and swarm + tracks. + +* **Swarm and proxy operation.** Convergence gates read one budget sized for a real + stack, print every task row when a stack fails to converge, and give up on a terminal + task; the deployment mode a stack was deployed with is resolved instead of assumed. + OpenResty reloads a vhost, lua or redirect config instead of redeploying the task. + GitLab ships its config trees as swarm configs rather than host binds, and role + templates expand through a lookup instead of inline Jinja. + +* **New and reshaped roles.** *sys-svc-nss* is split out of *sys-hostname*, + *web-svc-mirror* serves frontend assets as a privacy proxy, PeerTube becomes + clearnet-only, and roles that could not run were deleted rather than repaired. CLI + tools install via pip instead of pkgmgr. + +* **Image and dependency version jumps (net since 12.0.0):** + + *Applications* + * *web-app-erpnext*: v16.26.2 to v16.32.3 + * *web-app-gitlab*: v19.1.2 to v19.3.0 (all six CNG component images) + * *web-app-semaphore*: v2.18.25 to v2.19.8 + * *web-app-nextcloud*: PHP 33-fpm-alpine to 34-fpm-alpine, nginx 1.31.2 to 1.31.3 + * *web-app-shopware*: 6.7.8.2 to 6.7.13.0, OpenSearch 3.7.0 to 3.8.0 + * *web-app-matomo*: 5.11.2 to 5.13.0 + * *web-app-matrix*: Synapse v1.156.0 to v1.159.0, Element v1.12.23 to v1.12.26 + * *web-app-mattermost*: 11.9.0 to 11.10.1 + * *web-app-keycloak*: 26.7.0 to 26.7.2, oauth2-proxy v7.15.3 to v7.15.4 + * *web-app-gitea*: 1.26.4 to 1.27.2 + * *web-app-funkwhale*: 2.0.6 to 2.0.9 (api and front) + * *web-app-penpot*: 2.16.2 to 2.17.1 (frontend, backend, exporter) + * *web-app-espocrm*: 10.0.2 to 10.0.6 + * *web-app-opencloud*: 7.2.1 to 7.2.4 + * *web-app-seaweedfs*: 4.39 to 4.44 + * *web-app-snipe-it*: v8.6.3-alpine to v8.7.2-alpine + * *web-app-wordpress*: 7.0.1 to 7.1.0 + * *web-app-peertube*: v8.2.2 to v8.2.4 + * *web-app-joomla*: 6.1.2-php8.3-apache to 6.1.3-php8.3-apache + * *web-app-jira*: 11.3.8 to 11.3.10 + * *web-app-confluence*: 10.2.14 to 10.2.15 + * *web-app-baserow*: 2.3.1 to 2.3.3 + * *web-app-flowise*: 3.1.3 to 3.1.4 + * *web-app-mailu*: 1.5.3 to 1.5.4 + * *web-app-pgadmin*: 9.16 to 9.17 + * *web-app-prometheus*: Prometheus v3.13.1 to v3.14.0, Alertmanager v0.33.1 to + v0.34.0, node-exporter v1.12.0 to v1.12.1 + * *web-app-opentalk*: LiveKit v1.13.3 to v1.13.5, RabbitMQ 4.3.2 to 4.3.4; the + frontend (v2.9.0), controller (v0.34.1) and recorder (v0.16.2) stay pinned until + the set is released as a bundle and *recorder.toml* is migrated + * *web-app-magento*: OpenSearch 3.7.0 to 3.8.0; PHP held at 8.4-fpm and MariaDB at + 11.4, both deliberately fenced against the image bot + * *web-app-socialhome*: newly pinned to 2026.6.16 + * *web-app-bluesky* and *web-app-bridgy-fed*: upstream git refs pinned to commits + + *Services and infrastructure* + * *svc-ai-ollama*: 0.31.2 to 0.32.15 + * *svc-db-elasticsearch*: 9.4.3 to 9.5.2 + * *svc-db-qdrant*: v1.18.2 to v1.19.0 + * *svc-runner*: Ubuntu 24.04 to 26.04 + * *sys-ctl-hlth-csp*: 2.1.2 to 2.2.1 + * *web-svc-coturn*: 4.14.0 to 4.17.2 + * *web-svc-logout*: *latest* to universal-logout v1.3.1 + * *web-svc-xmpp*: 26.04 to 26.07 + * *test-e2e-playwright*: v1.61.1-noble to v1.62.1-noble + * *svc-net-tor*: newly on debian trixie-slim + * *svc-bkp-volume-2-local*: newly on alpine 3.24 + + *Toolchain and dependencies* + * *backup-docker-to-local* (*baudolo*): pinned to 7.0.1, via 6.0.0 and 7.0.0 + * *ruff*: 0.16.0 to 0.16.4 + * *@playwright/test*: ^1.61.1 to ^1.62.1 + * *eslint*: ^10.6.0 to ^10.9.0, *globals*: ^17.7.0 to ^17.9.0 + * *stylelint*: ^16.0.0 added + * *brace-expansion*: overridden to ^5.0.9, past three DoS advisories + * *keycloak-js*: 24.0.5 to 26.2.4, loaded as an ES module + * *bootstrap*: 5.3.3 to 5.3.8, *@fortawesome/fontawesome-free*: 6.5.1 to 7.3.1 + * *roles/sys-lint* pins the GitHub-release tools: actionlint v1.7.12, + hadolint v2.15.1, shfmt v3.13.1 + +**Renamed** + +* Role credential declarations move from *meta/credentials.yml* to *meta/secrets.yml*, + addressed at *secrets.credentials* like every other meta file. +* The NSS half of *sys-hostname* becomes its own role, *sys-svc-nss*. + +**Contributors** + +* [Kevin Veen-Birkenbach](https://veen.world): Tor deployment axis, SAML and + cross-domain SSO, CI chunk chain, generation-level recovery, health-check and + lint enforcement, multi-language test suites + ## [12.0.0] - 2026-08-08 * **Docker Swarm as a second deployment mode.** Roles can now be deployed across diff --git a/docs/contributing/actions/testing/suppression.md b/docs/contributing/actions/testing/suppression.md index 51ac914e07..f55f3fd857 100644 --- a/docs/contributing/actions/testing/suppression.md +++ b/docs/contributing/actions/testing/suppression.md @@ -99,6 +99,7 @@ The placement rule is per check. The catalog "Position" column uses these labels | `image-healthcheck` | same or above the service key | [test_image_healthcheck_declared.py](../../../../tests/integration/roles/test_image_healthcheck_declared.py) | Allows a `roles/*/meta/services.yml` entry whose image ships no `HEALTHCHECK` to declare none either. Default path: add `healthcheck:` to the entry, because a container without a probe counts as healthy the moment its process starts โ€” which is how a service that came back empty passes a restore drill. Reserved for containers nothing can probe: a one-shot process that exits, or an image with neither a port nor a shell. | | `csp-unsafe` | same line | [test_csp_unsafe_requires_justification.py](../../../../tests/lint/ansible/roles/meta/test_csp_unsafe_requires_justification.py) | Documents an `unsafe-*: true` flag in `roles/*/meta/csp.yml`. MUST be paired with a `Reason:` on the same line naming what breaks without the relaxation. `unsafe-inline` re-admits the inline execution an XSS needs and `unsafe-eval` re-admits string-to-code, so the flag has to be verified against the running app, not copied from another role. | | `min-storage-headroom` | same line OR comment block above key | [test_min_storage_headroom.py](../../../../tests/external/update/docker/test_min_storage_headroom.py) | Allows a `roles/*/meta/services.yml` `min_storage` to exceed the measured compressed size of its own `image:`/`version:` by more than 1 GB. MUST be paired with a `Reason:` on the same comment line naming what occupies the space. Reserved for services whose data volume genuinely dominates the footprint; the default path is to lower the value, because an over-declared budget makes a host look too small and prunes a cache the deploy did not need to lose. | +| `galaxy-git-parity` | same or above | [test_galaxy_entries_have_git_source.py](../../../../tests/lint/repository/dependencies/test_galaxy_entries_have_git_source.py) | Exempts a `requirements/requirements.galaxy.yml` collection from the requirement to also carry a `type: git` entry in `requirements/requirements.git.yml`. Reserved for collections that publish no usable git remote; without the git entry a `galaxy.ansible.com` outage fails `make install`, because the fallback in `scripts/install/ansible.sh` cannot resolve the collection either. | ## Tool-Native `noqa` Codes ๐Ÿงน diff --git a/docs/contributing/artefact/files/github/workflow.md b/docs/contributing/artefact/files/github/workflow.md index 74548db793..383e8e7961 100644 --- a/docs/contributing/artefact/files/github/workflow.md +++ b/docs/contributing/artefact/files/github/workflow.md @@ -26,7 +26,7 @@ Every workflow MUST follow the schema `"[Emoji] Category: Subject (Qualifier)"`, | `๐Ÿ”’` | Scan | Security scanning | | `โšก` | CI | CI entry points (push, pull request, manual) | | `๐ŸŽต` | CI | CI orchestration and coordination workflows | -| `๐Ÿšซ` | Cancel | Run cancellation on PR close or branch delete | +| `๐Ÿšซ` | Cancel | Run cancellation on PR close, branch delete, or a superseding commit | | `๐Ÿงช` | Test | Code tests (unit, integration, lint) | | `๐Ÿ’ป` | Test | Development environment tests | | `๐Ÿ’ฌ` | Test | DNS and network resolution tests | diff --git a/docs/contributing/artefact/git/pipeline.md b/docs/contributing/artefact/git/pipeline.md index 97d81cff1b..e5d8a4f3d2 100644 --- a/docs/contributing/artefact/git/pipeline.md +++ b/docs/contributing/artefact/git/pipeline.md @@ -126,9 +126,9 @@ The final `done` job aggregates all deploy, install, and development gates. CI i ## Concurrency ๐Ÿ”€ -- PR pipelines use `cancel-in-progress: true` so only the newest run per PR and event type is active. -- The orchestrator and the push entry workflow (`entry-push-latest.yml`) default to `cancel-in-progress: true` and both respect the repository variable `CI_CANCEL_IN_PROGRESS`. -- The manual entry workflow (`entry-manual-steer.yml`) sets `cancel-in-progress: true` on its own group and passes `force_cancel_in_progress: true` into the orchestrator, so a manual run cancels on both levels regardless of `CI_CANCEL_IN_PROGRESS`. +- PR pipelines use `cancel-in-progress: true` so only the newest run per PR and event type is active. The group does not always reap a long orchestrator sweep, which then leaves the newer run parked on `pending`; [entry-cancel-superseded.yml](../../../../.github/workflows/entry-cancel-superseded.yml) cancels those leftovers through the API, see [cancel/README.md](../../../../scripts/github/cancel/README.md). +- The orchestrator and the push entry workflow (`entry-push-latest.yml`) cancel in-progress runs on every ref except `main`, which no automatic trigger cancels. A `pull_request_target` run inherits `refs/heads/main` as its ref, so the orchestrator does not cancel there either; per-PR supersession is handled by the entry workflow's own `pr-ci-*` group. See [configuration.md](../../tools/github/actions/configuration.md). +- The manual entry workflow (`entry-manual-steer.yml`) sets `cancel-in-progress: true` on its own group, and the orchestrator's group cancels for `workflow_dispatch` regardless of ref, so a manual sweep supersedes on both levels, `main` included. See [configuration.md](../../tools/github/actions/configuration.md) for all repository variables that control CI behaviour. diff --git a/docs/contributing/tools/agents/cheatsheet.md b/docs/contributing/tools/agents/cheatsheet.md index 6e4e9dfdbd..9ebae273cd 100644 --- a/docs/contributing/tools/agents/cheatsheet.md +++ b/docs/contributing/tools/agents/cheatsheet.md @@ -25,6 +25,7 @@ from its procedure file. Run `make install-skills` to (re)install them. | Writing or updating a Playwright spec for a `web-*` role | `i8-iterate-playwright` | | Running or validating tests for a specific scope | `i8-test` | | Running the quality gate (`make quality`) to green | `i8-quality` | +| Running the full gate (`make quality-high`: quality plus every lint) to green | `i8-quality-high` | | Cleaning up code, docs, or roles after a change | `i8-refactor` | | Checking a branch out into a parallel worktree | `i8-worktree-create` | | Releasing a parallel worktree and its slot | `i8-worktree-down` | diff --git a/docs/contributing/tools/github/actions/configuration.md b/docs/contributing/tools/github/actions/configuration.md index 5f641f3ab3..e6d8cd29e8 100644 --- a/docs/contributing/tools/github/actions/configuration.md +++ b/docs/contributing/tools/github/actions/configuration.md @@ -8,43 +8,26 @@ Repository variables are set under **Settings โ†’ Secrets and variables โ†’ Acti | Variable | Workflow | Default (unset) | Set to activate | |---|---|---|---| -| `CI_CANCEL_IN_PROGRESS` | [entry-push-latest.yml](../../../../../.github/workflows/entry-push-latest.yml), [call-orchestrator.yml](../../../../../.github/workflows/call-orchestrator.yml) | Cancels in-progress runs on new push | `false` to keep in-progress runs alive | | `CI_SYNC_MAIN_SOURCE_REPOSITORY` | [entry-push-latest.yml](../../../../../.github/workflows/entry-push-latest.yml) | Syncs `main` from `infinito-nexus/core` before CI scope discovery | `/` to use another source, or `false`, empty, or the current repository to skip | | `CI_RUN_ON_MAIN` | [entry-push-latest.yml](../../../../../.github/workflows/entry-push-latest.yml) | Pushes to `main` skip CI | `true` to run CI on `main` pushes too | | `CI_ENABLE_AUTO_UPDATES` | [cron-update.yml](../../../../../.github/workflows/cron-update.yml), [entry-pr-open-dependabot-close.yml](../../../../../.github/workflows/entry-pr-open-dependabot-close.yml) | Update jobs skipped; Dependabot PRs auto-closed | `true` to allow update PRs (workflow-driven and Dependabot) | | `INFINITO_PLAYWRIGHT_KEEP` | [call-test-deploy.yml](../../../../../.github/workflows/call-test-deploy.yml) | Playwright keeps trace, screenshot and video only when a test fails | `true` to keep them for every test (passing runs included) | -## `CI_CANCEL_IN_PROGRESS` ๐Ÿ›‘ +## Cancelling in-progress runs ๐Ÿ›‘ -Controls whether a new run cancels an already-running CI pipeline on the same ref. Applies to the push entry workflow and to the orchestrator's own concurrency group, which every entry workflow shares. The manual entry workflow overrides the variable on both levels: its own group is `cancel-in-progress: true`, and it passes `force_cancel_in_progress: true` into the orchestrator. - -**Default behaviour (variable not set or set to any value other than `false`):** -In-progress runs are cancelled when a new push arrives. This is the recommended setting for most workflows. - -**To disable cancellation:** - -1. Open the repository on GitHub. -2. Go to **Settings โ†’ Secrets and variables โ†’ Actions**. -3. Switch to the **Variables** tab. -4. Click **New repository variable**. -5. Set **Name** to `CI_CANCEL_IN_PROGRESS` and **Value** to `false`. -6. Save. - -**To re-enable cancellation:** - -Delete the variable or change its value to anything other than `false` (e.g. `true`). - -**How it works:** +Not a variable: cancellation is derived from the trigger. Every automatic run on a branch other than `main` is cancelled by a newer run in the same concurrency group; automatic runs on `main` are not, because a half-finished pipeline on the default branch is worse than a queued one. A manual dispatch always supersedes, `main` included: someone typed it, so it is the intent that counts, not the ref. ```yaml -cancel-in-progress: ${{ vars.CI_CANCEL_IN_PROGRESS != 'false' }} +cancel-in-progress: ${{ github.ref_name != 'main' }} ``` -| Variable value | Expression result | Behaviour | -|---|---|---| -| *(not set / empty)* | `'' != 'false'` โ†’ `true` | Cancels in-progress runs โœ“ | -| `false` | `'false' != 'false'` โ†’ `false` | Does **not** cancel โœ“ | -| `true` | `'true' != 'false'` โ†’ `true` | Cancels in-progress runs โœ“ | +`entry-push-latest.yml` declares exactly that expression, and it fires only on `push`, where `github.ref_name` is always the pushed branch. [entry-cancel-superseded.yml](../../../../../.github/workflows/entry-cancel-superseded.yml) carries no concurrency group of its own โ€” it is the API fallback for that group โ€” but its push job repeats the same predicate as a job `if`, so it never touches `main` either. + +> โš ๏ธ **Do not paste that expression into a workflow that listens on `pull_request_target`.** There `github.ref` is the *base* branch, so `github.ref_name` is literally `main` and the rule collapses to a constant `false` โ€” every pull request would stop cancelling its predecessor. `entry-pr-change-orchestrate.yml` therefore declares `cancel-in-progress: true` outright. + +[call-orchestrator.yml](../../../../../.github/workflows/call-orchestrator.yml) compares `github.ref` for the same reason: a called workflow inherits the caller's ref, which is `refs/pull//merge` for a `pull_request` caller but `refs/heads/main` for a `pull_request_target` one. The `ci-orchestrator` job of `entry-pr-change-orchestrate.yml` is fenced to `github.event_name == 'pull_request'`, so the ref the orchestrator sees from that caller is always the merge ref; widening that fence would silently put fork runs into main's group. + +`entry-manual-steer.yml` declares `cancel-in-progress: true` outright on its own group, and the orchestrator reads `github.event_name` โ€” which a called workflow inherits from its caller โ€” so a manual sweep supersedes on both levels without an input to pass down. ## `CI_SYNC_MAIN_SOURCE_REPOSITORY` ๐Ÿ”„ diff --git a/docs/contributing/tools/github/actions/workflows.md b/docs/contributing/tools/github/actions/workflows.md index 47e41226f4..ad9c4ff858 100644 --- a/docs/contributing/tools/github/actions/workflows.md +++ b/docs/contributing/tools/github/actions/workflows.md @@ -26,8 +26,9 @@ Trigger column legend: **auto** = fires automatically (push, pull_request, sched | Workflow | Description | Trigger | Inputs | |---|---|---|---| | [entry-pr-change-orchestrate.yml](../../../../../.github/workflows/entry-pr-change-orchestrate.yml): `๐Ÿ”€ Pull Request` | Detects PR scope from changed files + branch prefix, then conditionally calls the orchestrator. A maintainer `๐Ÿ›ก๏ธ Trusted` label builds the privileged images from the PR head โ€” see [pipeline.md](../../../artefact/git/pipeline.md#trusted-fork-prs-). A `๐Ÿงฉ Subset` label pins the deploy matrix to the roles listed in the PR body โ€” see [pipeline.md](../../../artefact/git/pipeline.md#subset-label-). | auto (`pull_request` & `pull_request_target`: opened, synchronize, reopened, ready_for_review, labeled) | none | -| [entry-push-latest.yml](../../../../../.github/workflows/entry-push-latest.yml): `๐Ÿ“ค Push` | Syncs `main` from the configured source repository, then runs the orchestrator on pushes to `main`, `feature/**`, `hotfix/**`, `fix/**`, `chore/**`, `alert-autofix-*`; on tagged `main` it also calls `call-release-version.yml`. Respects the `CI_CANCEL_IN_PROGRESS`, `CI_SYNC_MAIN_SOURCE_REPOSITORY`, and `CI_RUN_ON_MAIN` repository variables, see [configuration.md](configuration.md). | auto (`push`) | none | +| [entry-push-latest.yml](../../../../../.github/workflows/entry-push-latest.yml): `๐Ÿ“ค Push` | Syncs `main` from the configured source repository, then runs the orchestrator on pushes to `main`, `feature/**`, `hotfix/**`, `fix/**`, `update/**`, `chore/**`, `alert-autofix-*`; on tagged `main` it also calls `call-release-version.yml`. Respects the `CI_SYNC_MAIN_SOURCE_REPOSITORY` and `CI_RUN_ON_MAIN` repository variables, see [configuration.md](configuration.md). | auto (`push`) | none | | [entry-manual-steer.yml](../../../../../.github/workflows/entry-manual-steer.yml): `๐Ÿ•น๏ธ Manual` | Manual dispatch of the full orchestrator for a chosen app whitelist. The `whitelist` input accepts the `__ALL__` sentinel for forced full deploy; see the "Diff-driven app selection" subsection in [pipeline.md](../../../artefact/git/pipeline.md). | manual | `distros` (optional; empty spreads the rows over every declared distro), `filesystem` (optional; empty spreads them over `zfs`, `btrfs`, `ext4`), `whitelist` (optional; `__ALL__` forces full deploy, empty triggers diff derivation, any other value is verbatim), `lifecycles`, `mode` (default `auto`), `priority` (optional; priority rows get chunks of their own, the regular chunks run after them), `offset` (default `0`; a row count or a selection token naming where the regular line resumes), `chunk_gate` (default `true`), `sweep` (optional; empty means the run number) | +| [entry-cancel-superseded.yml](../../../../../.github/workflows/entry-cancel-superseded.yml): `๐Ÿšซ Cancel: Superseded Runs` | Cancels the runs superseded by a newer one on the same branch or PR via the API, for the case where the concurrency group fails to reap its occupant and the newer run parks on `pending` behind it โ€” see [cancel/README.md](../../../../../scripts/github/cancel/README.md). Carries no concurrency group of its own, otherwise it would queue behind the run it has to free, and only touches the workflows that share the group it backs up. The push job skips `main` like the `global-ci-*` group it backs up, see [configuration.md](configuration.md). | auto (`push` except `main`, `pull_request_target`: opened, synchronize, reopened, ready_for_review, labeled) | none | | [entry-pr-closed-cancel-workflows.yml](../../../../../.github/workflows/entry-pr-closed-cancel-workflows.yml): `๐Ÿšซ Cancel: PR Runs on Close` | Cancels active workflow runs for a PR when it is closed or converted to draft. | auto (`pull_request_target`: closed, converted_to_draft) | none | | [entry-delete-branch.yml](../../../../../.github/workflows/entry-delete-branch.yml): `๐Ÿšซ Cancel: Runs on Branch Delete` | Enters the push-entry concurrency group for the deleted branch so that any in-flight run on it is cancelled; a fallback step cancels remaining runs via the API. | auto (`delete`) | none | diff --git a/package-lock.json b/package-lock.json index ef709be00d..7726171f79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,10 @@ "devDependencies": { "@eslint/js": "^10.0.1", "@playwright/test": "^1.62.1", - "eslint": "^10.8.1", + "eslint": "^10.9.1", "eslint-plugin-playwright": "^2.10.5", "globals": "^17.9.0", - "stylelint": "^16.0.0" + "stylelint": "^17.14.1" } }, "node_modules/@babel/code-frame": { @@ -102,10 +102,10 @@ "@keyv/serialize": "^1.1.1" } }, - "node_modules/@csstools/css-parser-algorithms": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz", - "integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==", + "node_modules/@csstools/css-calc": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.3.0.tgz", + "integrity": "sha512-c5ihYsPkdG6JCkU2zTMm4+k6r7RXuGxtWYhu5DHMIiF1FHzrfmHL5so11AoFpUv/tu61xfcmT4AmKoFfMPoqdQ==", "dev": true, "funding": [ { @@ -119,10 +119,34 @@ ], "license": "MIT", "engines": { - "node": ">=18" + "node": ">=20.19.0" }, "peerDependencies": { - "@csstools/css-tokenizer": "^3.0.4" + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.0.tgz", + "integrity": "sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.0" } }, "node_modules/@csstools/css-syntax-patches-for-csstree": { @@ -151,9 +175,9 @@ } }, "node_modules/@csstools/css-tokenizer": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz", - "integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.0.tgz", + "integrity": "sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA==", "dev": true, "funding": [ { @@ -167,13 +191,13 @@ ], "license": "MIT", "engines": { - "node": ">=18" + "node": ">=20.19.0" } }, "node_modules/@csstools/media-query-list-parser": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@csstools/media-query-list-parser/-/media-query-list-parser-4.0.3.tgz", - "integrity": "sha512-HAYH7d3TLRHDOUQK4mZKf9k9Ph/m8Akstg66ywKR4SFAigjs3yBiUeZtFxywiTm5moZMAp/5W/ZuFnNXXYLuuQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@csstools/media-query-list-parser/-/media-query-list-parser-5.0.0.tgz", + "integrity": "sha512-T9lXmZOfnam3eMERPsszjY5NK0jX8RmThmmm99FZ8b7z8yMaFZWKwLWGZuTwdO3ddRY5fy13GmmEYZXB4I98Eg==", "dev": true, "funding": [ { @@ -187,17 +211,17 @@ ], "license": "MIT", "engines": { - "node": ">=18" + "node": ">=20.19.0" }, "peerDependencies": { - "@csstools/css-parser-algorithms": "^3.0.5", - "@csstools/css-tokenizer": "^3.0.4" + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" } }, - "node_modules/@csstools/selector-specificity": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-5.0.0.tgz", - "integrity": "sha512-PCqQV3c4CoVm3kdPhyeZ07VmBRdH2EpMFA/pd9OASpOEC3aXNGoqPDAZ80D0cLpMBxnmk0+yNhGsEx31hq7Gtw==", + "node_modules/@csstools/selector-resolve-nested": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@csstools/selector-resolve-nested/-/selector-resolve-nested-4.0.1.tgz", + "integrity": "sha512-j3vdQu0XwLME5qOTWxm8cnmvsf423R2YL6DbKklCHZwkDm7UdKNu6RPlw4REIJhSlKBICY3B70/7QZdicLqZgg==", "dev": true, "funding": [ { @@ -211,21 +235,33 @@ ], "license": "MIT-0", "engines": { - "node": ">=18" + "node": ">=20.19.0" }, "peerDependencies": { - "postcss-selector-parser": "^7.0.0" + "postcss-selector-parser": "^7.1.1" } }, - "node_modules/@dual-bundle/import-meta-resolve": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/@dual-bundle/import-meta-resolve/-/import-meta-resolve-4.2.1.tgz", - "integrity": "sha512-id+7YRUgoUX6CgV0DtuhirQWodeeA7Lf4i2x71JS/vtA5pRb/hIGWlw+G6MeXvsM+MXrz0VAydTGElX1rAfgPg==", + "node_modules/@csstools/selector-specificity": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-6.0.0.tgz", + "integrity": "sha512-4sSgl78OtOXEX/2d++8A83zHNTgwCJMaR24FvsYL7Uf/VS8HZk9PTwR51elTbGqMuwH3szLvvOXEaVnqn0Z3zA==", "dev": true, - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/JounQin" + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "postcss-selector-parser": "^7.1.1" } }, "node_modules/@eslint-community/eslint-utils": { @@ -483,6 +519,19 @@ "node": ">=20" } }, + "node_modules/@sindresorhus/merge-streams": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-4.0.0.tgz", + "integrity": "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@types/esrecurse": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", @@ -577,16 +626,6 @@ "dev": true, "license": "Python-2.0" }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -798,19 +837,6 @@ "dev": true, "license": "MIT" }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -852,9 +878,9 @@ } }, "node_modules/eslint": { - "version": "10.8.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.8.1.tgz", - "integrity": "sha512-wqA7W2jbsC/BnV9Iv1UZpKVFkO1AdNoSmYW8NWG4HNOBbkAMvIqDZ27pI2f07dqn583NcIC44ckjAcOXDL1QbQ==", + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.9.1.tgz", + "integrity": "sha512-9VaAkDURekixUQJy0oJYl2DcN6oKMfxay7XzaGYAWQwsb6qfKf+x76R2k1L8kb1boc+FyCAaTA9GmiKaaiaF+A==", "dev": true, "license": "MIT", "workspaces": [ @@ -1189,6 +1215,19 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/get-east-asian-width": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz", + "integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -1257,26 +1296,37 @@ } }, "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "version": "16.2.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-16.2.4.tgz", + "integrity": "sha512-c8B/VNLmxRcmqqenRA9t+9IyOjf9+V6lTxPaUJLqOCONdQkWZ0ETYgX0qbtJqPsgCNusT9MZ5Jeidw8Eb9tn2g==", "dev": true, "license": "MIT", "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" + "@sindresorhus/merge-streams": "^4.0.0", + "fast-glob": "^3.3.3", + "ignore": "^7.0.5", + "is-path-inside": "^4.0.0", + "micromatch": "^4.0.8", + "slash": "^5.1.0", + "unicorn-magic": "^0.4.0" }, "engines": { - "node": ">=10" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globby/node_modules/ignore": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.6.tgz", + "integrity": "sha512-BAg6QkE8W+TuQLrrw0Ugr7HegXduRuuj8/ti2kSOc+jz1dmx8/WNcjr6XGnq5YpDWxFwwaavqD0+jIUOKelTsw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/globjoin": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/globjoin/-/globjoin-0.1.4.tgz", @@ -1285,13 +1335,16 @@ "license": "MIT" }, "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-5.0.1.tgz", + "integrity": "sha512-CsNUt5x9LUdx6hnk/E2SZLsDyvfqANZSUq4+D3D8RzDJ2M+HDTIkF60ibS1vHaK55vzgiZw1bEPFG9yH7l33wA==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/hashery": { @@ -1315,13 +1368,13 @@ "license": "MIT" }, "node_modules/html-tags": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-3.3.1.tgz", - "integrity": "sha512-ztqyC3kLto0e9WbNp0aeP+M3kTt+nbaIveGmUxAtZa+8iFgKLUOD4YKM5j+f3QD89bra7UeumolZHKuOXnTmeQ==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-5.1.0.tgz", + "integrity": "sha512-n6l5uca7/y5joxZ3LUePhzmBFUJ+U2YWzhMa8XUTecSeSlQiZdF5XAd/Q3/WUl0VsXgUwWi8I7CNIwdI5WN1SQ==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=20.10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -1364,6 +1417,17 @@ "node": ">=4" } }, + "node_modules/import-meta-resolve": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz", + "integrity": "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -1431,14 +1495,17 @@ "node": ">=0.12.0" } }, - "node_modules/is-plain-object": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.1.0.tgz", - "integrity": "sha512-bUi/yjmtKYcRVUtWRGr0UA6xEFh2I6zWUwMrUXB3s7bmYCaZ8a+0ZsTRkrawh/mzlSD1Y0Ph8bp/U+TvBpWDNw==", + "node_modules/is-path-inside": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-4.0.0.tgz", + "integrity": "sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==", "dev": true, "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/isexe": { @@ -1526,13 +1593,6 @@ "node": ">=0.10.0" } }, - "node_modules/known-css-properties": { - "version": "0.37.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.37.0.tgz", - "integrity": "sha512-JCDrsP4Z1Sb9JwG0aJ8Eo2r7k4Ou5MwmThS/6lcIe1ICyb7UBJKGRIUUdqc2ASdE/42lgz6zFUnzAIhtXnBVrQ==", - "dev": true, - "license": "MIT" - }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -1578,9 +1638,9 @@ "license": "MIT" }, "node_modules/mathml-tag-names": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz", - "integrity": "sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-4.0.0.tgz", + "integrity": "sha512-aa6AU2Pcx0VP/XWnh8IGL0SYSgQHDT6Ucror2j2mXeFAlN3ahaNs8EZtG1YiticMkSLj3Gt6VPFfZogt7G5iFQ==", "dev": true, "license": "MIT", "funding": { @@ -1596,13 +1656,13 @@ "license": "CC0-1.0" }, "node_modules/meow": { - "version": "13.2.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", - "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-14.1.0.tgz", + "integrity": "sha512-EDYo6VlmtnumlcBCbh1gLJ//9jvM/ndXHfVXIFrZVr6fGcwTUyCTFNTLCKuY3ffbK8L/+3Mzqnd58RojiZqHVw==", "dev": true, "license": "MIT", "engines": { - "node": ">=18" + "node": ">=20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -1793,16 +1853,6 @@ "node": ">=8" } }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -1884,13 +1934,6 @@ "node": "^10 || ^12 || >=14" } }, - "node_modules/postcss-resolve-nested-selector": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.6.tgz", - "integrity": "sha512-0sglIs9Wmkzbr8lQwEyIzlDOOC9bGmfVKcJTaxv3vMmd3uo4o4DerC3En0bnmgceeql9BfC8hRkp7cg0fjdVqw==", - "dev": true, - "license": "MIT" - }, "node_modules/postcss-safe-parser": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-7.0.1.tgz", @@ -2010,16 +2053,6 @@ "node": ">=0.10.0" } }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/reusify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", @@ -2092,13 +2125,16 @@ } }, "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/slice-ansi": { @@ -2158,9 +2194,9 @@ } }, "node_modules/stylelint": { - "version": "16.26.1", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.26.1.tgz", - "integrity": "sha512-v20V59/crfc8sVTAtge0mdafI3AdnzQ2KsWe6v523L4OA1bJO02S7MO2oyXDCS6iWb9ckIPnqAFVItqSBQr7jw==", + "version": "17.14.1", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-17.14.1.tgz", + "integrity": "sha512-xVQwyiuxALUBNB2fBe0tmNemg9KqLtdj3T64mioFDar79B2cU8LIyz+3KL6LdiHs9NkeNfwxpKSaIVOY8f112g==", "dev": true, "funding": [ { @@ -2174,59 +2210,61 @@ ], "license": "MIT", "dependencies": { - "@csstools/css-parser-algorithms": "^3.0.5", - "@csstools/css-syntax-patches-for-csstree": "^1.0.19", - "@csstools/css-tokenizer": "^3.0.4", - "@csstools/media-query-list-parser": "^4.0.3", - "@csstools/selector-specificity": "^5.0.0", - "@dual-bundle/import-meta-resolve": "^4.2.1", - "balanced-match": "^2.0.0", + "@csstools/css-calc": "^3.2.1", + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-syntax-patches-for-csstree": "^1.1.6", + "@csstools/css-tokenizer": "^4.0.0", + "@csstools/media-query-list-parser": "^5.0.0", + "@csstools/selector-resolve-nested": "^4.0.0", + "@csstools/selector-specificity": "^6.0.0", "colord": "^2.9.3", - "cosmiconfig": "^9.0.0", - "css-functions-list": "^3.2.3", - "css-tree": "^3.1.0", + "cosmiconfig": "^9.0.2", + "css-functions-list": "^3.3.3", + "css-tree": "^3.2.1", "debug": "^4.4.3", "fast-glob": "^3.3.3", "fastest-levenshtein": "^1.0.16", - "file-entry-cache": "^11.1.1", + "file-entry-cache": "^11.1.5", "global-modules": "^2.0.0", - "globby": "^11.1.0", + "globby": "^16.2.1", "globjoin": "^0.1.4", - "html-tags": "^3.3.1", + "html-tags": "^5.1.0", "ignore": "^7.0.5", - "imurmurhash": "^0.1.4", - "is-plain-object": "^5.0.0", - "known-css-properties": "^0.37.0", - "mathml-tag-names": "^2.1.3", - "meow": "^13.2.0", + "import-meta-resolve": "^4.2.0", + "mathml-tag-names": "^4.0.0", + "meow": "^14.1.0", "micromatch": "^4.0.8", "normalize-path": "^3.0.0", "picocolors": "^1.1.1", - "postcss": "^8.5.6", - "postcss-resolve-nested-selector": "^0.1.6", + "postcss": "^8.5.16", "postcss-safe-parser": "^7.0.1", - "postcss-selector-parser": "^7.1.0", + "postcss-selector-parser": "^7.1.4", "postcss-value-parser": "^4.2.0", - "resolve-from": "^5.0.0", - "string-width": "^4.2.3", - "supports-hyperlinks": "^3.2.0", + "string-width": "^8.2.1", + "supports-hyperlinks": "^4.5.0", "svg-tags": "^1.0.0", "table": "^6.9.0", - "write-file-atomic": "^5.0.1" + "write-file-atomic": "^7.0.1" }, "bin": { "stylelint": "bin/stylelint.mjs" }, "engines": { - "node": ">=18.12.0" + "node": ">=20.19.0" } }, - "node_modules/stylelint/node_modules/balanced-match": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", - "integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==", + "node_modules/stylelint/node_modules/ansi-regex": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", + "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } }, "node_modules/stylelint/node_modules/file-entry-cache": { "version": "11.1.5", @@ -2260,31 +2298,64 @@ "node": ">= 4" } }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "node_modules/stylelint/node_modules/string-width": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.2.tgz", + "integrity": "sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==", "dev": true, "license": "MIT", "dependencies": { - "has-flag": "^4.0.0" + "get-east-asian-width": "^1.5.0", + "strip-ansi": "^7.1.2" }, "engines": { - "node": ">=8" + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/stylelint/node_modules/strip-ansi": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.2.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, "node_modules/supports-hyperlinks": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.2.0.tgz", - "integrity": "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-4.5.0.tgz", + "integrity": "sha512-ZW2OvfeCXrNTbLakPUzjQG922EeGCOteFSVoek5DKStTh898wf7zgtuFlzQN8HfZCxC3Eh02yJVrRW51hADf+w==", "dev": true, "license": "MIT", "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" + "has-flag": "^5.0.1", + "supports-color": "^10.2.2" }, "engines": { - "node": ">=14.18" + "node": ">=20" }, "funding": { "url": "https://github.com/chalk/supports-hyperlinks?sponsor=1" @@ -2363,6 +2434,19 @@ "node": ">= 0.8.0" } }, + "node_modules/unicorn-magic": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.4.0.tgz", + "integrity": "sha512-wH590V9VNgYH9g3lH9wWjTrUoKsjLF6sGLjhR4sH1LWpLmCOH0Zf7PukhDA8BiS7KHe4oPNkcTHqYkj7SOGUOw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -2407,17 +2491,16 @@ } }, "node_modules/write-file-atomic": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", - "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-7.0.1.tgz", + "integrity": "sha512-OTIk8iR8/aCRWBqvxrzxR0hgxWpnYBblY1S5hDWBQfk/VFmJwzmJgQFN3WsoUKHISv2eAwe+PpbUzyL1CKTLXg==", "dev": true, "license": "ISC", "dependencies": { - "imurmurhash": "^0.1.4", "signal-exit": "^4.0.1" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/yocto-queue": { diff --git a/package.json b/package.json index 5376f71873..5fcbd18638 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,10 @@ "devDependencies": { "@eslint/js": "^10.0.1", "@playwright/test": "^1.62.1", - "eslint": "^10.8.1", + "eslint": "^10.9.1", "eslint-plugin-playwright": "^2.10.5", "globals": "^17.9.0", - "stylelint": "^16.0.0" + "stylelint": "^17.14.1" }, "overrides": { "brace-expansion": "^5.0.9" diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD index d334c54434..16e17e6341 100644 --- a/packaging/arch/PKGBUILD +++ b/packaging/arch/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Kevin Veen-Birkenbach pkgname=infinito-nexus -pkgver=12.0.0 +pkgver=13.0.0 pkgrel=1 pkgdesc="Meta package for Infinito.Nexus host dependencies (dev + CI)." arch=('any') diff --git a/packaging/debian/changelog b/packaging/debian/changelog index a51bdfea27..f42e064389 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,152 @@ +infinito-nexus (13.0.0-1) unstable; urgency=medium + + * **Tor as a first-class deployment axis.** The new *svc-net-tor* role routes onion + names through Tor via DNS instead of per-app proxies, offers a chutney flavor for + private-net test deployments, and ties its dnsmasq listener to ownership rather than + the deploy mode. Applications follow: server-side OIDC discovery and token exchange + reach plaintext onion issuers through the SOCKS proxy (WordPress, Joomla, PeerTube, + Mobilizon, EspoCRM, Nextcloud), session cookies drop the *Secure* flag where an onion + cannot carry it (Taiga, Pixelfed, Joomla), and mail authenticates on the submission + port the onion relay actually serves. The deploy matrix gained a tor axis with an + onion marker plus enforced and exclusive modes, and lint now requires the onion in + every variant. See the [svc-net-tor](roles/svc-net-tor/README.md) README. + + * **Single sign-on across protocols and domains.** Keycloak imports a SAML client for + every app that asks for one; SuiteCRM authenticates against it via SAML instead of a + proxy, and Shopware provisions its admin through AdminOpenAuth with the front and + back channel split. Sessions are shared across app domains, the issuer is pinned to + the canonical OIDC URL, each consumer's redirect scheme resolves on its own side, and + the logout sweep runs where the visitor is looking. Directory users are read through + one lookup so seeding cannot diverge. + + * **One CI chain instead of four workflows.** The deploy workflows collapse into a + single chunk chain gated by one validation job, with every variant getting its own + row and rotating distro, filesystem and tor axes. Selection tokens pin deploy axes, + retriggers reproduce the exact selection of the source run in every mode, and the + regular line resumes where the source stopped. Fork code no longer runs with the base + repository token, workflow tokens are scoped to the jobs that need them, superseded + runs are force-cancelled, and a mid-run budget SIGKILL is counted as skipped rather + than green. Apt call sites are bounded so a stalled mirror cannot burn a job budget. + + * **Restore verified against real dumps.** The *recover* CLI replays a generation's + database and cluster dumps, reads the generation's own layout instead of guessing it, + and places each dump by the engine the backup observed rather than by name alone. The + *svc-bkp-volume-2-local* drill now empties every volume it claims to test, fails on a + database that was never dumped, and stops the backup timers before it goes + destructive. Baudolo is pinned per host, its contract read from baudolo itself. + + * **A probe for every container.** Health checks are composed from prefixes and are + mandatory: every declared image either carries a probe or states why it cannot have + one, enforced from both sides. Probes hit the port the container actually binds, no + longer derive an HTTP Host from a kernel hostname, and are defined once instead of per + proxy. Rescue diagnostics pin the dnsmasq listener loss to its moment, sample what the + resolver answers rather than just its socket, probe the daemon.json upstreams, and + record the whole boot instead of the last 10 000 lines. + + * **Single points of truth, enforced by lint.** The new *sys-lint* role pins the + GitHub-release lint tools. Every mount target has one spot in *meta/volumes.yml* and + container paths are derived from it, *default.env* is the enforced source of the + primary domain, *container_backup* is rejected where no volume exists, and role + credentials live at *meta/secrets.yml*. Linters no longer read gitignored build + output, comments are checked in every file rather than only changed ones, and every + shipped script requires a mirrored unit test. + + * **Tests in every language the project ships.** The quality gate parses each shipped + language and runs its unit suite; the PHP and Ruby interpreters are baked into the + image, and the JavaScript, PHP and Ruby suites are reported in the CI summary + alongside Python. Playwright stages the persona flows once per run and mounts them + read-only, and the workspace environment suite splits into base, compose and swarm + tracks. + + * **Swarm and proxy operation.** Convergence gates read one budget sized for a real + stack, print every task row when a stack fails to converge, and give up on a terminal + task; the deployment mode a stack was deployed with is resolved instead of assumed. + OpenResty reloads a vhost, lua or redirect config instead of redeploying the task. + GitLab ships its config trees as swarm configs rather than host binds, and role + templates expand through a lookup instead of inline Jinja. + + * **New and reshaped roles.** *sys-svc-nss* is split out of *sys-hostname*, + *web-svc-mirror* serves frontend assets as a privacy proxy, PeerTube becomes + clearnet-only, and roles that could not run were deleted rather than repaired. CLI + tools install via pip instead of pkgmgr. + + * **Image and dependency version jumps (net since 12.0.0):** + + *Applications* + * *web-app-erpnext*: v16.26.2 to v16.32.3 + * *web-app-gitlab*: v19.1.2 to v19.3.0 (all six CNG component images) + * *web-app-semaphore*: v2.18.25 to v2.19.8 + * *web-app-nextcloud*: PHP 33-fpm-alpine to 34-fpm-alpine, nginx 1.31.2 to 1.31.3 + * *web-app-shopware*: 6.7.8.2 to 6.7.13.0, OpenSearch 3.7.0 to 3.8.0 + * *web-app-matomo*: 5.11.2 to 5.13.0 + * *web-app-matrix*: Synapse v1.156.0 to v1.159.0, Element v1.12.23 to v1.12.26 + * *web-app-mattermost*: 11.9.0 to 11.10.1 + * *web-app-keycloak*: 26.7.0 to 26.7.2, oauth2-proxy v7.15.3 to v7.15.4 + * *web-app-gitea*: 1.26.4 to 1.27.2 + * *web-app-funkwhale*: 2.0.6 to 2.0.9 (api and front) + * *web-app-penpot*: 2.16.2 to 2.17.1 (frontend, backend, exporter) + * *web-app-espocrm*: 10.0.2 to 10.0.6 + * *web-app-opencloud*: 7.2.1 to 7.2.4 + * *web-app-seaweedfs*: 4.39 to 4.44 + * *web-app-snipe-it*: v8.6.3-alpine to v8.7.2-alpine + * *web-app-wordpress*: 7.0.1 to 7.1.0 + * *web-app-peertube*: v8.2.2 to v8.2.4 + * *web-app-joomla*: 6.1.2-php8.3-apache to 6.1.3-php8.3-apache + * *web-app-jira*: 11.3.8 to 11.3.10 + * *web-app-confluence*: 10.2.14 to 10.2.15 + * *web-app-baserow*: 2.3.1 to 2.3.3 + * *web-app-flowise*: 3.1.3 to 3.1.4 + * *web-app-mailu*: 1.5.3 to 1.5.4 + * *web-app-pgadmin*: 9.16 to 9.17 + * *web-app-prometheus*: Prometheus v3.13.1 to v3.14.0, Alertmanager v0.33.1 to + v0.34.0, node-exporter v1.12.0 to v1.12.1 + * *web-app-opentalk*: LiveKit v1.13.3 to v1.13.5, RabbitMQ 4.3.2 to 4.3.4; the + frontend (v2.9.0), controller (v0.34.1) and recorder (v0.16.2) stay pinned until + the set is released as a bundle and *recorder.toml* is migrated + * *web-app-magento*: OpenSearch 3.7.0 to 3.8.0; PHP held at 8.4-fpm and MariaDB at + 11.4, both deliberately fenced against the image bot + * *web-app-socialhome*: newly pinned to 2026.6.16 + * *web-app-bluesky* and *web-app-bridgy-fed*: upstream git refs pinned to commits + + *Services and infrastructure* + * *svc-ai-ollama*: 0.31.2 to 0.32.15 + * *svc-db-elasticsearch*: 9.4.3 to 9.5.2 + * *svc-db-qdrant*: v1.18.2 to v1.19.0 + * *svc-runner*: Ubuntu 24.04 to 26.04 + * *sys-ctl-hlth-csp*: 2.1.2 to 2.2.1 + * *web-svc-coturn*: 4.14.0 to 4.17.2 + * *web-svc-logout*: *latest* to universal-logout v1.3.1 + * *web-svc-xmpp*: 26.04 to 26.07 + * *test-e2e-playwright*: v1.61.1-noble to v1.62.1-noble + * *svc-net-tor*: newly on debian trixie-slim + * *svc-bkp-volume-2-local*: newly on alpine 3.24 + + *Toolchain and dependencies* + * *backup-docker-to-local* (*baudolo*): pinned to 7.0.1, via 6.0.0 and 7.0.0 + * *ruff*: 0.16.0 to 0.16.4 + * *@playwright/test*: ^1.61.1 to ^1.62.1 + * *eslint*: ^10.6.0 to ^10.9.0, *globals*: ^17.7.0 to ^17.9.0 + * *stylelint*: ^16.0.0 added + * *brace-expansion*: overridden to ^5.0.9, past three DoS advisories + * *keycloak-js*: 24.0.5 to 26.2.4, loaded as an ES module + * *bootstrap*: 5.3.3 to 5.3.8, *@fortawesome/fontawesome-free*: 6.5.1 to 7.3.1 + * *roles/sys-lint* pins the GitHub-release tools: actionlint v1.7.12, + hadolint v2.15.1, shfmt v3.13.1 + + **Renamed** + + * Role credential declarations move from *meta/credentials.yml* to *meta/secrets.yml*, + addressed at *secrets.credentials* like every other meta file. + * The NSS half of *sys-hostname* becomes its own role, *sys-svc-nss*. + + **Contributors** + + * [Kevin Veen-Birkenbach](https://veen.world): Tor deployment axis, SAML and + cross-domain SSO, CI chunk chain, generation-level recovery, health-check and + lint enforcement, multi-language test suites + + -- Kevin Veen-Birkenbach Wed, 26 Aug 2026 09:39:19 +0200 + infinito-nexus (12.0.0-1) unstable; urgency=medium * **Docker Swarm as a second deployment mode.** Roles can now be deployed across diff --git a/packaging/fedora/infinito-nexus.spec b/packaging/fedora/infinito-nexus.spec index cc1cd23e7d..51e99a8f89 100644 --- a/packaging/fedora/infinito-nexus.spec +++ b/packaging/fedora/infinito-nexus.spec @@ -1,5 +1,5 @@ Name: infinito-nexus -Version: 12.0.0 +Version: 13.0.0 Release: 1%{?dist} Summary: Meta package for Infinito.Nexus host dependencies @@ -58,6 +58,152 @@ install -d %{buildroot}%{_docdir}/%{name} %doc %{_docdir}/%{name}/DEPENDENCIES %changelog +* Wed Aug 26 2026 Kevin Veen-Birkenbach - 13.0.0-1 +- * **Tor as a first-class deployment axis.** The new *svc-net-tor* role routes onion +- names through Tor via DNS instead of per-app proxies, offers a chutney flavor for +- private-net test deployments, and ties its dnsmasq listener to ownership rather than +- the deploy mode. Applications follow: server-side OIDC discovery and token exchange +- reach plaintext onion issuers through the SOCKS proxy (WordPress, Joomla, PeerTube, +- Mobilizon, EspoCRM, Nextcloud), session cookies drop the *Secure* flag where an onion +- cannot carry it (Taiga, Pixelfed, Joomla), and mail authenticates on the submission +- port the onion relay actually serves. The deploy matrix gained a tor axis with an +- onion marker plus enforced and exclusive modes, and lint now requires the onion in +- every variant. See the [svc-net-tor](roles/svc-net-tor/README.md) README. + +- * **Single sign-on across protocols and domains.** Keycloak imports a SAML client for +- every app that asks for one; SuiteCRM authenticates against it via SAML instead of a +- proxy, and Shopware provisions its admin through AdminOpenAuth with the front and +- back channel split. Sessions are shared across app domains, the issuer is pinned to +- the canonical OIDC URL, each consumer's redirect scheme resolves on its own side, and +- the logout sweep runs where the visitor is looking. Directory users are read through +- one lookup so seeding cannot diverge. + +- * **One CI chain instead of four workflows.** The deploy workflows collapse into a +- single chunk chain gated by one validation job, with every variant getting its own +- row and rotating distro, filesystem and tor axes. Selection tokens pin deploy axes, +- retriggers reproduce the exact selection of the source run in every mode, and the +- regular line resumes where the source stopped. Fork code no longer runs with the base +- repository token, workflow tokens are scoped to the jobs that need them, superseded +- runs are force-cancelled, and a mid-run budget SIGKILL is counted as skipped rather +- than green. Apt call sites are bounded so a stalled mirror cannot burn a job budget. + +- * **Restore verified against real dumps.** The *recover* CLI replays a generation's +- database and cluster dumps, reads the generation's own layout instead of guessing it, +- and places each dump by the engine the backup observed rather than by name alone. The +- *svc-bkp-volume-2-local* drill now empties every volume it claims to test, fails on a +- database that was never dumped, and stops the backup timers before it goes +- destructive. Baudolo is pinned per host, its contract read from baudolo itself. + +- * **A probe for every container.** Health checks are composed from prefixes and are +- mandatory: every declared image either carries a probe or states why it cannot have +- one, enforced from both sides. Probes hit the port the container actually binds, no +- longer derive an HTTP Host from a kernel hostname, and are defined once instead of per +- proxy. Rescue diagnostics pin the dnsmasq listener loss to its moment, sample what the +- resolver answers rather than just its socket, probe the daemon.json upstreams, and +- record the whole boot instead of the last 10 000 lines. + +- * **Single points of truth, enforced by lint.** The new *sys-lint* role pins the +- GitHub-release lint tools. Every mount target has one spot in *meta/volumes.yml* and +- container paths are derived from it, *default.env* is the enforced source of the +- primary domain, *container_backup* is rejected where no volume exists, and role +- credentials live at *meta/secrets.yml*. Linters no longer read gitignored build +- output, comments are checked in every file rather than only changed ones, and every +- shipped script requires a mirrored unit test. + +- * **Tests in every language the project ships.** The quality gate parses each shipped +- language and runs its unit suite; the PHP and Ruby interpreters are baked into the +- image, and the JavaScript, PHP and Ruby suites are reported in the CI summary +- alongside Python. Playwright stages the persona flows once per run and mounts them +- read-only, and the workspace environment suite splits into base, compose and swarm +- tracks. + +- * **Swarm and proxy operation.** Convergence gates read one budget sized for a real +- stack, print every task row when a stack fails to converge, and give up on a terminal +- task; the deployment mode a stack was deployed with is resolved instead of assumed. +- OpenResty reloads a vhost, lua or redirect config instead of redeploying the task. +- GitLab ships its config trees as swarm configs rather than host binds, and role +- templates expand through a lookup instead of inline Jinja. + +- * **New and reshaped roles.** *sys-svc-nss* is split out of *sys-hostname*, +- *web-svc-mirror* serves frontend assets as a privacy proxy, PeerTube becomes +- clearnet-only, and roles that could not run were deleted rather than repaired. CLI +- tools install via pip instead of pkgmgr. + +- * **Image and dependency version jumps (net since 12.0.0):** + +- *Applications* +- * *web-app-erpnext*: v16.26.2 to v16.32.3 +- * *web-app-gitlab*: v19.1.2 to v19.3.0 (all six CNG component images) +- * *web-app-semaphore*: v2.18.25 to v2.19.8 +- * *web-app-nextcloud*: PHP 33-fpm-alpine to 34-fpm-alpine, nginx 1.31.2 to 1.31.3 +- * *web-app-shopware*: 6.7.8.2 to 6.7.13.0, OpenSearch 3.7.0 to 3.8.0 +- * *web-app-matomo*: 5.11.2 to 5.13.0 +- * *web-app-matrix*: Synapse v1.156.0 to v1.159.0, Element v1.12.23 to v1.12.26 +- * *web-app-mattermost*: 11.9.0 to 11.10.1 +- * *web-app-keycloak*: 26.7.0 to 26.7.2, oauth2-proxy v7.15.3 to v7.15.4 +- * *web-app-gitea*: 1.26.4 to 1.27.2 +- * *web-app-funkwhale*: 2.0.6 to 2.0.9 (api and front) +- * *web-app-penpot*: 2.16.2 to 2.17.1 (frontend, backend, exporter) +- * *web-app-espocrm*: 10.0.2 to 10.0.6 +- * *web-app-opencloud*: 7.2.1 to 7.2.4 +- * *web-app-seaweedfs*: 4.39 to 4.44 +- * *web-app-snipe-it*: v8.6.3-alpine to v8.7.2-alpine +- * *web-app-wordpress*: 7.0.1 to 7.1.0 +- * *web-app-peertube*: v8.2.2 to v8.2.4 +- * *web-app-joomla*: 6.1.2-php8.3-apache to 6.1.3-php8.3-apache +- * *web-app-jira*: 11.3.8 to 11.3.10 +- * *web-app-confluence*: 10.2.14 to 10.2.15 +- * *web-app-baserow*: 2.3.1 to 2.3.3 +- * *web-app-flowise*: 3.1.3 to 3.1.4 +- * *web-app-mailu*: 1.5.3 to 1.5.4 +- * *web-app-pgadmin*: 9.16 to 9.17 +- * *web-app-prometheus*: Prometheus v3.13.1 to v3.14.0, Alertmanager v0.33.1 to +- v0.34.0, node-exporter v1.12.0 to v1.12.1 +- * *web-app-opentalk*: LiveKit v1.13.3 to v1.13.5, RabbitMQ 4.3.2 to 4.3.4; the +- frontend (v2.9.0), controller (v0.34.1) and recorder (v0.16.2) stay pinned until +- the set is released as a bundle and *recorder.toml* is migrated +- * *web-app-magento*: OpenSearch 3.7.0 to 3.8.0; PHP held at 8.4-fpm and MariaDB at +- 11.4, both deliberately fenced against the image bot +- * *web-app-socialhome*: newly pinned to 2026.6.16 +- * *web-app-bluesky* and *web-app-bridgy-fed*: upstream git refs pinned to commits + +- *Services and infrastructure* +- * *svc-ai-ollama*: 0.31.2 to 0.32.15 +- * *svc-db-elasticsearch*: 9.4.3 to 9.5.2 +- * *svc-db-qdrant*: v1.18.2 to v1.19.0 +- * *svc-runner*: Ubuntu 24.04 to 26.04 +- * *sys-ctl-hlth-csp*: 2.1.2 to 2.2.1 +- * *web-svc-coturn*: 4.14.0 to 4.17.2 +- * *web-svc-logout*: *latest* to universal-logout v1.3.1 +- * *web-svc-xmpp*: 26.04 to 26.07 +- * *test-e2e-playwright*: v1.61.1-noble to v1.62.1-noble +- * *svc-net-tor*: newly on debian trixie-slim +- * *svc-bkp-volume-2-local*: newly on alpine 3.24 + +- *Toolchain and dependencies* +- * *backup-docker-to-local* (*baudolo*): pinned to 7.0.1, via 6.0.0 and 7.0.0 +- * *ruff*: 0.16.0 to 0.16.4 +- * *@playwright/test*: ^1.61.1 to ^1.62.1 +- * *eslint*: ^10.6.0 to ^10.9.0, *globals*: ^17.7.0 to ^17.9.0 +- * *stylelint*: ^16.0.0 added +- * *brace-expansion*: overridden to ^5.0.9, past three DoS advisories +- * *keycloak-js*: 24.0.5 to 26.2.4, loaded as an ES module +- * *bootstrap*: 5.3.3 to 5.3.8, *@fortawesome/fontawesome-free*: 6.5.1 to 7.3.1 +- * *roles/sys-lint* pins the GitHub-release tools: actionlint v1.7.12, +- hadolint v2.15.1, shfmt v3.13.1 + +- **Renamed** + +- * Role credential declarations move from *meta/credentials.yml* to *meta/secrets.yml*, +- addressed at *secrets.credentials* like every other meta file. +- * The NSS half of *sys-hostname* becomes its own role, *sys-svc-nss*. + +- **Contributors** + +- * [Kevin Veen-Birkenbach](https://veen.world): Tor deployment axis, SAML and +- cross-domain SSO, CI chunk chain, generation-level recovery, health-check and +- lint enforcement, multi-language test suites + * Sat Aug 08 2026 Kevin Veen-Birkenbach - 12.0.0-1 - * **Docker Swarm as a second deployment mode.** Roles can now be deployed across - multiple hosts instead of being limited to a single Compose stack. New diff --git a/pyproject.toml b/pyproject.toml index 88e82dcf84..f4e7bf2c2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "infinito-nexus" -version = "12.0.0" +version = "13.0.0" description = "Infinito.Nexus" readme = "README.md" requires-python = ">=3.11" diff --git a/requirements/requirements.git.yml b/requirements/requirements.git.yml index 349818fc2f..31ddb7279d 100644 --- a/requirements/requirements.git.yml +++ b/requirements/requirements.git.yml @@ -1,5 +1,15 @@ --- collections: + - name: ansible.posix + source: https://github.com/ansible-collections/ansible.posix.git + type: git + version: main + + - name: ansible.mysql + source: https://github.com/ansible-collections/ansible.mysql.git + type: git + version: main + - name: kewlfft.aur source: https://github.com/kewlfft/ansible-aur.git type: git @@ -10,6 +20,16 @@ collections: type: git version: main + - name: community.docker + source: https://github.com/ansible-collections/community.docker.git + type: git + version: main + + - name: community.library_inventory_filtering_v1 + source: https://github.com/ansible-collections/community.library_inventory_filtering.git + type: git + version: stable-1 + - name: hetzner.hcloud source: https://github.com/ansible-collections/hetzner.hcloud.git type: git diff --git a/roles/svc-ai-ollama/meta/services.yml b/roles/svc-ai-ollama/meta/services.yml index a24496e831..27ea4c1e20 100644 --- a/roles/svc-ai-ollama/meta/services.yml +++ b/roles/svc-ai-ollama/meta/services.yml @@ -13,7 +13,7 @@ ollama: backup: no_stop_required: true image: ollama/ollama - version: 0.32.15 + version: 0.33.1 name: ollama min_storage: 3473MB cpus: "4.0" diff --git a/roles/web-app-bluesky/templates/compose.yml.j2 b/roles/web-app-bluesky/templates/compose.yml.j2 index aeb34e1094..54829bd932 100644 --- a/roles/web-app-bluesky/templates/compose.yml.j2 +++ b/roles/web-app-bluesky/templates/compose.yml.j2 @@ -20,6 +20,7 @@ dockerfile: Dockerfile {{ lookup('container_image', application_id, 'web', image=BLUESKY_WEB_IMAGE_CUSTOM) }} {{ lookup('compose_only', 'pull_policy', 'never') }} + {{ lookup('compose_restart') }} {{ lookup('container_ports', ['web', 'http', DOCKER_BIND_HOST]) | indent(4) }} {{ lookup('container_healthcheck', service_name) | indent(4) }} {{ lookup('container_networks') | indent(4) }} diff --git a/roles/web-app-bridgy-fed/files/Dockerfile b/roles/web-app-bridgy-fed/files/Dockerfile index 939a9d7a6c..91f07076a6 100644 --- a/roles/web-app-bridgy-fed/files/Dockerfile +++ b/roles/web-app-bridgy-fed/files/Dockerfile @@ -7,6 +7,9 @@ # # Upstream serves oauth_dropins assets from /app/oauth_dropins_static and ships # no such directory, so the package's own static tree is linked in. +# +# BRIDGY_REF is a commit, because upstream publishes no tags. `git clone +# --branch` refuses a commit, hence the fetch of the single ref instead. ARG PY_BASE FROM ${PY_BASE} AS build @@ -19,7 +22,10 @@ RUN rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* WORKDIR /app -RUN git clone --depth=1 --branch "${BRIDGY_REF}" "${BRIDGY_REPO_URL}" ./ +RUN git init -q . && \ + git remote add origin "${BRIDGY_REPO_URL}" && \ + git fetch -q --depth=1 origin "${BRIDGY_REF}" && \ + git checkout -q --detach FETCH_HEAD RUN pip install --upgrade pip && \ pip install --no-cache-dir -r requirements.txt diff --git a/roles/web-app-bridgy-fed/meta/services.yml b/roles/web-app-bridgy-fed/meta/services.yml index 9e6f98db05..41b3d862d3 100644 --- a/roles/web-app-bridgy-fed/meta/services.yml +++ b/roles/web-app-bridgy-fed/meta/services.yml @@ -50,7 +50,8 @@ bridgy-fed: version: 3.14-bookworm name: web-app-bridgy-fed repository: https://github.com/snarfed/bridgy-fed.git - ref: main + # nocheck: repository-version -- upstream publishes no tags, so the pin is a commit + ref: e7c6f80e35330c249e35205ce9e181ebc24531e2 ports: local: http: 8053 diff --git a/roles/web-app-erpnext/meta/services.yml b/roles/web-app-erpnext/meta/services.yml index 53e8abf4cd..acfeba20fd 100644 --- a/roles/web-app-erpnext/meta/services.yml +++ b/roles/web-app-erpnext/meta/services.yml @@ -65,7 +65,7 @@ erpnext: enabled: true shared: true image: frappe/erpnext - version: "v16.32.3" + version: "v16.33.0" name: erpnext min_storage: 1017MB ports: diff --git a/roles/web-app-funkwhale/meta/services.yml b/roles/web-app-funkwhale/meta/services.yml index e585946b4d..d102779090 100644 --- a/roles/web-app-funkwhale/meta/services.yml +++ b/roles/web-app-funkwhale/meta/services.yml @@ -11,7 +11,7 @@ funkwhale: # nocheck: default-placement-manager embedded typesense index; node-local in swarm placement: manager image: funkwhale/front - version: 2.0.9 + version: 2.0.10 min_storage: 224MB ports: internal: @@ -35,7 +35,7 @@ api: flavor: curl path: api/v1/instance/nodeinfo/2.0 image: funkwhale/api - version: 2.0.9 + version: 2.0.10 min_storage: 588MB ports: internal: diff --git a/roles/web-app-gitlab/meta/services.yml b/roles/web-app-gitlab/meta/services.yml index d67bd9d6e6..3dde367ba2 100644 --- a/roles/web-app-gitlab/meta/services.yml +++ b/roles/web-app-gitlab/meta/services.yml @@ -72,7 +72,7 @@ gitlab: lifecycle: beta webservice: image: registry.gitlab.com/gitlab-org/build/cng/gitlab-webservice-ce - version: v19.3.0 + version: v19.3.1 name: gitlab-webservice ports: internal: @@ -87,7 +87,7 @@ sidekiq: path: liveness start_period: 300s image: registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ce - version: v19.3.0 + version: v19.3.1 name: gitlab-sidekiq cpus: "1.0" mem_reservation: 2g @@ -98,7 +98,7 @@ sidekiq: http: 3808 workhorse: image: registry.gitlab.com/gitlab-org/build/cng/gitlab-workhorse-ce - version: v19.3.0 + version: v19.3.1 name: gitlab-workhorse cpus: "0.5" mem_reservation: 256m @@ -108,7 +108,7 @@ gitaly: # nocheck: single-replica replicas: 1 image: registry.gitlab.com/gitlab-org/build/cng/gitaly - version: v19.3.0 + version: v19.3.1 name: gitlab-gitaly ports: internal: @@ -119,7 +119,7 @@ gitaly: pids_limit: 1024 shell: image: registry.gitlab.com/gitlab-org/build/cng/gitlab-shell - version: v19.3.0 + version: v19.3.1 name: gitlab-shell ports: internal: @@ -132,7 +132,7 @@ migrations: # nocheck: single-replica replicas: 1 image: registry.gitlab.com/gitlab-org/build/cng/gitlab-rails-ce - version: v19.3.0 + version: v19.3.1 name: gitlab-migrations cpus: "1.0" mem_reservation: 1g diff --git a/roles/web-app-nextcloud/meta/services.yml b/roles/web-app-nextcloud/meta/services.yml index 7725f91321..262935a861 100644 --- a/roles/web-app-nextcloud/meta/services.yml +++ b/roles/web-app-nextcloud/meta/services.yml @@ -122,7 +122,7 @@ proxy: flavor: curl start_period: 20m image: nginx - version: 1.31.3-alpine + version: 1.31.4-alpine backup: no_stop_required: true cpus: "0.5" diff --git a/roles/web-app-opentalk/meta/services.yml b/roles/web-app-opentalk/meta/services.yml index d11ea200a8..352669e2c2 100644 --- a/roles/web-app-opentalk/meta/services.yml +++ b/roles/web-app-opentalk/meta/services.yml @@ -96,7 +96,7 @@ controller: livekit: name: opentalk-livekit image: livekit/livekit-server - version: v1.13.5 + version: v1.13.6 min_storage: 238MB cpus: "2.0" mem_reservation: 512m @@ -129,7 +129,7 @@ seaweedfs: rabbit: name: opentalk-rabbit image: rabbitmq - version: 4.3.4 + version: 4.3.5 min_storage: 314MB cpus: "0.5" mem_reservation: 256m diff --git a/roles/web-app-penpot/meta/services.yml b/roles/web-app-penpot/meta/services.yml index de0f042975..4317851031 100644 --- a/roles/web-app-penpot/meta/services.yml +++ b/roles/web-app-penpot/meta/services.yml @@ -78,7 +78,7 @@ penpot: lifecycle: beta frontend: image: penpotapp/frontend - version: "2.17.1" + version: "2.17.2" name: penpot-frontend cpus: "0.5" mem_reservation: 256m @@ -86,7 +86,7 @@ frontend: pids_limit: 256 backend: image: penpotapp/backend - version: "2.17.1" + version: "2.17.2" name: penpot-backend cpus: "1.0" mem_reservation: 1g @@ -100,7 +100,7 @@ backend: http: 6060 exporter: image: penpotapp/exporter - version: "2.17.1" + version: "2.17.2" name: penpot-exporter cpus: "0.5" mem_reservation: 512m diff --git a/roles/web-app-semaphore/meta/services.yml b/roles/web-app-semaphore/meta/services.yml index 56f9959774..1231eb5582 100644 --- a/roles/web-app-semaphore/meta/services.yml +++ b/roles/web-app-semaphore/meta/services.yml @@ -55,7 +55,7 @@ semaphore: pids_limit: 1024 min_storage: 530MB image: semaphoreui/semaphore - version: "v2.19.8" + version: "v2.19.11" backup: no_stop_required: true name: semaphore diff --git a/scripts/github/cancel/README.md b/scripts/github/cancel/README.md index 41e6f0e5bc..462151bcff 100644 --- a/scripts/github/cancel/README.md +++ b/scripts/github/cancel/README.md @@ -1,9 +1,35 @@ # Run Cancellation ๐Ÿšซ -Shell helpers that cancel in-progress GitHub Actions workflow runs in response to repository lifecycle events. +Shell helpers that cancel GitHub Actions workflow runs whose original trigger is no longer relevant. ## Scope ๐Ÿ“‹ -This directory contains helpers invoked from workflows that listen on `pull_request_target: closed`, `pull_request_target: converted_to_draft`, and `delete`. The helpers call the GitHub Actions API to cancel runs whose original trigger is no longer relevant (a closed PR, a deleted branch). Helpers MUST NOT be called from workflows that have not received the corresponding lifecycle event, because cancelling unrelated runs would mask real failures and waste accumulated work. +This directory contains helpers invoked from workflows that listen on `pull_request_target`, `push`, and `delete`. The helpers call the GitHub Actions API to cancel runs made obsolete by a closed PR, a deleted branch, or a newer commit on the same PR or branch. Helpers MUST NOT be called from workflows that have not received one of those events, because cancelling unrelated runs would mask real failures and waste accumulated work. + +## Superseding runs ๐Ÿ” + +On a long orchestrator sweep the concurrency group sometimes fails to reap its occupant: the occupant's run-level status sits on `queued` โ€” the normal state of a run whose matrix jobs are still waiting for runners โ€” and the newer run parks on `pending` behind it until someone cancels the sweep by hand. Whether `queued` is the cause or another symptom cannot be decided from outside GitHub; what is observable is that the group does not always reap. The API cancel does not depend on any of that, so [entry-cancel-superseded.yml](../../../.github/workflows/entry-cancel-superseded.yml) calls these helpers on every new commit as well. That workflow deliberately declares no concurrency group: the run holding a group cannot be the run that frees it. + +The group stays primary. It reaps within seconds of a run being created and needs no runner, while the fallback first has to win a runner slot โ€” from the very pool the superseded sweep is saturating, so it is slowest exactly when it is needed. Measured waits in this repository range from under a minute to about twenty. That is the cost of the fallback, and the reason it is a fallback rather than the mechanism. + +Three variables keep the fallback inside the group's bounds: + +- `KEEP_NEWEST_PER` โ€” keeps the newest run of each group instance alive and cancels only the older ones, which is the rule the concurrency group itself applies. It is what makes the fallback safe against races: the head SHA from the event payload goes stale while the job waits for a runner, and a `[skip ci]` or `GITHUB_TOKEN` push moves the branch tip without creating a run at all. Selecting by "not the current head" would then cancel the newest commit's CI and spare the stale one, or leave the branch with no CI at all. Selecting by "not the newest run" cannot, in any ordering. + + The value must mirror how the backed-up group is keyed. `all` treats every matched run as one instance โ€” correct for `global-ci--`, which spans both `entry-push-latest.yml` and `entry-manual-steer.yml`, so a push must be able to reap a manual sweep. `event` keeps one instance per event name โ€” correct for `pr-ci---pr-`. Grouping any finer than the real key spares a run the group would have reaped: per-workflow grouping leaves the manual sweep alive, because it is the newest run of its own workflow. +- `CURRENT_RUN_ID` โ€” keeps the calling run itself alive. +- `INCLUDE_PATHS` โ€” newline-separated workflow paths, the members of the concurrency group being backed up. Without it the helpers would also cancel runs the group never governed, such as the `cron-*` workflows that listen on `push`. Derive the list from the `concurrency:` blocks, not from what looks related: `entry-delete-branch.yml` keys its group on the *deleted* ref, so it is not a member of a push's group, and listing it would make a push to `main` cancel an unrelated branch cleanup. A value that lists no path at all aborts rather than silently matching nothing. + +Leave `KEEP_NEWEST_PER` and `INCLUDE_PATHS` unset to cancel every matching run, as the lifecycle events do โ€” a closed PR and a deleted branch have no run left that deserves to survive. A fallback also mirrors whatever gates its group: `global-ci-*` cancels on every ref except `main`, so the push job carries the same `github.ref_name != 'main'` guard, while `pr-ci-*` is declared `cancel-in-progress: true` unconditionally, so the pull request job is ungated too. + +`FORCE_CANCEL_AFTER_SECONDS` turns the cancel into an escalation. A cancel request does not stop a running step: the runner asks it to end, and a step that ignores the signal keeps going until its own `timeout-minutes`, which is 350 for a deploy. The concurrency group holds the newer run on `pending` until the occupant is *terminal*, not until it is cancel-requested, so a superseded sweep can block its branch for hours after being told to stop -- measured at eight minutes and counting, with ten deploy jobs untouched. After the wait, every run that is still not `completed` gets [`force-cancel`](https://docs.github.com/en/rest/actions/workflow-runs), which bypasses the conditions that keep it alive. The skipped cleanup steps are the price, and for a run that has already been superseded its artefacts are of no use to anyone. Leave the variable unset to cancel and walk away, which is what a closed pull request and a deleted branch want. + +Every selected run is attempted before anything is reported; abandoning the rest on the first rejection would leave them burning runners. `HTTP 409` means the run already finished and is not a rejection at all. Any other rejection is logged as an `ERROR` line, but only a denied token fails the job โ€” a rate limit or a run that vanished between listing and cancel is transient, and a red check for those is a red check nobody reads. + +"Newest" means the run that entered the group last, so the helpers sort on `run_started_at` and fall back to `created_at`. A re-run keeps the `created_at` of its first attempt while re-entering the group as the newest member, and sorting on `created_at` would cancel it as the oldest. + +Two open pull requests that share a head repository *and* a head branch, to different bases, cannot be told apart from the run payload: the runs of a fork PR carry an empty `pull_requests` array, the same `head_branch` and the same `head_sha`. The helper therefore asks the API whether any other open pull request shares that head, and drops the branch matcher while one does โ€” cancelling nothing beats cancelling the wrong pull request. If that lookup itself fails the matcher stays on, because a failed lookup is far more likely than a shared head. + +The branch-name matcher normally also requires the run's head repository to be the pull request's own. Two cases relax that: a run whose `head_repository` the API omits, and a pull request whose head fork has been deleted, where the event payload carries no head repository either. Both are matched on the branch name alone, because otherwise their runs would keep going forever โ€” and neither field is something a contributor can influence. The ambiguity check above is what makes that safe: it runs whenever a head branch is known, with or without a repository, so a shared branch name still disables the matcher rather than cancelling the wrong pull request. For the workflow catalog that drives these calls see [workflows.md](../../../docs/contributing/tools/github/actions/workflows.md). diff --git a/scripts/github/cancel/branch_runs.sh b/scripts/github/cancel/branch_runs.sh new file mode 100755 index 0000000000..5663cb6b1a --- /dev/null +++ b/scripts/github/cancel/branch_runs.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +set -euo pipefail + +: "${BRANCH:?Missing BRANCH}" +: "${GH_TOKEN:?Missing GH_TOKEN}" +: "${REPOSITORY:?Missing REPOSITORY}" +CURRENT_RUN_ID="${CURRENT_RUN_ID:-}" +INCLUDE_PATHS="${INCLUDE_PATHS:-}" +KEEP_NEWEST_PER="${KEEP_NEWEST_PER:-}" +FORCE_CANCEL_AFTER_SECONDS="${FORCE_CANCEL_AFTER_SECONDS:-}" + +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=scripts/github/cancel/lib.sh +source "${SCRIPT_DIR}/lib.sh" + +require_tools +validate_include_paths +validate_keep_newest_per +validate_force_cancel_after + +echo "Searching active workflow runs for branch: ${BRANCH}" + +runs="$(collect_runs)" + +run_ids="$( + printf '%s\n' "${runs}" | jq -s -r \ + --arg branch "${BRANCH}" \ + --arg current_run_id "${CURRENT_RUN_ID}" \ + --arg include_paths "${INCLUDE_PATHS}" \ + --arg keep_newest "${KEEP_NEWEST_PER}" ' + def drop_newest: sort_by([(.run_started_at // .created_at), .id]) | .[:-1]; + def allowlist: + $include_paths | split("\n") | map(gsub("^\\s+|\\s+$"; "")) | map(select(length > 0)); + + allowlist as $paths + | unique_by(.id) + | map( + select(.path != ".github/workflows/entry-pr-closed-cancel-workflows.yml") + | select($current_run_id == "" or (.id | tostring) != $current_run_id) + | select($include_paths == "" or ((.path // "") | IN($paths[]))) + | select( + .head_branch == $branch + or any(.pull_requests[]?; (.head.ref // "") == $branch) + ) + ) + | (if $keep_newest == "all" then drop_newest + elif $keep_newest == "event" then + group_by(.event // "") | map(drop_newest) | flatten + else . end) + | .[].id + ' +)" + +cancel_all "${run_ids}" diff --git a/scripts/github/cancel/deleted_branch_runs.sh b/scripts/github/cancel/deleted_branch_runs.sh deleted file mode 100755 index 24abde67bc..0000000000 --- a/scripts/github/cancel/deleted_branch_runs.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -: "${BRANCH:?Missing BRANCH}" -: "${GH_TOKEN:?Missing GH_TOKEN}" -: "${REPOSITORY:?Missing REPOSITORY}" - -if ! command -v gh >/dev/null 2>&1; then - echo "ERROR: gh CLI not found." >&2 - exit 1 -fi - -if ! command -v jq >/dev/null 2>&1; then - echo "ERROR: jq not found." >&2 - exit 1 -fi - -echo "Searching active workflow runs for deleted branch: ${BRANCH}" - -cancel_runs_by_status() { - local status="$1" - local run_ids - - run_ids="$( - gh api --paginate \ - -H "Accept: application/vnd.github+json" \ - "/repos/${REPOSITORY}/actions/runs?status=${status}&per_page=100" | - jq -r --arg branch "${BRANCH}" ' - .workflow_runs[] - | select(.path != ".github/workflows/entry-pr-closed-cancel-workflows.yml") - | select( - .head_branch == $branch - or any(.pull_requests[]?; (.head.ref // "") == $branch) - ) - | .id - ' | - sort -u - )" - - if [[ -z "${run_ids}" ]]; then - echo "No ${status} runs found for ${BRANCH}" - return 0 - fi - - while read -r run_id; do - [[ -n "${run_id}" ]] || continue - echo "Cancelling ${status} run ${run_id}" - if ! gh api \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - "/repos/${REPOSITORY}/actions/runs/${run_id}/cancel" \ - >/dev/null; then - echo "Run ${run_id} could not be cancelled, likely because it already completed" - fi - done <<<"${run_ids}" -} - -cancel_runs_by_status requested -cancel_runs_by_status pending -cancel_runs_by_status waiting -cancel_runs_by_status queued -cancel_runs_by_status in_progress diff --git a/scripts/github/cancel/lib.sh b/scripts/github/cancel/lib.sh new file mode 100755 index 0000000000..853f08e6a3 --- /dev/null +++ b/scripts/github/cancel/lib.sh @@ -0,0 +1,193 @@ +#!/usr/bin/env bash +# Shared by branch_runs.sh and pull_request_runs.sh. Expects REPOSITORY, +# GH_TOKEN and INCLUDE_PATHS to be set by the caller. + +RUN_STATUSES=(requested pending waiting queued in_progress) + +require_tools() { + local tool + + for tool in gh jq; do + if ! command -v "${tool}" >/dev/null 2>&1; then + echo "ERROR: ${tool} not found." >&2 + exit 1 + fi + done +} + +# A non-empty INCLUDE_PATHS that trims to nothing would silently select no run +# at all, turning the caller into a no-op that still reports success. +validate_include_paths() { + if [[ -z "${INCLUDE_PATHS}" ]]; then + return 0 + fi + + if [[ -z "$(printf '%s' "${INCLUDE_PATHS}" | tr -d '[:space:]')" ]]; then + echo "ERROR: INCLUDE_PATHS is set but lists no workflow path." >&2 + exit 1 + fi + + echo "Restricted to workflows:" + printf '%s\n' "${INCLUDE_PATHS}" | sed '/^[[:space:]]*$/d;s/^/ /' +} + +# Mirrors the key of the concurrency group being backed up: `all` for a group +# that spans every event on a ref, `event` for one whose key contains the event +# name. Grouping any finer keeps a run alive that the group would have reaped. +validate_force_cancel_after() { + if [[ -z "${FORCE_CANCEL_AFTER_SECONDS}" ]]; then + return 0 + fi + + if [[ ! "${FORCE_CANCEL_AFTER_SECONDS}" =~ ^[0-9]+$ ]]; then + echo "ERROR: FORCE_CANCEL_AFTER_SECONDS must be a whole number of seconds." >&2 + exit 1 + fi +} + +validate_keep_newest_per() { + case "${KEEP_NEWEST_PER}" in + "" | all | event) ;; + *) + echo "ERROR: KEEP_NEWEST_PER must be empty, 'all' or 'event'." >&2 + exit 1 + ;; + esac +} + +# Assign the result with `runs="$(collect_runs)"`, never pipe this function +# directly: on the left of a pipeline bash drops its exit status, and a failed +# page would silently narrow the run set instead of aborting. +collect_runs() { + local status + local payload + + for status in "${RUN_STATUSES[@]}"; do + payload="$( + gh api --paginate \ + -H "Accept: application/vnd.github+json" \ + "/repos/${REPOSITORY}/actions/runs?status=${status}&per_page=100" + )" || return 1 + printf '%s' "${payload}" | jq -c '.workflow_runs[]' || return 1 + done +} + +cancel_run() { + local run_id="$1" + local response + + if response="$( + gh api \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + "/repos/${REPOSITORY}/actions/runs/${run_id}/cancel" 2>&1 + )"; then + return 0 + fi + + if [[ "${response}" == *"HTTP 409"* ]]; then + echo "Run ${run_id} was already completed or already cancelling" + return 0 + fi + + if [[ "${response}" == *"Resource not accessible"* ]]; then + CANCEL_PERMISSION_DENIED=1 + fi + + echo "ERROR: cancelling run ${run_id} failed: ${response}" >&2 + return 1 +} + +# A cancel request does not stop a running step. The runner asks it to end and +# a step that ignores the signal keeps going, bounded only by its own +# `timeout-minutes` -- 350 for a deploy. The concurrency group meanwhile holds +# the newer run on `pending` until the occupant is terminal, not until it is +# cancel-requested, so a superseded sweep can block the branch for hours after +# it was told to stop. `force-cancel` is GitHub's escalation for exactly that, +# and it is worth the skipped cleanup steps here: the artefacts of a run that +# has already been superseded are of no use to anyone. +force_cancel_stragglers() { + local run_ids="$1" + local run_id + local state + local stragglers="" + + if [[ -z "${FORCE_CANCEL_AFTER_SECONDS}" || -z "${run_ids}" ]]; then + return 0 + fi + + echo "Waiting ${FORCE_CANCEL_AFTER_SECONDS}s for the cancelled runs to end" + sleep "${FORCE_CANCEL_AFTER_SECONDS}" + + while read -r run_id; do + [[ -n "${run_id}" ]] || continue + state="$( + gh api \ + -H "Accept: application/vnd.github+json" \ + "/repos/${REPOSITORY}/actions/runs/${run_id}" --jq '.status' + )" || return 1 + if [[ "${state}" != "completed" ]]; then + stragglers+="${run_id}"$'\n' + fi + done <<<"${run_ids}" + + if [[ -z "${stragglers}" ]]; then + echo "Every cancelled run ended on its own" + return 0 + fi + + while read -r run_id; do + [[ -n "${run_id}" ]] || continue + echo "Force-cancelling run ${run_id}, still running after the cancel" + gh api \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + "/repos/${REPOSITORY}/actions/runs/${run_id}/force-cancel" >/dev/null || + echo "WARNING: force-cancelling run ${run_id} was rejected" >&2 + done <<<"${stragglers}" +} + +# One transient failure must not abandon the remaining runs: they would keep +# burning runners. Cancel everything, then report. Only a denied token is +# fatal โ€” a rate limit or a run that vanished between listing and cancel is +# transient, and painting the cleanup red for those trains everyone to ignore +# the red. Counting rejections instead would fail a one-run sweep on a single +# transient, which is the common shape for a branch delete. +cancel_all() { + local run_ids="$1" + local run_id + local failures=0 + local successes=0 + local cancelled="" + + CANCEL_PERMISSION_DENIED=0 + + if [[ -z "${run_ids}" ]]; then + echo "No superseded runs found" + return 0 + fi + + while read -r run_id; do + [[ -n "${run_id}" ]] || continue + echo "Cancelling run ${run_id}" + if cancel_run "${run_id}"; then + successes=$((successes + 1)) + cancelled+="${run_id}"$'\n' + else + failures=$((failures + 1)) + fi + done <<<"${run_ids}" + + force_cancel_stragglers "${cancelled}" + + if ((failures == 0)); then + return 0 + fi + + if ((CANCEL_PERMISSION_DENIED)); then + echo "ERROR: the token may not cancel runs; ${failures} of $((failures + successes)) rejected." >&2 + return 1 + fi + + echo "WARNING: ${failures} of $((failures + successes)) run(s) could not be cancelled." >&2 +} diff --git a/scripts/github/cancel/pull_request_runs.sh b/scripts/github/cancel/pull_request_runs.sh index 44eca4fafa..8abc9d7cc2 100755 --- a/scripts/github/cancel/pull_request_runs.sh +++ b/scripts/github/cancel/pull_request_runs.sh @@ -4,81 +4,109 @@ set -euo pipefail : "${PR_NUMBER:?Missing PR_NUMBER}" : "${GH_TOKEN:?Missing GH_TOKEN}" : "${REPOSITORY:?Missing REPOSITORY}" -: "${CURRENT_RUN_ID:?Missing CURRENT_RUN_ID}" PR_HEAD_REF="${PR_HEAD_REF:-}" PR_HEAD_SHA="${PR_HEAD_SHA:-}" PR_HEAD_REPOSITORY="${PR_HEAD_REPOSITORY:-}" +: "${CURRENT_RUN_ID:?Missing CURRENT_RUN_ID}" +INCLUDE_PATHS="${INCLUDE_PATHS:-}" +KEEP_NEWEST_PER="${KEEP_NEWEST_PER:-}" +FORCE_CANCEL_AFTER_SECONDS="${FORCE_CANCEL_AFTER_SECONDS:-}" -if ! command -v gh >/dev/null 2>&1; then - echo "ERROR: gh CLI not found." >&2 - exit 1 -fi +SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +# shellcheck source=scripts/github/cancel/lib.sh +source "${SCRIPT_DIR}/lib.sh" -if ! command -v jq >/dev/null 2>&1; then - echo "ERROR: jq not found." >&2 - exit 1 -fi +require_tools +validate_include_paths +validate_keep_newest_per +validate_force_cancel_after + +# A fork PR's runs carry an empty `pull_requests` array, so the branch matcher +# is all that is left โ€” and it cannot tell two pull requests apart that share a +# head repository and head branch. Rather than cancel the wrong one, drop the +# matcher for as long as the head is ambiguous. +disable_ambiguous_branch_fallback() { + local rivals + local -a query + + if [[ -z "${PR_HEAD_REF}" ]]; then + return 0 + fi + + query=(-f state=open -f per_page=100) + if [[ -n "${PR_HEAD_REPOSITORY}" ]]; then + query+=(-f "head=${PR_HEAD_REPOSITORY%%/*}:${PR_HEAD_REF}") + fi + + if ! rivals="$( + gh api --paginate \ + -H "Accept: application/vnd.github+json" \ + -X GET "/repos/${REPOSITORY}/pulls" \ + "${query[@]}" | + jq -s \ + --argjson pr_number "${PR_NUMBER}" \ + --arg head_ref "${PR_HEAD_REF}" \ + '[.[][] | select(.number != $pr_number and (.head.ref // "") == $head_ref)] | length' + )"; then + echo "WARNING: could not list open pull requests for the head; keeping the branch fallback" >&2 + return 0 + fi + + if [[ "${rivals}" != "0" ]]; then + echo "Branch fallback disabled: ${rivals} other open pull request(s) share ${PR_HEAD_REPOSITORY%%/*}:${PR_HEAD_REF}" + PR_HEAD_REF="" + fi +} echo "Searching active workflow runs for PR #${PR_NUMBER}" if [[ -n "${PR_HEAD_SHA}${PR_HEAD_REF}${PR_HEAD_REPOSITORY}" ]]; then echo "Fallback matching enabled for head.sha=${PR_HEAD_SHA:-} head.ref=${PR_HEAD_REF:-} head.repo=${PR_HEAD_REPOSITORY:-}" fi -cancel_runs_by_status() { - local status="$1" - local run_ids +disable_ambiguous_branch_fallback - run_ids="$( - gh api --paginate \ - -H "Accept: application/vnd.github+json" \ - "/repos/${REPOSITORY}/actions/runs?status=${status}&per_page=100" | - jq -r \ - --argjson pr_number "${PR_NUMBER}" \ - --argjson current_run_id "${CURRENT_RUN_ID}" \ - --arg pr_head_ref "${PR_HEAD_REF}" \ - --arg pr_head_sha "${PR_HEAD_SHA}" \ - --arg pr_head_repository "${PR_HEAD_REPOSITORY}" ' - .workflow_runs[] - | select(.id != $current_run_id) - | select(.event == "pull_request" or .event == "pull_request_target") - | select( - any(.pull_requests[]?; (.number // -1) == $pr_number) - or ($pr_head_sha != "" and (.head_sha // "") == $pr_head_sha) - or ( - $pr_head_ref != "" - and (.head_branch // "") == $pr_head_ref - and ( - $pr_head_repository == "" - or (.head_repository.full_name // "") == $pr_head_repository - or (.head_repository.full_name // "") == "" - ) - ) - ) - | .id - ' | - sort -u - )" +runs="$(collect_runs)" - if [[ -z "${run_ids}" ]]; then - echo "No ${status} runs found for PR #${PR_NUMBER}" - return 0 - fi +run_ids="$( + printf '%s\n' "${runs}" | jq -s -r \ + --argjson pr_number "${PR_NUMBER}" \ + --arg current_run_id "${CURRENT_RUN_ID}" \ + --arg pr_head_ref "${PR_HEAD_REF}" \ + --arg pr_head_sha "${PR_HEAD_SHA}" \ + --arg pr_head_repository "${PR_HEAD_REPOSITORY}" \ + --arg include_paths "${INCLUDE_PATHS}" \ + --arg keep_newest "${KEEP_NEWEST_PER}" ' + def drop_newest: sort_by([(.run_started_at // .created_at), .id]) | .[:-1]; + def allowlist: + $include_paths | split("\n") | map(gsub("^\\s+|\\s+$"; "")) | map(select(length > 0)); - while read -r run_id; do - [[ -n "${run_id}" ]] || continue - echo "Cancelling ${status} run ${run_id}" - if ! gh api \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - "/repos/${REPOSITORY}/actions/runs/${run_id}/cancel" \ - >/dev/null; then - echo "Run ${run_id} could not be cancelled, likely because it already completed" - fi - done <<<"${run_ids}" -} + allowlist as $paths + | unique_by(.id) + | map( + select($current_run_id == "" or (.id | tostring) != $current_run_id) + | select($include_paths == "" or ((.path // "") | IN($paths[]))) + | select(.event == "pull_request" or .event == "pull_request_target") + | select( + any(.pull_requests[]?; (.number // -1) == $pr_number) + or ($pr_head_sha != "" and (.head_sha // "") == $pr_head_sha) + or ( + $pr_head_ref != "" + and all(.pull_requests[]?; (.number // $pr_number) == $pr_number) + and (.head_branch // "") == $pr_head_ref + and ( + $pr_head_repository == "" + or (.head_repository.full_name // "") == $pr_head_repository + or (.head_repository.full_name // "") == "" + ) + ) + ) + ) + | (if $keep_newest == "all" then drop_newest + elif $keep_newest == "event" then + group_by(.event // "") | map(drop_newest) | flatten + else . end) + | .[].id + ' +)" -cancel_runs_by_status requested -cancel_runs_by_status pending -cancel_runs_by_status waiting -cancel_runs_by_status queued -cancel_runs_by_status in_progress +cancel_all "${run_ids}" diff --git a/skills/i8-quality-high/SKILL.md b/skills/i8-quality-high/SKILL.md new file mode 100644 index 0000000000..110c5f9290 --- /dev/null +++ b/skills/i8-quality-high/SKILL.md @@ -0,0 +1,54 @@ +--- +name: i8-quality-high +description: > + Run the full quality gate (make quality-high: docs, autoformat, the whole test + suite, then every lint target) in a loop until it is green end to end. Trigger + on /i8-quality-high or when the operator asks for the high gate before a + commit, a pull request, or a release. Infinito.Nexus specific. +--- + +Follow the instructions from AGENTS.md, then drive `make quality-high` to green. +It is `make quality` (docs, autoformat, test) followed by `make lint` โ€” every +lint target, so budget around ten minutes per pass. + +The fix loop and its forbidden shortcuts are the `test-fix` skill's; this skill +only pins the command and how to read its result. + +## Running a pass + +Run it in the background, streaming the full output to a log, and give the +operator the literal command to follow it: + + make quality-high 2>&1 | tee /tmp/make-quality-high-.log + tail -f /tmp/make-quality-high-.log + +Increment `` per pass so runs stay comparable. Nothing else may run while it +does โ€” no other test, script, or agent. The wall-clock budgets fail under +self-made load, and a stale `.ansible/.lock` from a parallel run breaks +ansible-lint silently. + +## Reading the result + +Judge by the two `๐Ÿ“Š per-target wall-clock` tables (one for the test phase, one +for lint) and any `FAILED TARGETS:` line โ€” never by the pipe exit code, which is +unreliable here. `docs` and `autoformat` write to the tree: run `git status` +after every pass and treat an unexpected diff as a finding, not as noise. + +## Fixing + +Every failure is fixed at its root. A lint hit is resolved by deleting the +offending construct, not by a `nocheck` marker, a loosened rule, or a target +dropped from the gate โ€” any suppression needs the operator's explicit approval +and a stated reason. + +Re-run the specific failing target first (`make test-unit`, `make lint-ansible`, +โ€ฆ), then the full `make quality-high` before declaring the gate green: a fix that +breaks a neighbouring target is not a fix. + +## Working mode + +Begin by clarifying every open requirement with the `active-listening` skill, +escalating any root-cause question you are not ~99% sure of to the `dialectic` +skill, then work under the `robot` skill until both phases pass clean. Report +calibrated confidence per the `confidence` skill. Do not commit unless the +operator asked for a commit. diff --git a/tests/integration/meta/workflows/test_cancel_pr_runs.py b/tests/integration/meta/workflows/test_cancel_pr_runs.py deleted file mode 100644 index 5ab6ad9f9f..0000000000 --- a/tests/integration/meta/workflows/test_cancel_pr_runs.py +++ /dev/null @@ -1,193 +0,0 @@ -import os -import shutil -import subprocess -import tempfile -import textwrap -import unittest -from pathlib import Path - -from utils.cache.files import read_text - -from . import PROJECT_ROOT - -SCRIPT_PATH = PROJECT_ROOT / "scripts" / "github" / "cancel" / "pull_request_runs.sh" -EMPTY_RUNS_JSON = '{"workflow_runs":[]}\n' - - -@unittest.skipUnless( - shutil.which("jq"), "jq is required for the shell script under test" -) -class TestCancelPullRequestRuns(unittest.TestCase): - def _write_fake_gh(self, temp_dir: Path) -> None: - fake_gh = temp_dir / "gh" - fake_gh.write_text( - textwrap.dedent( - """\ - #!/usr/bin/env bash - set -euo pipefail - - if [[ "${1:-}" != "api" ]]; then - echo "Unsupported gh invocation: $*" >&2 - exit 1 - fi - shift - - method="GET" - url="" - while [[ $# -gt 0 ]]; do - case "$1" in - --paginate) - shift - ;; - -H) - shift 2 - ;; - -X) - method="$2" - shift 2 - ;; - /repos/*) - url="$1" - shift - ;; - *) - shift - ;; - esac - done - - if [[ "${method}" == "POST" ]]; then - run_id="$(printf '%s\\n' "${url}" | sed -E 's#.*/actions/runs/([0-9]+)/cancel#\\1#')" - printf '%s\\n' "${run_id}" >> "${GH_FAKE_CANCEL_LOG}" - exit 0 - fi - - status="$(printf '%s\\n' "${url}" | sed -nE 's#.*[?&]status=([^&]+).*#\\1#p')" - cat "${GH_FAKE_RUNS_DIR}/${status}.json" - """ - ), - encoding="utf-8", - ) - fake_gh.chmod(0o755) - - def _run_script( - self, - *, - runs_by_status, - pr_head_ref="feature/makefile-wsl2", - pr_head_sha="deadbeef", - pr_head_repository="AlejandroRomanIbanez/core", - ): - with tempfile.TemporaryDirectory() as temp_dir_str: - temp_dir = Path(temp_dir_str) - runs_dir = temp_dir / "runs" - runs_dir.mkdir() - cancel_log = temp_dir / "cancel.log" - - for status in ["requested", "pending", "waiting", "queued", "in_progress"]: - (runs_dir / f"{status}.json").write_text( - runs_by_status.get(status, EMPTY_RUNS_JSON), - encoding="utf-8", - ) - - self._write_fake_gh(temp_dir) - - env = os.environ.copy() - env.update( - { - "PR_NUMBER": "106", - "PR_HEAD_REF": pr_head_ref, - "PR_HEAD_SHA": pr_head_sha, - "PR_HEAD_REPOSITORY": pr_head_repository, - "GH_TOKEN": "test-token", - "REPOSITORY": "kevinveenbirkenbach/infinito-nexus", - "CURRENT_RUN_ID": "6", - "GH_FAKE_RUNS_DIR": str(runs_dir), - "GH_FAKE_CANCEL_LOG": str(cancel_log), - "PATH": f"{temp_dir}:{env['PATH']}", - } - ) - - result = subprocess.run( - ["bash", str(SCRIPT_PATH)], - cwd=PROJECT_ROOT, - env=env, - capture_output=True, - text=True, - check=True, - ) - - cancelled = [] - if cancel_log.exists(): - cancelled = [ - line.strip() - for line in read_text(str(cancel_log)).splitlines() - if line.strip() - ] - return result, cancelled - - def test_cancels_matching_fork_run_when_pull_request_association_is_missing(self): - in_progress_runs = """\ -{"workflow_runs":[ - { - "id": 297, - "event": "pull_request", - "head_sha": "merge-sha-not-pr-head", - "head_branch": "feature/makefile-wsl2", - "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, - "pull_requests": [] - } -]} -""" - _, cancelled = self._run_script( - runs_by_status={"in_progress": in_progress_runs} - ) - self.assertEqual(cancelled, ["297"]) - - def test_does_not_cancel_run_from_other_fork_with_same_branch_name(self): - in_progress_runs = """\ -{"workflow_runs":[ - { - "id": 297, - "event": "pull_request", - "head_sha": "merge-sha-not-pr-head", - "head_branch": "feature/makefile-wsl2", - "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, - "pull_requests": [] - }, - { - "id": 298, - "event": "pull_request", - "head_sha": "another-merge-sha", - "head_branch": "feature/makefile-wsl2", - "head_repository": {"full_name": "someone-else/core"}, - "pull_requests": [] - } -]} -""" - _, cancelled = self._run_script( - runs_by_status={"in_progress": in_progress_runs} - ) - self.assertEqual(cancelled, ["297"]) - - def test_cancels_run_via_head_sha_when_branch_metadata_differs(self): - in_progress_runs = """\ -{"workflow_runs":[ - { - "id": 299, - "event": "pull_request_target", - "head_sha": "deadbeef", - "head_branch": "unexpected-branch-name", - "head_repository": {"full_name": "base-repo/core"}, - "pull_requests": [] - } -]} -""" - _, cancelled = self._run_script( - runs_by_status={"in_progress": in_progress_runs} - ) - self.assertEqual(cancelled, ["299"]) - - -if __name__ == "__main__": - unittest.main() diff --git a/tests/integration/meta/workflows/test_cancel_runs.py b/tests/integration/meta/workflows/test_cancel_runs.py new file mode 100644 index 0000000000..3e9f6a2d5f --- /dev/null +++ b/tests/integration/meta/workflows/test_cancel_runs.py @@ -0,0 +1,616 @@ +import os +import shutil +import subprocess +import tempfile +import textwrap +import unittest +from pathlib import Path + +from utils.cache.files import read_text + +from . import PROJECT_ROOT + +SCRIPT_PATH = PROJECT_ROOT / "scripts" / "github" / "cancel" / "pull_request_runs.sh" +BRANCH_SCRIPT_PATH = PROJECT_ROOT / "scripts" / "github" / "cancel" / "branch_runs.sh" +EMPTY_RUNS_JSON = '{"workflow_runs":[]}\n' + + +class CancelScriptMixin: + def _write_fake_gh(self, temp_dir: Path) -> None: + fake_gh = temp_dir / "gh" + fake_gh.write_text( + textwrap.dedent( + """\ + #!/usr/bin/env bash + set -euo pipefail + + if [[ "${1:-}" != "api" ]]; then + echo "Unsupported gh invocation: $*" >&2 + exit 1 + fi + shift + + method="GET" + url="" + while [[ $# -gt 0 ]]; do + case "$1" in + --paginate) + shift + ;; + -H) + shift 2 + ;; + -X) + method="$2" + shift 2 + ;; + /repos/*) + url="$1" + shift + ;; + *) + shift + ;; + esac + done + + if [[ "${method}" == "POST" && "${url}" == */force-cancel ]]; then + printf '%s\\n' "${url}" \ + | sed -E 's#.*/actions/runs/([0-9]+)/force-cancel#\\1#' \ + >> "${GH_FAKE_FORCE_LOG}" + exit 0 + fi + + if [[ "${method}" == "POST" ]]; then + run_id="$(printf '%s\\n' "${url}" | sed -E 's#.*/actions/runs/([0-9]+)/cancel#\\1#')" + if [[ -n "${GH_FAKE_POST_ERROR:-}" ]]; then + echo "${GH_FAKE_POST_ERROR}" >&2 + exit 1 + fi + if [[ -n "${GH_FAKE_POST_ERROR_ONCE:-}" \\ + && ! -f "${GH_FAKE_CANCEL_LOG}.once" ]]; then + touch "${GH_FAKE_CANCEL_LOG}.once" + echo "${GH_FAKE_POST_ERROR_ONCE}" >&2 + exit 1 + fi + printf '%s\\n' "${run_id}" >> "${GH_FAKE_CANCEL_LOG}" + exit 0 + fi + + if [[ "${url}" == */actions/runs/[0-9]* ]]; then + printf '%s\\n' "${GH_FAKE_RUN_STATUS:-completed}" + exit 0 + fi + + if [[ "${url}" == */pulls* ]]; then + cat "${GH_FAKE_RUNS_DIR}/pulls.json" + exit 0 + fi + + status="$(printf '%s\\n' "${url}" | sed -nE 's#.*[?&]status=([^&]+).*#\\1#p')" + if [[ "${status}" == "${GH_FAKE_GET_ERROR_STATUS:-}" ]]; then + echo "gh: simulated API failure for ${status}" >&2 + exit 1 + fi + cat "${GH_FAKE_RUNS_DIR}/${status}.json" + """ + ), + encoding="utf-8", + ) + fake_gh.chmod(0o755) + + def _run_cancel_script( + self, script_path, env_overrides, runs_by_status, check=True + ): + with tempfile.TemporaryDirectory() as temp_dir_str: + temp_dir = Path(temp_dir_str) + runs_dir = temp_dir / "runs" + runs_dir.mkdir() + cancel_log = temp_dir / "cancel.log" + + for status in ["requested", "pending", "waiting", "queued", "in_progress"]: + (runs_dir / f"{status}.json").write_text( + runs_by_status.get(status, EMPTY_RUNS_JSON), + encoding="utf-8", + ) + (runs_dir / "pulls.json").write_text( + runs_by_status.get("pulls", "[]\n"), encoding="utf-8" + ) + + self._write_fake_gh(temp_dir) + + env = os.environ.copy() + env.update( + { + "GH_TOKEN": "test-token", + "REPOSITORY": "kevinveenbirkenbach/infinito-nexus", + "GH_FAKE_RUNS_DIR": str(runs_dir), + "GH_FAKE_CANCEL_LOG": str(cancel_log), + "GH_FAKE_FORCE_LOG": str(temp_dir / "force.log"), + "PATH": f"{temp_dir}:{env['PATH']}", + **env_overrides, + } + ) + + result = subprocess.run( + ["bash", str(script_path)], + cwd=PROJECT_ROOT, + env=env, + capture_output=True, + text=True, + check=check, + ) + + cancelled = [] + if cancel_log.exists(): + cancelled = [ + line.strip() + for line in read_text(str(cancel_log)).splitlines() + if line.strip() + ] + force_log = temp_dir / "force.log" + self.forced = [] + if force_log.exists(): + self.forced = [ + line.strip() + for line in read_text(str(force_log)).splitlines() + if line.strip() + ] + return result, cancelled + + +@unittest.skipUnless( + shutil.which("jq"), "jq is required for the shell script under test" +) +class TestCancelPullRequestRuns(CancelScriptMixin, unittest.TestCase): + def _run_script( + self, + *, + runs_by_status, + pr_head_ref="feature/makefile-wsl2", + pr_head_sha="deadbeef", + pr_head_repository="AlejandroRomanIbanez/core", + include_paths="", + keep_newest_per="", + ): + return self._run_cancel_script( + SCRIPT_PATH, + { + "PR_NUMBER": "106", + "PR_HEAD_REF": pr_head_ref, + "PR_HEAD_SHA": pr_head_sha, + "PR_HEAD_REPOSITORY": pr_head_repository, + "INCLUDE_PATHS": include_paths, + "KEEP_NEWEST_PER": keep_newest_per, + "CURRENT_RUN_ID": "6", + }, + runs_by_status, + ) + + def test_cancels_matching_fork_run_when_pull_request_association_is_missing(self): + in_progress_runs = """\ +{"workflow_runs":[ + { + "id": 297, + "event": "pull_request", + "head_sha": "merge-sha-not-pr-head", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [] + } +]} +""" + _, cancelled = self._run_script( + runs_by_status={"in_progress": in_progress_runs} + ) + self.assertEqual(cancelled, ["297"]) + + def test_does_not_cancel_run_from_other_fork_with_same_branch_name(self): + in_progress_runs = """\ +{"workflow_runs":[ + { + "id": 297, + "event": "pull_request", + "head_sha": "merge-sha-not-pr-head", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [] + }, + { + "id": 298, + "event": "pull_request", + "head_sha": "another-merge-sha", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "someone-else/core"}, + "pull_requests": [] + } +]} +""" + _, cancelled = self._run_script( + runs_by_status={"in_progress": in_progress_runs} + ) + self.assertEqual(cancelled, ["297"]) + + def test_cancels_run_via_head_sha_when_branch_metadata_differs(self): + in_progress_runs = """\ +{"workflow_runs":[ + { + "id": 299, + "event": "pull_request_target", + "head_sha": "deadbeef", + "head_branch": "unexpected-branch-name", + "head_repository": {"full_name": "base-repo/core"}, + "pull_requests": [] + } +]} +""" + _, cancelled = self._run_script( + runs_by_status={"in_progress": in_progress_runs} + ) + self.assertEqual(cancelled, ["299"]) + + NEWEST_PER_GROUP_RUNS = """\ +{"workflow_runs":[ + { + "id": 300, + "event": "pull_request", + "path": ".github/workflows/entry-pr-change-orchestrate.yml", + "created_at": "2026-08-24T22:25:11Z", + "head_sha": "oldsha", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [{"number": 106}] + }, + { + "id": 301, + "event": "pull_request", + "path": ".github/workflows/entry-pr-change-orchestrate.yml", + "created_at": "2026-08-25T07:54:16Z", + "head_sha": "newsha", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [{"number": 106}] + }, + { + "id": 302, + "event": "pull_request_target", + "path": ".github/workflows/entry-pr-change-orchestrate.yml", + "created_at": "2026-08-25T07:54:15Z", + "head_sha": "newsha", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [{"number": 106}] + } +]} +""" + + FORK_SHAPED_RUNS = """\ +{"workflow_runs":[ + { + "id": 320, + "event": "pull_request", + "created_at": "2026-08-24T22:25:11Z", + "head_sha": "oldsha", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [] + } +]} +""" + + def test_cancels_a_fork_run_when_the_head_is_unambiguous(self): + _, cancelled = self._run_script( + runs_by_status={"queued": self.FORK_SHAPED_RUNS} + ) + self.assertEqual(cancelled, ["320"]) + + def test_keeps_fork_runs_when_another_pull_request_shares_the_head(self): + result, cancelled = self._run_script( + runs_by_status={ + "queued": self.FORK_SHAPED_RUNS, + "pulls": ( + '[{"number": 106, "head": {"ref": "feature/makefile-wsl2"}},' + ' {"number": 107, "head": {"ref": "feature/makefile-wsl2"}}]\n' + ), + }, + ) + self.assertEqual(cancelled, []) + self.assertIn("Branch fallback disabled", result.stdout) + + def test_cancels_a_run_whose_association_names_this_pull_request(self): + queued_runs = """\ +{"workflow_runs":[ + { + "id": 310, + "event": "pull_request", + "created_at": "2026-08-24T22:25:11Z", + "head_sha": "oldsha", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [{"no_number_field": true}] + } +]} +""" + _, cancelled = self._run_script(runs_by_status={"queued": queued_runs}) + self.assertEqual(cancelled, ["310"]) + + def test_keeps_a_run_associated_with_a_different_pull_request(self): + queued_runs = """\ +{"workflow_runs":[ + { + "id": 311, + "event": "pull_request", + "created_at": "2026-08-24T22:25:11Z", + "head_sha": "oldsha", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [{"number": 999}] + } +]} +""" + _, cancelled = self._run_script(runs_by_status={"queued": queued_runs}) + self.assertEqual(cancelled, []) + + DELETED_FORK_RUNS = """\ +{"workflow_runs":[ + { + "id": 330, + "event": "pull_request", + "created_at": "2026-08-24T22:25:11Z", + "head_sha": "oldsha", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [] + } +]} +""" + + def test_cancels_runs_of_a_pull_request_whose_fork_was_deleted(self): + _, cancelled = self._run_script( + runs_by_status={"queued": self.DELETED_FORK_RUNS}, + pr_head_repository="", + ) + self.assertEqual(cancelled, ["330"]) + + def test_keeps_them_when_another_pull_request_shares_the_branch(self): + result, cancelled = self._run_script( + runs_by_status={ + "queued": self.DELETED_FORK_RUNS, + "pulls": '[{"number": 107, "head": {"ref": "feature/makefile-wsl2"}}]\n', + }, + pr_head_repository="", + ) + self.assertEqual(cancelled, []) + self.assertIn("Branch fallback disabled", result.stdout) + + def test_keeps_the_newest_run_of_every_event(self): + _, cancelled = self._run_script( + runs_by_status={"queued": self.NEWEST_PER_GROUP_RUNS}, + keep_newest_per="event", + ) + self.assertEqual(cancelled, ["300"]) + + def test_keeps_the_newest_run_even_when_the_head_sha_moved_on(self): + _, cancelled = self._run_script( + runs_by_status={"queued": self.NEWEST_PER_GROUP_RUNS}, + keep_newest_per="event", + pr_head_sha="a-third-sha-nobody-has-a-run-for", + ) + self.assertEqual(cancelled, ["300"]) + + def test_keeps_pull_request_runs_outside_the_concurrency_group(self): + queued_runs = """\ +{"workflow_runs":[ + { + "id": 302, + "event": "pull_request", + "path": ".github/workflows/entry-pr-change-orchestrate.yml", + "head_sha": "cafebabe", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [{"number": 106}] + }, + { + "id": 303, + "event": "pull_request_target", + "path": ".github/workflows/entry-pr-open-dependabot-close.yml", + "head_sha": "cafebabe", + "head_branch": "feature/makefile-wsl2", + "head_repository": {"full_name": "AlejandroRomanIbanez/core"}, + "pull_requests": [{"number": 106}] + } +]} +""" + _, cancelled = self._run_script( + runs_by_status={"queued": queued_runs}, + include_paths=".github/workflows/entry-pr-change-orchestrate.yml", + ) + self.assertEqual(cancelled, ["302"]) + + +@unittest.skipUnless( + shutil.which("jq"), "jq is required for the shell script under test" +) +class TestCancelBranchRuns(CancelScriptMixin, unittest.TestCase): + BRANCH_RUNS = """\ +{"workflow_runs":[ + { + "id": 400, + "path": ".github/workflows/entry-push-latest.yml", + "event": "push", + "created_at": "2026-08-25T07:54:12Z", + "head_sha": "newsha", + "head_branch": "feature/svc-net-tor", + "pull_requests": [] + }, + { + "id": 401, + "path": ".github/workflows/entry-manual-steer.yml", + "event": "workflow_dispatch", + "created_at": "2026-08-24T22:33:34Z", + "head_sha": "oldsha", + "head_branch": "feature/svc-net-tor", + "pull_requests": [] + }, + { + "id": 402, + "path": ".github/workflows/entry-push-latest.yml", + "event": "push", + "created_at": "2026-08-24T22:25:11Z", + "head_sha": "oldsha", + "head_branch": "other-branch", + "pull_requests": [] + }, + { + "id": 403, + "path": ".github/workflows/entry-push-latest.yml", + "event": "push", + "created_at": "2026-08-24T22:25:11Z", + "head_sha": "oldsha", + "head_branch": "feature/svc-net-tor", + "pull_requests": [] + } +]} +""" + + def _run_script(self, check=True, **env_overrides): + return self._run_cancel_script( + BRANCH_SCRIPT_PATH, + {"BRANCH": "feature/svc-net-tor", **env_overrides}, + {"queued": self.BRANCH_RUNS}, + check=check, + ) + + def test_tolerates_whitespace_around_allowlist_entries(self): + _, cancelled = self._run_script( + INCLUDE_PATHS=" .github/workflows/entry-manual-steer.yml \n\n", + ) + self.assertEqual(cancelled, ["401"]) + + def test_fails_loudly_when_a_cancel_is_rejected(self): + result, cancelled = self._run_script( + check=False, + GH_FAKE_POST_ERROR="gh: HTTP 403: Resource not accessible by integration", + ) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(cancelled, []) + self.assertIn("ERROR: cancelling run", result.stderr) + + def test_accepts_a_run_that_already_finished(self): + result, cancelled = self._run_script( + check=False, + GH_FAKE_POST_ERROR="gh: HTTP 409: Conflict", + ) + self.assertEqual(result.returncode, 0) + self.assertEqual(cancelled, []) + self.assertIn("already completed", result.stdout) + + def test_keeps_only_the_newest_run_of_the_whole_group(self): + _, cancelled = self._run_script(KEEP_NEWEST_PER="all") + self.assertEqual(sorted(cancelled), ["401", "403"]) + + def test_rejects_an_unknown_grouping_mode(self): + result, cancelled = self._run_script(check=False, KEEP_NEWEST_PER="true") + self.assertNotEqual(result.returncode, 0) + self.assertEqual(cancelled, []) + self.assertIn("KEEP_NEWEST_PER must be", result.stderr) + + def test_cancels_every_branch_run_without_exclusions(self): + _, cancelled = self._run_script() + self.assertEqual(cancelled, ["400", "401", "403"]) + + def test_force_cancels_runs_that_ignore_the_cancel(self): + _, cancelled = self._run_script( + KEEP_NEWEST_PER="all", + FORCE_CANCEL_AFTER_SECONDS="0", + GH_FAKE_RUN_STATUS="in_progress", + ) + self.assertEqual(sorted(cancelled), ["401", "403"]) + self.assertEqual(sorted(self.forced), ["401", "403"]) + + def test_leaves_runs_that_ended_on_their_own(self): + _, cancelled = self._run_script( + KEEP_NEWEST_PER="all", + FORCE_CANCEL_AFTER_SECONDS="0", + GH_FAKE_RUN_STATUS="completed", + ) + self.assertEqual(sorted(cancelled), ["401", "403"]) + self.assertEqual(self.forced, []) + + def test_never_force_cancels_without_the_knob(self): + _, cancelled = self._run_script( + KEEP_NEWEST_PER="all", + GH_FAKE_RUN_STATUS="in_progress", + ) + self.assertEqual(sorted(cancelled), ["401", "403"]) + self.assertEqual(self.forced, []) + + def test_rejects_a_non_numeric_force_cancel_delay(self): + result, cancelled = self._run_script( + check=False, FORCE_CANCEL_AFTER_SECONDS="soon" + ) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(cancelled, []) + self.assertIn("whole number of seconds", result.stderr) + + def test_keeps_runs_outside_the_concurrency_group(self): + _, cancelled = self._run_script( + INCLUDE_PATHS=".github/workflows/entry-manual-steer.yml\n", + ) + self.assertEqual(cancelled, ["401"]) + + def test_aborts_on_an_allowlist_that_lists_nothing(self): + result, cancelled = self._run_script(check=False, INCLUDE_PATHS=" \n \n") + self.assertNotEqual(result.returncode, 0) + self.assertEqual(cancelled, []) + self.assertIn("lists no workflow path", result.stderr) + + def test_stays_green_when_only_some_cancels_are_rejected(self): + result, cancelled = self._run_script( + check=False, + GH_FAKE_POST_ERROR_ONCE="gh: HTTP 403: rate limit", + ) + self.assertEqual(result.returncode, 0) + self.assertEqual(len(cancelled), 2) + self.assertIn("WARNING: 1 of 3 run(s) could not be cancelled", result.stderr) + + def test_a_single_transient_rejection_does_not_fail_the_job(self): + result, cancelled = self._run_script( + check=False, + INCLUDE_PATHS=".github/workflows/entry-manual-steer.yml\n", + GH_FAKE_POST_ERROR="gh: HTTP 404: Not Found", + ) + self.assertEqual(result.returncode, 0) + self.assertEqual(cancelled, []) + self.assertEqual(result.stdout.count("Cancelling run "), 1) + + def test_fails_loudly_when_a_run_listing_fails(self): + result, cancelled = self._run_script( + check=False, + GH_FAKE_GET_ERROR_STATUS="queued", + ) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(cancelled, []) + + def test_attempts_every_run_and_stays_green_on_transient_rejections(self): + result, cancelled = self._run_script( + check=False, + GH_FAKE_POST_ERROR="gh: HTTP 500: Internal Server Error", + ) + self.assertEqual(result.returncode, 0) + self.assertEqual(cancelled, []) + self.assertEqual(result.stdout.count("Cancelling run "), 3) + self.assertIn("3 of 3 run(s) could not be cancelled", result.stderr) + + def test_fails_when_the_token_may_not_cancel(self): + result, cancelled = self._run_script( + check=False, + GH_FAKE_POST_ERROR="gh: Resource not accessible by integration (HTTP 403)", + ) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(cancelled, []) + self.assertIn("token may not cancel runs", result.stderr) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/integration/meta/workflows/test_cancel_superseded_workflow.py b/tests/integration/meta/workflows/test_cancel_superseded_workflow.py new file mode 100644 index 0000000000..d705619e87 --- /dev/null +++ b/tests/integration/meta/workflows/test_cancel_superseded_workflow.py @@ -0,0 +1,180 @@ +import re +import unittest + +from utils.cache.files import read_text +from utils.cache.yaml import load_yaml_any + +from . import PROJECT_ROOT + +WORKFLOWS = PROJECT_ROOT / ".github" / "workflows" +SUPERSEDED = WORKFLOWS / "entry-cancel-superseded.yml" +PUSH_ENTRY = WORKFLOWS / "entry-push-latest.yml" +PR_ENTRY = WORKFLOWS / "entry-pr-change-orchestrate.yml" +CANCEL_JOBS = { + "cancel-branch-runs": "scripts/github/cancel/branch_runs.sh", + "cancel-pull-request-runs": "scripts/github/cancel/pull_request_runs.sh", +} + + +def load(path): + return load_yaml_any(str(path), default_if_missing={}) + + +def workflow_files(): + yield from sorted(WORKFLOWS.glob("*.yml")) + yield from sorted(WORKFLOWS.glob("*.yaml")) + + +def concurrency_groups(workflow): + """Every group string a workflow declares, workflow-level and job-level. + + GitHub accepts both a bare string and a mapping, so a test that only + understands the mapping form goes blind exactly when someone adds the + other one. + """ + found = [] + for block in [workflow, *workflow.get("jobs", {}).values()]: + if not isinstance(block, dict): + continue + concurrency = block.get("concurrency") + if isinstance(concurrency, str): + found.append(concurrency) + elif isinstance(concurrency, dict): + found.append(concurrency.get("group", "")) + return found + + +PR_GROUP = load(PR_ENTRY)["concurrency"]["group"] + + +class TestCancelSupersededWorkflow(unittest.TestCase): + def setUp(self): + self.workflow = load(SUPERSEDED) + + def test_declares_no_concurrency_group(self): + self.assertEqual( + concurrency_groups(self.workflow), + [], + "entry-cancel-superseded.yml frees blocked concurrency groups; a group " + "of its own would queue it behind the very run it has to cancel", + ) + + def test_push_allowlist_matches_the_group_it_backs_up(self): + group_members = set() + for path in workflow_files(): + for group in concurrency_groups(load(path)): + if "global-ci-" in group and "github.ref_name" in group: + group_members.add(f".github/workflows/{path.name}") + + allowlist = { + line.strip() + for line in self._env("cancel-branch-runs", "INCLUDE_PATHS").splitlines() + if line.strip() + } + self.assertEqual( + allowlist, + group_members, + "the push allowlist must be exactly the members of the concurrency " + "group it backs up, otherwise it over- or under-cancels", + ) + + def test_each_job_groups_the_way_its_concurrency_group_is_keyed(self): + expected = { + "cancel-branch-runs": ("all", load(PUSH_ENTRY)["concurrency"]["group"]), + "cancel-pull-request-runs": ("event", PR_GROUP), + } + for job, (mode, group) in expected.items(): + keyed_on_event = "github.event_name" in group + self.assertEqual( + mode == "event", + keyed_on_event, + f"{job}: the grouping must mirror the concurrency group key {group}", + ) + self.assertEqual( + self._env(job, "KEEP_NEWEST_PER"), + mode, + f"{job} must select by 'not the newest run in the group', not by head " + "SHA: the payload SHA goes stale while the job waits for a runner, " + "and a skipped or token push moves the tip without creating a run", + ) + + def test_push_job_mirrors_the_cancel_rule_of_its_group(self): + gate = load(PUSH_ENTRY)["concurrency"]["cancel-in-progress"] + inner = gate.removeprefix("${{").removesuffix("}}").strip() + self.assertEqual( + self.workflow["jobs"]["cancel-branch-runs"]["if"], + "${{ github.event_name == 'push' && " + inner + " }}", + "the fallback mirrors the cancel rule of the group it backs up; a " + "changed polarity or a dropped event guard must fail here", + ) + + def test_covers_every_trigger_of_the_workflows_it_backs_up(self): + triggers = self.workflow[True] + self.assertEqual( + sorted(triggers["push"]["branches"]), + sorted( + branch + for branch in load(PUSH_ENTRY)[True]["push"]["branches"] + if branch != "main" + ), + "a branch that starts CI but no fallback keeps the deadlock; main is " + "excluded because runs on main are never cancelled", + ) + pr_types = set() + for event, block in load(PR_ENTRY)[True].items(): + if str(event).startswith("pull_request"): + pr_types.update(block["types"]) + self.assertEqual( + set(triggers["pull_request_target"]["types"]), + pr_types, + "an event that starts a PR run but no fallback keeps the deadlock", + ) + + def test_pull_request_job_runs_for_pull_request_target_only(self): + self.assertEqual( + self.workflow["jobs"]["cancel-pull-request-runs"]["if"], + "${{ github.event_name == 'pull_request_target' }}", + ) + + def _step(self, job_name): + run_suffix = CANCEL_JOBS[job_name] + steps = [ + step + for step in self.workflow["jobs"][job_name]["steps"] + if run_suffix in step.get("run", "") + ] + self.assertEqual( + len(steps), 1, f"expected one step running {run_suffix} in job {job_name}" + ) + return steps[0] + + def _env(self, job_name, key): + return self._step(job_name)["env"][key] + + +class TestCancelHelperReferences(unittest.TestCase): + def test_every_referenced_shell_script_exists(self): + pattern = re.compile(r"scripts/github/[A-Za-z0-9_./-]+\.sh") + for path in workflow_files(): + for match in pattern.findall(read_text(str(path))): + self.assertTrue( + (PROJECT_ROOT / match).is_file(), + f"{path.name} references missing {match}", + ) + + def test_every_sourced_helper_exists(self): + pattern = re.compile(r'source "\$\{SCRIPT_DIR\}/([A-Za-z0-9_.-]+)"') + cancel_dir = PROJECT_ROOT / "scripts" / "github" / "cancel" + sourced = set() + for path in sorted(cancel_dir.glob("*.sh")): + for name in pattern.findall(read_text(str(path))): + sourced.add(name) + self.assertTrue( + (cancel_dir / name).is_file(), + f"{path.name} sources missing {name}", + ) + self.assertIn("lib.sh", sourced) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/lint/ansible/jinja/test_compose_template_structure.py b/tests/lint/ansible/jinja/test_compose_template_structure.py index d652ef51dc..3cb80f2b53 100644 --- a/tests/lint/ansible/jinja/test_compose_template_structure.py +++ b/tests/lint/ansible/jinja/test_compose_template_structure.py @@ -51,6 +51,12 @@ The rules this test enforces, distilled from that skeleton: inside the block). ``lstrip_blocks`` strips the indent, so this is purely for readability. Dashed tags, ``{%+`` tags, ``{% filter %}`` / ``{% macro %}``, and inline compound tags are left to their author. +8. **restart-policy** - every service body carries a restart policy, either by + including ``roles/sys-svc-container/templates/base.yml.j2`` (which emits it) + or by calling ``{{ lookup('compose_restart') }}`` directly. A service body + that only includes ``deploy.yml.j2`` renders ``deploy.restart_policy`` for + swarm and NOTHING for compose, so Docker applies its own ``no`` default and + the container stays down after any daemon restart. Scope: every ``roles/*/templates/*compose.yml.j2`` (the canonical per-role stack file). ``compose.override.yml.j2`` and @@ -81,6 +87,12 @@ _BASE_INCLUDE = re.compile( r"\{%-?\s*include\s+'roles/sys-svc-compose/templates/base\.yml\.j2'\s*-?%\}" ) +_CONTAINER_BASE_INCLUDE = re.compile( + r"\{%-?\s*include\s+'roles/sys-svc-container/templates/base\.yml\.j2'\s*-?%\}" +) + +_RESTART_LOOKUP = re.compile(r"lookup\(\s*'compose_restart'") + _SERVICE_KEY = re.compile(r"^ (?P(?:\{\{.*?\}\}|[A-Za-z0-9_.-])+):[ \t]*$") _SERVICE_NAME_KEY = re.compile(r"^\{\{\s*service_name\s*\}\}$") @@ -326,6 +338,26 @@ def find_structure_violations(lines: list[str]) -> list[tuple[int, str]]: if match and match.group("var") in _SERVICE_SCOPED_VARS: late_idxs.add(i) + for k in key_idxs: + nxt = min((b for b in boundaries if b > k), default=region_end) + body = lines[k + 1 : nxt] + if any( + _CONTAINER_BASE_INCLUDE.search(w) or _RESTART_LOOKUP.search(w) for w in body + ): + continue + findings.append( + ( + k + 1, + ( + "service body declares no restart policy โ€” include " + "`roles/sys-svc-container/templates/base.yml.j2` or add " + "`{{ lookup('compose_restart') }}`; without it compose falls back " + "to Docker's `no` and the container stays down after a daemon " + "restart" + ), + ) + ) + for i in region: line = lines[i] match = _SET_LINE.match(line) @@ -415,7 +447,8 @@ class TestComposeTemplateStructure(unittest.TestCase): "`*compose.yml.j2` MUST follow the canonical skeleton: a base-include " "header, each service declared as `{{ service_name }}:` with its " "`{% set service_name = ... %}` and all per-service `{% set %}` knobs " - "on column-0, dash-free lines directly above the key, and the " + "on column-0, dash-free lines directly above the key, a restart " + "policy in every service body, and the " "`compose_volumes` / `compose_networks` lookups closing the " "file at column 0.\n\n" "Opt a template out with `{# nocheck: compose-structure #}` (whole file " diff --git a/tests/lint/repository/dependencies/README.md b/tests/lint/repository/dependencies/README.md index e27e0ac3fc..7b9e00cfb3 100644 --- a/tests/lint/repository/dependencies/README.md +++ b/tests/lint/repository/dependencies/README.md @@ -1,6 +1,6 @@ # Dependencies Lint ๐Ÿ“ฆ -Python packaging and dependency-reference rules: `pyproject.toml` requirement coverage, ban on stale `requirements/NNN-โ€ฆ` numbers in code, and the deprecated-`pkgmgr` warning. +Python packaging and dependency-reference rules: `pyproject.toml` requirement coverage, ban on stale `requirements/NNN-โ€ฆ` numbers in code, the deprecated-`pkgmgr` warning, and Galaxy/git parity of the Ansible collection requirements (suppression rule key `galaxy-git-parity`). Tests in this directory MUST only cover dependency declarations and requirement cross-references. Other Python source patterns MUST live under [`python/`](../../filesystem/python/). diff --git a/tests/lint/repository/dependencies/test_galaxy_entries_have_git_source.py b/tests/lint/repository/dependencies/test_galaxy_entries_have_git_source.py new file mode 100644 index 0000000000..0d9cd2e89e --- /dev/null +++ b/tests/lint/repository/dependencies/test_galaxy_entries_have_git_source.py @@ -0,0 +1,67 @@ +"""Lint: every collection in ``requirements/requirements.galaxy.yml`` +MUST also be declared as a git source in +``requirements/requirements.git.yml``. + +``scripts/install/ansible.sh`` falls back to the git requirements file +when ``galaxy.ansible.com`` is unreachable, so the fallback only helps +while it stays feature-equivalent. A collection present only in the +Galaxy file is either skipped by the fallback or resolved against +Galaxy again as a transitive dependency, which fails ``make install`` +on the very outage the fallback exists for. + +Suppress with ``# nocheck: galaxy-git-parity`` on the entry's line or +the line above it in ``requirements.galaxy.yml``. Reserved for +collections that publish no usable git remote. +""" + +from __future__ import annotations + +import re +import unittest + +from utils.annotations.suppress import is_suppressed_at +from utils.cache.files import read_text +from utils.cache.yaml import load_yaml + +from . import PROJECT_ROOT + +_RULE = "galaxy-git-parity" + +_GALAXY_REQ = "requirements/requirements.galaxy.yml" +_GIT_REQ = "requirements/requirements.git.yml" + +_NAME_RE = re.compile(r"^\s*-\s+name:\s*(\S+)") + + +class TestGalaxyEntriesHaveGitSource(unittest.TestCase): + def test_every_galaxy_collection_has_a_git_source(self) -> None: + git_names = { + str(entry["name"]) + for entry in load_yaml(PROJECT_ROOT / _GIT_REQ)["collections"] + } + lines = read_text(str(PROJECT_ROOT / _GALAXY_REQ)).splitlines() + + offenders: list[str] = [] + for no, line in enumerate(lines, start=1): + match = _NAME_RE.match(line) + if not match: + continue + name = match.group(1).strip("\"'") + if name in git_names: + continue + if is_suppressed_at(lines, no, _RULE): + continue + offenders.append(f"{_GALAXY_REQ}:{no}: {name}") + + if offenders: + self.fail( + f"{len(offenders)} collection(s) without a git fallback " + f"source. A Galaxy outage takes down `make install` for " + f"these. Add a `type: git` entry to {_GIT_REQ}, or mark a " + f"legitimate exception with `# nocheck: {_RULE}`:\n" + + "\n".join(f" - {o}" for o in offenders) + ) + + +if __name__ == "__main__": # pragma: no cover + unittest.main() diff --git a/tests/unit/python/utils/install/test_php.py b/tests/unit/python/utils/install/test_php.py index cb9aea3965..a42f8790a0 100644 --- a/tests/unit/python/utils/install/test_php.py +++ b/tests/unit/python/utils/install/test_php.py @@ -18,7 +18,8 @@ class TestEnsurePhpToolchain(unittest.TestCase): ): php_mod.ensure_php_toolchain() self.assertEqual( - [c.args[0] for c in ensure.call_args_list], ["php", "composer"] + [c.args[0] for c in ensure.call_args_list], + ["php", "composer", "unzip"], ) self.assertEqual( [c.args[0] for c in extension.call_args_list], @@ -43,7 +44,8 @@ class TestEnsurePhpPresent(unittest.TestCase): phpunit.is_file.return_value = True php_mod.ensure_php_present() self.assertEqual( - [c.args[0] for c in ensure.call_args_list], ["php", "composer"] + [c.args[0] for c in ensure.call_args_list], + ["php", "composer", "unzip"], ) run.assert_not_called() diff --git a/utils/install/php.py b/utils/install/php.py index cd1e14017c..3bb2414f29 100644 --- a/utils/install/php.py +++ b/utils/install/php.py @@ -25,11 +25,19 @@ def ensure_php_toolchain() -> None: A distro ships them as packages separate from the interpreter, which is why a present ``php`` binary does not imply they are there. + Composer needs an archive extractor for its dist downloads. Without one it + silently falls back to ``--prefer-source`` and mirror-clones every + dependency, which blows its 300 s process timeout on ``phpunit.git``. Arch + ships no zip extension and no ``php-zip`` package, so the extractor has to + be the ``unzip`` binary rather than the extension. + Raises: - RuntimeError: php, composer or one of the extensions is still absent. + RuntimeError: php, composer, unzip or one of the extensions is still + absent. """ ensure_command_present("php") ensure_command_present("composer") + ensure_command_present("unzip") for extension in _PHPUNIT_EXTENSIONS: ensure_php_extension_present(extension)