From 56ba55cf4e97f7a66326bc957323d75915210529 Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Sun, 15 Nov 2026 21:46:07 +0100 Subject: [PATCH 1/6] refactor(release): sign releases as this repository with the shared publish action The starter's cd.yaml now runs devantler-tech/.github's publish-app action directly, so each release is signed by the application's own cd.yaml on its release tag (ADR 0017). The platform trusts each tenant's own repository on release tags, so a new action revision needs no platform approval and the Dependabot hold on the shared publisher is dropped. The scaffold contract and the envelope test now assert the own-release frame. The envelope test keeps a shared-caller baseline, derived from the starter, because the platform still accepts the shared publisher while consumers move. Refs #289 Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yml | 12 +----- .github/workflows/cd.yaml | 49 ++++++++++++------------ .github/workflows/validate-scaffold.yaml | 4 +- README.md | 6 +-- docs/REFERENCE.md | 26 ++++++------- scripts/platform-tenant-envelope.test.sh | 43 ++++++++++++++++----- scripts/workflow-caller-contract.test.sh | 34 ++++++++++------ 7 files changed, 100 insertions(+), 74 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0df7a35..1722cab 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -22,21 +22,13 @@ updates: commit-message: prefix: "ci" include: "scope" - # The application publisher stays on the exact revision Platform has reviewed and approved - # for tenants, which `Platform Admissibility` enforces. Every devantler-tech/.github release - # moves the publisher's tag together with the callers below, so while Dependabot proposed it, - # every group pull request failed that check until someone put the publisher back by hand - # (#275 through #282, issue #283). Move this pin by hand, in its own change, once Platform - # approves a newer revision. - ignore: - - dependency-name: "devantler-tech/.github/.github/workflows/publish-app.yaml" # The workflow-caller contract requires the maintained release and template-sync callers # to share one commit. Dependabot treats each reusable workflow as its own dependency, so # UNGROUPED it opens one PR per caller (#156, #157 and #158 each touched exactly one file) โ€” # and every one of those lands with the other two still behind, failing that assertion in # required CI. No merge order rescues it: the first caller updated always disagrees with the - # rest. Grouping advances the callers in one PR; the publisher is ignored above, so the group - # never has to wait for a Platform approval. + # rest. Grouping advances the callers in one PR. The publish-app action moves with them: it signs as + # this repository, so a new revision needs no Platform approval (ADR 0017). groups: devantler-tech-actions: patterns: diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 8bbf349..86b7164 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -10,30 +10,29 @@ permissions: {} jobs: publish: name: Publish - # Skipped in the template repo itself (it ships no app); runs in every tenant - # created from this template. The template is matched by its repository ID, - # which survives the rename from platform-tenant-template to application-template. + # The upstream template has no application to publish; its ID survives renames. if: github.repository_id != '1253884448' + runs-on: ubuntu-latest + timeout-minutes: 60 + concurrency: + group: publish-${{ github.repository }} + cancel-in-progress: false permissions: - contents: read # checkout - packages: write # push image + manifests OCI artifact - id-token: write # keyless cosign signing (via GitHub OIDC) - uses: devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812 # v19.0.5 - with: - # publish-app pins the freshly built image digest into the container with - # this name in deploy/deployment.yaml. Keep that container's name equal to - # the repository name (the platform's signed-publish convention). - app-name: ${{ github.event.repository.name }} - # The signature this publish mints carries the `uses:` ref above in its - # certificate. Platform has independently approved this exact maintained - # revision for manifests, admission and node pulls. Other maintained - # revisions, tags and branches fail closed; a full SHA alone does not - # grant approval. The guard below checks only that the ref is a commit - # SHA, so an unapproved SHA still publishes, but its artifact never - # verifies in-cluster and the tenant silently stops reconciling. Get the - # new revision approved in Platform before changing this pin. - # - # Enabling the guard adds the producer-side half: the publish refuses to - # sign at all, before the build, so a tag or branch ref surfaces here as a failed - # release instead of as an artifact the cluster quietly rejects. - enable-caller-pin: true + contents: read + packages: write + id-token: write + steps: + - name: ๐Ÿ”’ Harden runner + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + - name: ๐Ÿ“ฅ Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: ๐Ÿ“ฆ Publish signed application + id: publish + uses: devantler-tech/.github/actions/publish-app@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + with: + app-name: ${{ github.event.repository.name }} + app-manifest: ${{ hashFiles('deploy/base/deployment.yaml') != '' && 'base/deployment.yaml' || 'deployment.yaml' }} diff --git a/.github/workflows/validate-scaffold.yaml b/.github/workflows/validate-scaffold.yaml index 59d21be..9dab72e 100644 --- a/.github/workflows/validate-scaffold.yaml +++ b/.github/workflows/validate-scaffold.yaml @@ -488,8 +488,8 @@ jobs: # published digest, which needs registry access and a real signed image. The # scaffold's placeholder tag is neither, so applying them here could only ever # produce a false failure. Tenant images earn their signature at publish time โ€” - # `cd.yaml` calls the shared `publish-app.yaml`, whose keyless signing identity - # is what `verify-app-images` accepts โ€” so provenance is enforced in CD and at + # `cd.yaml` runs the `actions/publish-app` action, whose keyless signing identity + # (this repository's own `cd.yaml` on a release tag) is what `verify-app-images` accepts โ€” so provenance is enforced in CD and at # admission, just not in this offline gate. admissibility: name: Platform Admissibility diff --git a/README.md b/README.md index d0e706d..1b07c8a 100644 --- a/README.md +++ b/README.md @@ -113,9 +113,9 @@ Default PR CI always builds the tenant image and renders `deploy/` before merge, secrets or write authority. Keep the `delivery-inputs` job and its entry in `ci-required-checks` when you change the stack job. This catches the same image and manifest failures in the pull request that introduced them instead of during release or reconciliation. -Keep the `publish-pin-approved` job and its entry too: it holds back a dependency update that -moves the publishing workflow to a revision the platform has not yet approved for your tenant, -so the release it would cut does not fail to deploy. An application scaffolded without +Keep the `publish-pin-approved` job and its entry too: it refuses a `cd.yaml` that leaves the +minimal tag-only, credential-free frame your releases are signed in, and it still holds back a +move back to a shared publisher revision the platform has not approved for your tenant. An application scaffolded without `--tenancy` has neither job. After authorized App setup and platform registration, eligible Conventional Commits can produce diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index 9723fab..fefd42f 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -80,7 +80,7 @@ the template excludes, add the line `!` to your list. | File | Purpose | |---|---| -| `.github/workflows/cd.yaml` (*tenant*) | On a `v*` tag, calls `publish-app.yaml` to build, digest-pin, push, and **cosign-sign** the image + manifests OCI artifact | +| `.github/workflows/cd.yaml` (*tenant*) | On a `v*` tag, runs the `actions/publish-app` action to build, digest-pin, push, and **cosign-sign** the image + manifests OCI artifact as this repository | | `.github/workflows/release.yaml` | semantic-release on `main` (cuts the `v*` tags that drive `cd.yaml`) | | `.github/workflows/codeql.yaml` | Advanced CodeQL for the languages found in the repository, reading `.github/codeql/codeql-config.yml`; off until default setup is off and `CODEQL_SETUP=advanced` | | `.github/workflows/lint.yaml`, `.github/mega-linter.base.yml` | The shared MegaLinter job `ci.yaml` calls, and the base configuration `.mega-linter.yml` extends | @@ -182,14 +182,14 @@ image, so their updates reach production on their own. GitHub Actions updates use the `ci` prefix (set in `.github/dependabot.yml`) and release nothing. Tenants own both files, so an existing tenant adds the `build(deps)` rule and the `ci` prefix itself. -Each tag triggers `cd.yaml`, which calls the platform's -[`publish-app.yaml`](https://github.com/devantler-tech/.github/blob/main/.github/workflows/publish-app.yaml) -reusable workflow to build the image, **pin its digest into -`deploy/deployment.yaml`**, push the manifests as an OCI artifact, and -**cosign-sign** both. The platform's `OCIRepository` verifies that signature, so -only artifacts from this trusted workflow are eligible for reconciliation after -the platform has registered the tenant and its applicable publisher-approval -checks pass. Workflow configuration alone does not prove that publication or +Each tag triggers `cd.yaml`, which runs the +[`actions/publish-app`](https://github.com/devantler-tech/.github/tree/main/actions/publish-app) +action to build the image, **pin its digest into the app manifest** +(`deploy/base/deployment.yaml` when it exists, else `deploy/deployment.yaml`), +push the manifests as an OCI artifact, and **cosign-sign** both. The signature +names this repository's own `cd.yaml` on the release tag, and the platform's +`OCIRepository` trusts each registered tenant's own repository on release tags +(ADR 0017), so a new action revision needs no platform approval. Workflow configuration alone does not prove that publication or reconciliation succeeded. Before moving a publisher between repositories, merge and template-sync the @@ -220,7 +220,7 @@ schema. Digest selection must retain the immutable digest schema, and optional application reconciliation must default on and preserve its deletion guard. Static OCI references remain supported; conditional application reconciliation still requires the same source schema and safeguards with that reference form. -The starter uses the maintained publisher at its reviewed minimum version. +Tenants still on the shared publisher keep it at its reviewed minimum version. Its portable guard rejects a return to the retired catalogue, movable refs, older versions and version comments that do not match the immutable commit. The Platform approval and verification policy must be deployed before a live @@ -232,9 +232,9 @@ frame validated by the portable approval check. It instantiates the generic Tenant's exact own-release rule with a fixed sample repository and release tag, then compares that producer with the decoded rule. A shared-only default or an explicit shared-publisher revision cannot authorize this producer. Execution -environment overrides and branch publication remain refused. This offline -compatibility check neither switches the starter's publisher nor proves that a -real release was signed, admitted or reconciled. +environment overrides and branch publication remain refused. The starter ships +this caller. This offline check does not prove that a real release was signed, +admitted or reconciled. > **Convention:** the Deployment's container `name` MUST equal the repository > name โ€” `publish-app` pins the built image digest into the container with that diff --git a/scripts/platform-tenant-envelope.test.sh b/scripts/platform-tenant-envelope.test.sh index 285d15c..d7dae33 100644 --- a/scripts/platform-tenant-envelope.test.sh +++ b/scripts/platform-tenant-envelope.test.sh @@ -568,6 +568,20 @@ cp \ "$platform_root/k8s/bases/infrastructure/vault-config/job.yaml" \ "$baseline/k8s/bases/infrastructure/vault-config/job.yaml" +# The starter signs as this repository. Platform still accepts the shared +# reusable publisher while consumers move (ADR 0017), so the shared caller form +# keeps its own baseline, derived from the starter's trigger and authority. +shared_publish_workflow=$mutation_dir/shared-publisher-cd.yaml +# shellcheck disable=SC2016 +yq eval ' + del(.jobs.publish.steps, .jobs.publish."runs-on", .jobs.publish."timeout-minutes", .jobs.publish.concurrency) + | .jobs.publish.uses = "devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812" + | .jobs.publish.with = {"app-name": "${{ github.event.repository.name }}", "enable-caller-pin": true} +' "$publish_workflow" > "$shared_publish_workflow" +# A subshell keeps the starter's validated publisher identity in place. +(validate_publish_workflow "$shared_publish_workflow") || + fail "the shared publisher baseline no longer has the pinned minimal signing contract" + # Counted, not hand-written โ€” so that adding a mutation cannot leave the PASS # line overstating or understating coverage. # @@ -603,8 +617,9 @@ run_publish_mutation() { mutations_run=$((mutations_run + 1)) description=$1 mutation=$2 + mutant_base=${3:-$publish_workflow} mutant_workflow=$mutation_dir/cd-mutant.yaml - yq eval "$mutation" "$publish_workflow" > "$mutant_workflow" + yq eval "$mutation" "$mutant_base" > "$mutant_workflow" if (validate_publish_workflow "$mutant_workflow") >/dev/null 2>&1; then fail "publish mutation passed: $description" fi @@ -819,7 +834,7 @@ run_producer_control() { "$control/k8s/bases/infrastructure/resource-graph-definitions/tenant/resource-graph-definition.yaml" > "$mutation_dir/producer-control.yaml" mv "$mutation_dir/producer-control.yaml" "$control/k8s/bases/infrastructure/resource-graph-definitions/tenant/resource-graph-definition.yaml" CALLER_CONTROL=$control_caller yq eval '.jobs.publish.uses = strenv(CALLER_CONTROL)' \ - "$publish_workflow" > "$mutation_dir/producer-cd.yaml" + "$shared_publish_workflow" > "$mutation_dir/producer-cd.yaml" case "${5:-}" in own-publisher|own-publisher-env|own-publisher-branch) cp "$script_dir/fixtures/own-publisher.yaml" "$mutation_dir/producer-cd.yaml" @@ -1186,12 +1201,22 @@ run_publish_mutation "tag trigger removed" 'del(.["on"].push.tags)' run_publish_mutation "tenant-only guard removed" 'del(.jobs.publish.if)' run_publish_mutation "package publication permission removed" 'del(.jobs.publish.permissions.packages)' run_publish_mutation "OIDC signing permission removed" 'del(.jobs.publish.permissions."id-token")' -run_publish_mutation "producer workflow unpinned" \ - '.jobs.publish.uses = "devantler-tech/actions/.github/workflows/publish-app.yaml@main"' -run_publish_mutation "producer workflow changed" \ - '.jobs.publish.uses = "devantler-tech/actions/.github/workflows/other.yaml@47f0d9b632581a613963a2d25c243713f24c32a0"' +run_publish_mutation "producer action unpinned" \ + '.jobs.publish.steps[2].uses = "devantler-tech/.github/actions/publish-app@main"' +run_publish_mutation "producer action changed" \ + '.jobs.publish.steps[2].uses = "devantler-tech/.github/actions/other@47f0d9b632581a613963a2d25c243713f24c32a0"' run_publish_mutation "application identity hard-coded" \ - '.jobs.publish.with."app-name" = "app"' + '.jobs.publish.steps[2].with."app-name" = "app"' +run_publish_mutation "checkout keeps its credentials" \ + '.jobs.publish.steps[1].with."persist-credentials" = true' +run_publish_mutation "shared and own publisher combined" \ + '.jobs.publish.uses = "devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812"' +run_publish_mutation "shared producer workflow unpinned" \ + '.jobs.publish.uses = "devantler-tech/actions/.github/workflows/publish-app.yaml@main"' "$shared_publish_workflow" +run_publish_mutation "shared producer workflow changed" \ + '.jobs.publish.uses = "devantler-tech/actions/.github/workflows/other.yaml@47f0d9b632581a613963a2d25c243713f24c32a0"' "$shared_publish_workflow" +run_publish_mutation "shared application identity hard-coded" \ + '.jobs.publish.with."app-name" = "app"' "$shared_publish_workflow" run_publish_mutation "publisher authority widened" \ '.jobs.publish.permissions.issues = "write"' run_publish_mutation "branch publication enabled" \ @@ -1204,8 +1229,8 @@ run_publish_mutation "second package publisher added" \ # restores the unenforced default. Deleting the pair is what would let the # caller-pin requirement decay back to opt-in without a failing test. run_publish_mutation "caller SHA-pin enforcement removed" \ - 'del(.jobs.publish.with."enable-caller-pin")' + 'del(.jobs.publish.with."enable-caller-pin")' "$shared_publish_workflow" run_publish_mutation "caller SHA-pin enforcement disabled" \ - '.jobs.publish.with."enable-caller-pin" = false' + '.jobs.publish.with."enable-caller-pin" = false' "$shared_publish_workflow" echo "PASS: signed tenant artifact envelope (KRO + manual + OpenBao + publisher + ${mutations_run} safety mutations + ${subject_controls_run} subject controls + ${producer_controls_run} producer controls)" diff --git a/scripts/workflow-caller-contract.test.sh b/scripts/workflow-caller-contract.test.sh index 271c5dc..bab19fd 100644 --- a/scripts/workflow-caller-contract.test.sh +++ b/scripts/workflow-caller-contract.test.sh @@ -83,16 +83,20 @@ validate_contract() { fail 'the portable caller fixture must reach tenants through template sync' fi - yq eval -e '.jobs.publish.uses | test("^devantler-tech/[.]github/[.]github/workflows/publish-app[.]yaml@[0-9a-f]{40}$")' \ + # The starter signs as this repository: a direct publish-app action, never the shared + # reusable publisher whose revisions the platform had to approve one by one. + yq eval -e '(.jobs.publish | has("uses") | not) + and ([.jobs.publish.steps[] | select(.id == "publish")] | length == 1) + and ((.jobs.publish.steps[] | select(.id == "publish")).uses | test("^devantler-tech/[.]github/actions/publish-app@[0-9a-f]{40}$"))' \ "$cd_file" >/dev/null || - fail 'the starter must ship the maintained application publisher' + fail 'the starter must sign its own releases with the publish-app action' sh "$portable_contract" --validate "$cd_file" "$release_file" "$template_sync_file" || fail 'the portable workflow-caller pin contract rejected the caller set' - yq eval -e '.jobs.publish.with."enable-caller-pin" == true' \ - "$cd_file" >/dev/null || - fail 'the publish caller must keep the producer-side ref guard enabled' + # The minimal tag-only, credential-free execution frame the own-release subject relies on. + sh "$repo_root/scripts/publish-pin-approved.sh" "$cd_file" "$cd_file" >/dev/null || + fail 'the publish caller must keep the minimal own-release signing frame' # Canonical release and sync callers move together within their own catalogue. # The maintained publisher has an independent, explicitly approved version. Dependabot treats @@ -264,11 +268,15 @@ run_mutation() { } run_mutation 'publish caller SHA pin removed' cd \ - '.jobs.publish.uses = "devantler-tech/.github/.github/workflows/publish-app.yaml@main"' + '.jobs.publish.steps[2].uses = "devantler-tech/.github/actions/publish-app@main"' run_mutation 'legacy publisher restored' cd \ - '.jobs.publish.uses = "devantler-tech/actions/.github/workflows/publish-app.yaml@ea4df9004d4ab43b6c9af5b0c5f55712f7211328"' -run_mutation 'publisher-side caller pin disabled' cd \ - '.jobs.publish.with."enable-caller-pin" = false' + '.jobs.publish = {"name": "Publish", "uses": "devantler-tech/actions/.github/workflows/publish-app.yaml@ea4df9004d4ab43b6c9af5b0c5f55712f7211328", "with": {"app-name": "x"}}' +run_mutation 'shared publisher restored' cd \ + '.jobs.publish = {"name": "Publish", "uses": "devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812", "with": {"app-name": "x", "enable-caller-pin": true}}' +run_mutation 'publish checkout keeps its credentials' cd \ + '.jobs.publish.steps[1].with."persist-credentials" = true' +run_mutation 'publish runs on a branch push' cd \ + '.["on"].push.branches = ["main"]' run_mutation 'release caller SHA pin removed' release \ '.jobs.release.uses = "devantler-tech/.github/.github/workflows/create-release.yaml@main"' run_mutation 'release issue isolation disabled' release \ @@ -354,7 +362,7 @@ run_fleet_mutation() { cp "$dependabot_config" "$mutation_dir/dependabot.yml" for pair in \ - "cd.yaml|.jobs.publish.uses|publish-app" \ + "cd.yaml|.jobs.publish.steps[2].uses|publish-app" \ "release.yaml|.jobs.release.uses|create-release" \ "template-sync.yaml|.jobs.\"template-sync\".uses|template-sync"; do mutant_file=${pair%%|*} @@ -366,8 +374,10 @@ run_fleet_mutation() { else [ "$mutant_workflow" != publish-app ] || continue fi + mutant_ref="devantler-tech/.github/.github/workflows/${mutant_workflow}.yaml@${ref}" + [ "$mutant_workflow" != publish-app ] || mutant_ref="devantler-tech/.github/actions/publish-app@${ref}" yq eval \ - "${mutant_path} = \"devantler-tech/.github/.github/workflows/${mutant_workflow}.yaml@${ref}\" | + "${mutant_path} = \"${mutant_ref}\" | ${mutant_path} line_comment = \"${version}\"" \ "$mutation_dir/$mutant_file" > "$mutation_dir/mutant.yaml" mv "$mutation_dir/mutant.yaml" "$mutation_dir/$mutant_file" @@ -388,7 +398,7 @@ run_fleet_mutation() { } run_mutation 'publish caller rolled back while the others stay current' cd \ - '.jobs.publish.uses = "devantler-tech/.github/.github/workflows/publish-app.yaml@77cfa9cfc5514ebe1429f64e681afd181cf4515d"' + '.jobs.publish.steps[2].uses = "devantler-tech/.github/actions/publish-app@77cfa9cfc5514ebe1429f64e681afd181cf4515d"' run_mutation 'release caller rolled back while the others stay current' release \ '.jobs.release.uses = "devantler-tech/.github/.github/workflows/create-release.yaml@4b00bd6698af033dc472b39a7e609173fe38dfb1"' run_fleet_mutation 'publisher below reviewed floor' \ From 0a74242b31bfcbd17c1469e7eb734c9a3076df90 Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Mon, 16 Nov 2026 15:03:22 +0100 Subject: [PATCH 2/6] fix(release): retain pending publications with validated queues --- .github/workflows/cd.yaml | 3 +- .github/workflows/ci.yaml | 77 +++++++++++++++++++++- .github/workflows/lint.yaml | 7 +- .github/workflows/release.yaml | 2 +- .github/workflows/stale-issues.yaml | 2 +- .github/workflows/template-sync.yaml | 2 +- .github/workflows/validate-scaffold.yaml | 4 +- .github/workflows/validate-stacks.yaml | 4 +- docs/REFERENCE.md | 10 ++- scripts/fixtures/own-publisher.yaml | 2 +- scripts/validate-workflow-queues.sh | 44 +++++++++++++ scripts/validate-workflow-queues.test.sh | 82 ++++++++++++++++++++++++ 12 files changed, 226 insertions(+), 13 deletions(-) create mode 100644 scripts/validate-workflow-queues.sh create mode 100644 scripts/validate-workflow-queues.test.sh diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 86b7164..3b99cef 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -16,6 +16,7 @@ jobs: timeout-minutes: 60 concurrency: group: publish-${{ github.repository }} + queue: max cancel-in-progress: false permissions: contents: read @@ -32,7 +33,7 @@ jobs: persist-credentials: false - name: ๐Ÿ“ฆ Publish signed application id: publish - uses: devantler-tech/.github/actions/publish-app@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + uses: devantler-tech/.github/actions/publish-app@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 with: app-name: ${{ github.event.repository.name }} app-manifest: ${{ hashFiles('deploy/base/deployment.yaml') != '' && 'base/deployment.yaml' || 'deployment.yaml' }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0df073f..1e2c900 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -53,6 +53,21 @@ jobs: persist-credentials: false - name: ๐Ÿ“Œ Validate reusable workflow caller pins run: sh scripts/workflow-caller-pin-contract.test.sh + # template:begin + - name: Install released actionlint for the compatibility control + run: | + archive="${RUNNER_TEMP}/actionlint.tar.gz" + curl --fail --silent --show-error --location \ + https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_linux_amd64.tar.gz \ + --output "$archive" + echo "8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 $archive" | sha256sum --check --status + mkdir -p "${RUNNER_TEMP}/actionlint-bin" + tar -xzf "$archive" --directory "${RUNNER_TEMP}/actionlint-bin" actionlint + echo "${RUNNER_TEMP}/actionlint-bin" >>"$GITHUB_PATH" + shell: bash + - name: Test concurrency queue validation + run: bash scripts/validate-workflow-queues.test.sh + # template:end # Validates the two tenant-owned artifacts that CD publishes: the image and deploy/. delivery-inputs: @@ -118,6 +133,62 @@ jobs: sh "${RUNNER_TEMP}/publish-pin-approved.sh" "${RUNNER_TEMP}/base-cd.yaml" .github/workflows/cd.yaml # tenancy:end + # template:begin + release-queue-proof: + name: Release queue proof (${{ matrix.slot }}) + runs-on: ubuntu-latest + timeout-minutes: 3 + permissions: {} + strategy: + fail-fast: false + matrix: + slot: [first, second, third] + concurrency: + group: release-queue-proof-${{ github.run_id }}-${{ github.run_attempt }} + queue: max + cancel-in-progress: false + steps: + - name: Hold the publication slot while the other jobs queue + env: + SLOT: ${{ matrix.slot }} + run: | + sleep 15 + printf '%s\n' "$SLOT" >"${RUNNER_TEMP}/queue-proof.txt" + shell: bash + - name: Publish the disposable queue receipt + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: release-queue-proof-${{ matrix.slot }} + path: ${{ runner.temp }}/queue-proof.txt + if-no-files-found: error + retention-days: 1 + release-queue-receipts: + name: Release queue receipts + runs-on: ubuntu-latest + timeout-minutes: 3 + needs: [release-queue-proof] + permissions: + actions: read # native workflow-run metadata only + if: ${{ always() }} + steps: + - name: Require all three native publication slots + env: + GH_TOKEN: ${{ github.token }} + run: | + gh api --paginate --slurp \ + "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT}/jobs?per_page=100" | + jq -e '[.[] | .jobs[] | select(.name | startswith("Release queue proof ("))] as $jobs | + ($jobs | length) == 3 and + ([$jobs[].name] | sort) == ["Release queue proof (first)", "Release queue proof (second)", "Release queue proof (third)"] and + all($jobs[]; .status == "completed" and .conclusion == "success")' + gh api --paginate --slurp \ + "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts?per_page=100" | + jq -e '[.[] | .artifacts[] | select(.name | startswith("release-queue-proof-"))] as $artifacts | + ([$artifacts[].name] | sort) == ["release-queue-proof-first", "release-queue-proof-second", "release-queue-proof-third"] and + all($artifacts[]; .expired == false and .size_in_bytes > 0)' + shell: bash + # template:end + ci-required-checks: name: CI - Required Checks runs-on: ubuntu-latest @@ -127,6 +198,10 @@ jobs: - workflow-caller-pins # tenancy - delivery-inputs # tenancy - publish-pin-approved # tenancy + # template:begin + - release-queue-proof + - release-queue-receipts + # template:end permissions: actions: read # native workflow-run metadata only if: ${{ always() }} @@ -134,7 +209,7 @@ jobs: # Every result in `needs` is consumed, so a job listed there can never be left out. - name: ๐Ÿ“Š Require all CI checks to pass id: ci-checks - uses: devantler-tech/.github/actions/aggregate-job-checks@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + uses: devantler-tech/.github/actions/aggregate-job-checks@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 with: check-workflow-startup: "true" job-results: ${{ join(needs.*.result, ' ') }} diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 3dd9d81..8c5d7fa 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -25,11 +25,14 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + - name: Validate concurrency queues before the compatibility rule + run: bash scripts/validate-workflow-queues.sh # Read-only: a finding a linter could fix still fails the job, so fix it locally. - name: ๐Ÿงน MegaLinter uses: oxsecurity/megalinter/flavors/cupcake@f2fe8c1cba37091848df3e524066c8c23ef353ed # v10.2.0 env: VALIDATE_ALL_CODEBASE: true APPLY_FIXES: none - # actionlint in MegaLinter does not know the newer `code-quality` permission yet. - ACTION_ACTIONLINT_ARGUMENTS: -ignore code-quality + # The preceding gate validates queue values and non-cancellation. Released + # actionlint lacks that field; every unrelated diagnostic remains active. + ACTION_ACTIONLINT_ARGUMENTS: -ignore code-quality -ignore unexpected.key..queue..for..concurrency..section diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d7947f5..d3f2c88 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ jobs: # Skipped in the template repo itself; runs in every application created from it. # The template is matched by its repository ID, which survives renames. if: github.repository_id != '1253884448' - uses: devantler-tech/.github/.github/workflows/create-release.yaml@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + uses: devantler-tech/.github/.github/workflows/create-release.yaml@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 with: disable-issue-side-effects: true secrets: diff --git a/.github/workflows/stale-issues.yaml b/.github/workflows/stale-issues.yaml index b634c96..1cbe117 100644 --- a/.github/workflows/stale-issues.yaml +++ b/.github/workflows/stale-issues.yaml @@ -23,7 +23,7 @@ jobs: triage: # Keep portfolio automation disabled in external template copies. if: ${{ github.repository_owner == 'devantler-tech' }} - uses: devantler-tech/.github/.github/workflows/triage-stale-issues.yaml@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + uses: devantler-tech/.github/.github/workflows/triage-stale-issues.yaml@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 permissions: issues: write actions: write diff --git a/.github/workflows/template-sync.yaml b/.github/workflows/template-sync.yaml index aff7dfb..9ba5bfd 100644 --- a/.github/workflows/template-sync.yaml +++ b/.github/workflows/template-sync.yaml @@ -21,7 +21,7 @@ jobs: permissions: contents: write pull-requests: write - uses: devantler-tech/.github/.github/workflows/template-sync.yaml@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + uses: devantler-tech/.github/.github/workflows/template-sync.yaml@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 with: source-repo-path: devantler-tech/platform-tenant-template use-app-token: true diff --git a/.github/workflows/validate-scaffold.yaml b/.github/workflows/validate-scaffold.yaml index 9dab72e..a8eed9b 100644 --- a/.github/workflows/validate-scaffold.yaml +++ b/.github/workflows/validate-scaffold.yaml @@ -1111,7 +1111,7 @@ jobs: egress-policy: audit - name: ๐Ÿ“ฃ Open or update the drift issue if: needs.validate-scaffold.result != 'success' || needs.admissibility.result != 'success' || needs.pod-security-admission.result != 'success' - uses: devantler-tech/.github/actions/upsert-issue@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + uses: devantler-tech/.github/actions/upsert-issue@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 with: title: "Scheduled scaffold validation is failing on main" body: | @@ -1125,7 +1125,7 @@ jobs: Read the failing step's message first: a check that could not evaluate its input names that as its cause, separately from a policy verdict. This issue is updated by every failing scheduled run and closed by the next passing one. - name: โœ… Close the drift issue if: needs.validate-scaffold.result == 'success' && needs.admissibility.result == 'success' && needs.pod-security-admission.result == 'success' - uses: devantler-tech/.github/actions/upsert-issue@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + uses: devantler-tech/.github/actions/upsert-issue@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 with: title: "Scheduled scaffold validation is failing on main" open: "false" diff --git a/.github/workflows/validate-stacks.yaml b/.github/workflows/validate-stacks.yaml index 1b5457c..29d8f97 100644 --- a/.github/workflows/validate-stacks.yaml +++ b/.github/workflows/validate-stacks.yaml @@ -82,7 +82,7 @@ jobs: - name: ๐Ÿงช Build and test .NET if: matrix.stack == 'dotnet' - uses: devantler-tech/.github/actions/run-dotnet-tests@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + uses: devantler-tech/.github/actions/run-dotnet-tests@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 with: working-directory: ${{ env.APP }} github-token: "" @@ -138,7 +138,7 @@ jobs: steps: - name: ๐Ÿ“Š Require every stack to pass id: checks - uses: devantler-tech/.github/actions/aggregate-job-checks@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + uses: devantler-tech/.github/actions/aggregate-job-checks@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 with: check-workflow-startup: "true" job-results: ${{ join(needs.*.result, ' ') }} diff --git a/docs/REFERENCE.md b/docs/REFERENCE.md index fefd42f..628e985 100644 --- a/docs/REFERENCE.md +++ b/docs/REFERENCE.md @@ -267,7 +267,8 @@ Run these from the repository root. In every platform tenant, and in this templa kubectl kustomize deploy/ # manifests build sh scripts/workflow-caller-pin-contract.test.sh # portable tenant caller-pin contract (resolves the version-comment tag on github.com and compares it with the pinned commit) sh scripts/publish-pin-approved.test.sh # publish-app pin approval check (reads a local approved set, never the network) -actionlint .github/workflows/* # workflows parse +bash scripts/validate-workflow-queues.sh # validate the queue field unsupported by released actionlint +actionlint -ignore code-quality -ignore 'unexpected.key..queue..for..concurrency..section' .github/workflows/* # every other workflow diagnostic stays active ``` Additionally, in this template repository. A new tenant starts with these @@ -279,6 +280,7 @@ sh scripts/scaffold.test.sh # stack and tenancy scaffo sh scripts/rename-placeholders.test.sh # onboarding contract sh scripts/agent-instructions.test.sh # agent safety contract sh scripts/workflow-caller-contract.test.sh # template-only caller/scaffold contract +bash scripts/validate-workflow-queues.test.sh # queue validation and independent actionlint control sh scripts/tenant-ci-contract.test.sh # tenant delivery-input CI contract sh scripts/pod-security-admission-contract.test.sh # Pod Security workflow contract sh scripts/tenant-rbac-contract.test.sh # Platform tenant RBAC workflow contract @@ -287,6 +289,12 @@ sh scripts/platform-network-floor-contract.test.sh # generated Platform netwo sh scripts/platform-vpa-floor-contract.test.sh # generated Platform VPA-floor contract ``` +Publication jobs use `queue: max` with cancellation disabled so a later release +keeps its place. Until released actionlint understands that field, the shared +lint workflow validates its allowed values and cancellation rules before using +the narrow compatibility rule above. Template CI also runs three jobs in one +native concurrency group and requires all three to finish successfully. + The live tenant-envelope check requires `kro` ownership on the controller-created Namespace and ServiceAccount; the manual registration retains `ksail` ownership. diff --git a/scripts/fixtures/own-publisher.yaml b/scripts/fixtures/own-publisher.yaml index 86b7164..ba1858e 100644 --- a/scripts/fixtures/own-publisher.yaml +++ b/scripts/fixtures/own-publisher.yaml @@ -32,7 +32,7 @@ jobs: persist-credentials: false - name: ๐Ÿ“ฆ Publish signed application id: publish - uses: devantler-tech/.github/actions/publish-app@3cab796adef97dcde0c55724866a0b19397aba39 # v21.6.2 + uses: devantler-tech/.github/actions/publish-app@d70d50665465117f01104313e53057374a96a1a3 # v21.7.2 with: app-name: ${{ github.event.repository.name }} app-manifest: ${{ hashFiles('deploy/base/deployment.yaml') != '' && 'base/deployment.yaml' || 'deployment.yaml' }} diff --git a/scripts/validate-workflow-queues.sh b/scripts/validate-workflow-queues.sh new file mode 100644 index 0000000..9dae83e --- /dev/null +++ b/scripts/validate-workflow-queues.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -euo pipefail +# Complete the concurrency.queue validation missing from actionlint 1.7.12. +# The following lint step retains every other actionlint diagnostic unchanged. +fail() { printf 'workflow queues: %s\n' "$*" >&2; exit 1; } +[[ "$#" -le 1 ]] || fail 'invalid arguments: expected at most one repository root' +root="${1:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" +command -v yq >/dev/null 2>&1 || fail 'missing yq v4' +command -v jq >/dev/null 2>&1 || fail 'missing jq' +case "$(yq --version)" in *'version v4.'*) ;; *) fail 'missing yq v4';; esac +workflow_dir="$root/.github/workflows" +[[ -d "$workflow_dir" && ! -L "$workflow_dir" ]] || fail 'missing regular workflow directory' +shopt -s nullglob +files=("$workflow_dir"/*.yaml "$workflow_dir"/*.yml) +[[ "${#files[@]}" -gt 0 ]] || fail 'missing workflow files' +for file in "${files[@]}"; do + [[ -f "$file" && ! -L "$file" ]] || fail "unreadable regular workflow: $file" + if ! documents="$(yq -o=json '.' "$file")"; then + fail "unreadable YAML: $file" + fi + if ! jq -e -s 'length == 1 and (.[0] | type) == "object"' <<<"$documents" >/dev/null; then + fail "invalid single workflow document: $file" + fi + if ! invalid="$(jq -r -s ' + .[0] | + [{name: "workflow", value: .concurrency}] + + [(if (.jobs | type) == "object" then .jobs else {} end | to_entries[]) + | select((.value | type) == "object") + | {name: .key, value: .value.concurrency}] | + .[] | . as $scope | .value as $c | + select(($c | type) == "object") | select($c | has("queue")) | + if (($c.queue == "single" or $c.queue == "max") + and (($c.group | type) == "string" and ($c.group | length) > 0) + and ($c.queue != "max" or + (($c | has("cancel-in-progress") | not) or $c["cancel-in-progress"] == false))) + then empty + else "\($scope.name): expected queue single/max, a group, and non-cancelling max publication" + end + ' <<<"$documents")"; then + fail "unreadable queue declarations: $file" + fi + [[ -z "$invalid" ]] || fail "invalid concurrency queue in $file: $invalid" +done +printf 'workflow queues: validated %s workflow files\n' "${#files[@]}" diff --git a/scripts/validate-workflow-queues.test.sh b/scripts/validate-workflow-queues.test.sh new file mode 100644 index 0000000..07d2810 --- /dev/null +++ b/scripts/validate-workflow-queues.test.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +set -euo pipefail +root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +scratch="$(mktemp -d)" +trap 'rm -rf "$scratch"' EXIT +mkdir -p "$scratch/.github/workflows" +fixture="$scratch/.github/workflows/publish.yaml" +fail() { printf 'workflow queue test: %s\n' "$*" >&2; exit 1; } +write_fixture() { + cat >"$fixture" <<'YAML' +name: Queue fixture +on: workflow_dispatch +jobs: + publish: + runs-on: ubuntu-latest + concurrency: + group: fixture + queue: max + cancel-in-progress: false + steps: + - run: echo publish +YAML +} +check() { bash "$root/scripts/validate-workflow-queues.sh" "$scratch"; } +refuse() { + local reason="$1" + if check >"$scratch/out" 2>&1; then fail "accepted $reason"; fi + grep -Eq 'workflow queues: (invalid|unreadable|missing)' "$scratch/out" || fail "wrong refusal for $reason" +} +write_fixture +check +yq -i '.jobs.publish.concurrency.queue = "typo"' "$fixture" +refuse 'an unknown queue policy' +for value in 'null' 'true' '12' '["max"]' '{policy: max}'; do + write_fixture + VALUE="$value" yq -i '.jobs.publish.concurrency.queue = (strenv(VALUE) | from_yaml)' "$fixture" + refuse "a non-string queue: $value" +done +for value in true null "\"\${{ github.ref == 'refs/heads/main' }}\""; do + write_fixture + VALUE="$value" yq -i '.jobs.publish.concurrency."cancel-in-progress" = (strenv(VALUE) | from_yaml)' "$fixture" + refuse "a potentially cancelling max queue: $value" +done +write_fixture +yq -i 'del(.jobs.publish.concurrency.group)' "$fixture" +refuse 'a queue without a group' +write_fixture +yq -i 'del(.jobs.publish.concurrency."cancel-in-progress")' "$fixture" +check +write_fixture +yq -i '.jobs.publish.concurrency.queue = "single" | .jobs.publish.concurrency."cancel-in-progress" = true' "$fixture" +check +write_fixture +yq -i '.concurrency = .jobs.publish.concurrency | del(.jobs.publish.concurrency)' "$fixture" +check +yq -i '.concurrency.queue = "typo"' "$fixture" +refuse 'an invalid workflow-level queue' +write_fixture +yq -i 'del(.jobs.publish.concurrency.queue)' "$fixture" +check +printf 'jobs: [\n' >"$fixture" +refuse 'malformed YAML' +write_fixture +printf '\n---\nname: another\n' >>"$fixture" +refuse 'multiple workflow documents' +rm "$fixture" +refuse 'an empty workflow inventory' +write_fixture +# Exercise the released validator too: the compatibility rule must leave every +# unrelated syntax diagnostic active. +if command -v actionlint >/dev/null 2>&1; then + actionlint -ignore 'unexpected.key..queue..for..concurrency..section' "$fixture" + yq -i '.jobs.publish.concurrency.bogus = "typo"' "$fixture" + check + if actionlint -ignore 'unexpected.key..queue..for..concurrency..section' "$fixture" >"$scratch/lint" 2>&1; then + fail 'the compatibility rule hid an unrelated concurrency typo' + fi + grep -q 'unexpected key "bogus"' "$scratch/lint" || fail 'the real validator failed for the wrong reason' +else + fail 'actionlint is required for the independent compatibility control' +fi +printf 'workflow queue tests: passed\n' From 99feea12a851cf78d5ac9122785b1c7c6e4355a5 Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Mon, 16 Nov 2026 15:12:59 +0100 Subject: [PATCH 3/6] fix(ci): preserve queue proof results across partial reruns --- .github/workflows/ci.yaml | 7 ++++-- scripts/validate-workflow-queues.test.sh | 28 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1e2c900..9b0a1d6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -162,6 +162,7 @@ jobs: path: ${{ runner.temp }}/queue-proof.txt if-no-files-found: error retention-days: 1 + overwrite: true # replace only this slot's disposable receipt on rerun release-queue-receipts: name: Release queue receipts runs-on: ubuntu-latest @@ -176,8 +177,10 @@ jobs: GH_TOKEN: ${{ github.token }} run: | gh api --paginate --slurp \ - "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT}/jobs?per_page=100" | - jq -e '[.[] | .jobs[] | select(.name | startswith("Release queue proof ("))] as $jobs | + "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs?filter=all&per_page=100" | + jq -e --argjson attempt "$GITHUB_RUN_ATTEMPT" \ + '[.[] | .jobs[] | select(.name | startswith("Release queue proof (")) | select(.run_attempt <= $attempt)] | + group_by(.name) | map(max_by([.run_attempt, .id])) as $jobs | ($jobs | length) == 3 and ([$jobs[].name] | sort) == ["Release queue proof (first)", "Release queue proof (second)", "Release queue proof (third)"] and all($jobs[]; .status == "completed" and .conclusion == "success")' diff --git a/scripts/validate-workflow-queues.test.sh b/scripts/validate-workflow-queues.test.sh index 07d2810..a9d2750 100644 --- a/scripts/validate-workflow-queues.test.sh +++ b/scripts/validate-workflow-queues.test.sh @@ -79,4 +79,32 @@ if command -v actionlint >/dev/null 2>&1; then else fail 'actionlint is required for the independent compatibility control' fi +# A failed-jobs rerun retains successful slots from earlier attempts. Exercise +# the real receipt step with that API shape, including an older failed slot. +mkdir "$scratch/bin" +cat >"$scratch/bin/gh" <<'SH' +#!/usr/bin/env bash +case "${*: -1}" in + */jobs\?filter=all\&per_page=100) cat "$QUEUE_FIXTURES/jobs.json" ;; + */artifacts\?per_page=100) cat "$QUEUE_FIXTURES/artifacts.json" ;; + *) exit 2 ;; +esac +SH +chmod +x "$scratch/bin/gh" +yq -r '.jobs."release-queue-receipts".steps[0].run' "$root/.github/workflows/ci.yaml" >"$scratch/receipts.sh" +jq -n '[{jobs: [ + {id:1,name:"Release queue proof (first)",run_attempt:1,status:"completed",conclusion:"success"}, + {id:2,name:"Release queue proof (second)",run_attempt:1,status:"completed",conclusion:"failure"}, + {id:3,name:"Release queue proof (third)",run_attempt:1,status:"completed",conclusion:"success"}, + {id:4,name:"Release queue proof (second)",run_attempt:2,status:"completed",conclusion:"success"} +]}]' >"$scratch/jobs.json" +jq -n '[{artifacts:["first","second","third"] | map({name:("release-queue-proof-" + .),expired:false,size_in_bytes:100})}]' >"$scratch/artifacts.json" +receipt_check() { + PATH="$scratch/bin:$PATH" QUEUE_FIXTURES="$scratch" GITHUB_REPOSITORY=fixture/repo \ + GITHUB_RUN_ID=123 GITHUB_RUN_ATTEMPT=2 bash -e -o pipefail "$scratch/receipts.sh" +} +receipt_check >/dev/null +jq '.[0].jobs[-1].conclusion = "failure"' "$scratch/jobs.json" >"$scratch/changed.json" +mv "$scratch/changed.json" "$scratch/jobs.json" +if receipt_check >/dev/null 2>&1; then fail 'a failed latest slot reused an earlier result'; fi printf 'workflow queue tests: passed\n' From 48c4b8a0e1d860bd4a97346542cfcf2ddce34b0f Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Mon, 16 Nov 2026 15:37:24 +0100 Subject: [PATCH 4/6] fix(release): retain the shared publisher lock across signer changes --- .github/workflows/cd.yaml | 2 +- scripts/fixtures/own-publisher.yaml | 2 +- scripts/publish-pin-approved.sh | 2 +- scripts/publish-pin-approved.test.sh | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 3b99cef..1f159a5 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 concurrency: - group: publish-${{ github.repository }} + group: publish-verified-${{ github.repository }} queue: max cancel-in-progress: false permissions: diff --git a/scripts/fixtures/own-publisher.yaml b/scripts/fixtures/own-publisher.yaml index ba1858e..c3f04ea 100644 --- a/scripts/fixtures/own-publisher.yaml +++ b/scripts/fixtures/own-publisher.yaml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 concurrency: - group: publish-${{ github.repository }} + group: publish-verified-${{ github.repository }} cancel-in-progress: false permissions: contents: read diff --git a/scripts/publish-pin-approved.sh b/scripts/publish-pin-approved.sh index 93d77cf..ade760d 100644 --- a/scripts/publish-pin-approved.sh +++ b/scripts/publish-pin-approved.sh @@ -60,7 +60,7 @@ publish_identity() { and .jobs.publish.if == "github.repository_id != '\''1253884448'\''" and .jobs.publish."runs-on" == "ubuntu-latest" and .jobs.publish."timeout-minutes" == 60 - and .jobs.publish.concurrency.group == "publish-${{ github.repository }}" + and .jobs.publish.concurrency.group == "publish-verified-${{ github.repository }}" and .jobs.publish.concurrency."cancel-in-progress" == false and (.jobs.publish.permissions | length) == 3 and .jobs.publish.permissions.contents == "read" diff --git a/scripts/publish-pin-approved.test.sh b/scripts/publish-pin-approved.test.sh index c472b05..6895484 100644 --- a/scripts/publish-pin-approved.test.sh +++ b/scripts/publish-pin-approved.test.sh @@ -189,6 +189,7 @@ for manifest in deployment.yaml base/deployment.yaml; do fi done for mutation in \ + '.jobs.publish.concurrency.group = "publish-${{ github.repository }}"' \ '.env.BASH_ENV = "publisher-hook.sh"' \ '.defaults.run.shell = "bash -e {0}"' \ '.jobs.publish.steps[2].uses = "other-owner/repo/action@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"' \ From 2b9f1b2a274f2eaea660378363900a650a99063f Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Mon, 16 Nov 2026 15:46:43 +0100 Subject: [PATCH 5/6] test(release): quote the literal workflow expression safely --- scripts/publish-pin-approved.test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/publish-pin-approved.test.sh b/scripts/publish-pin-approved.test.sh index 6895484..46952f7 100644 --- a/scripts/publish-pin-approved.test.sh +++ b/scripts/publish-pin-approved.test.sh @@ -189,7 +189,7 @@ for manifest in deployment.yaml base/deployment.yaml; do fi done for mutation in \ - '.jobs.publish.concurrency.group = "publish-${{ github.repository }}"' \ + ".jobs.publish.concurrency.group = \"publish-\${{ github.repository }}\"" \ '.env.BASH_ENV = "publisher-hook.sh"' \ '.defaults.run.shell = "bash -e {0}"' \ '.jobs.publish.steps[2].uses = "other-owner/repo/action@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"' \ From 45f302578bef4b5301991be0ddd766ac3197e054 Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Mon, 16 Nov 2026 17:50:19 +0100 Subject: [PATCH 6/6] fix(ci): validate scaffold queues before lint compatibility --- .github/workflows/validate-stacks.yaml | 7 +++++- scripts/validate-workflow-queues.test.sh | 32 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate-stacks.yaml b/.github/workflows/validate-stacks.yaml index 29d8f97..532f853 100644 --- a/.github/workflows/validate-stacks.yaml +++ b/.github/workflows/validate-stacks.yaml @@ -52,6 +52,10 @@ jobs: # The shared lint job every non-Go application runs, on the fresh scaffold. The # runner temp directory is mounted at /github/runner_temp in the linter container. + - name: Validate scaffold concurrency queues + if: matrix.stack != 'go' + working-directory: ${{ env.APP }} + run: bash scripts/validate-workflow-queues.sh - name: ๐Ÿงน Lint the scaffold if: matrix.stack != 'go' uses: oxsecurity/megalinter/flavors/cupcake@f2fe8c1cba37091848df3e524066c8c23ef353ed # v10.2.0 @@ -59,7 +63,8 @@ jobs: DEFAULT_WORKSPACE: /github/runner_temp/demo-app VALIDATE_ALL_CODEBASE: true APPLY_FIXES: none - ACTION_ACTIONLINT_ARGUMENTS: -ignore code-quality + # The preceding gate validates the field missing from released actionlint. + ACTION_ACTIONLINT_ARGUMENTS: -ignore code-quality -ignore unexpected.key..queue..for..concurrency..section - name: โš™๏ธ Set up Go if: matrix.stack == 'go' diff --git a/scripts/validate-workflow-queues.test.sh b/scripts/validate-workflow-queues.test.sh index a9d2750..8e0194d 100644 --- a/scripts/validate-workflow-queues.test.sh +++ b/scripts/validate-workflow-queues.test.sh @@ -79,6 +79,38 @@ if command -v actionlint >/dev/null 2>&1; then else fail 'actionlint is required for the independent compatibility control' fi +# Exercise the scaffold matrix's committed compatibility arguments, not a copy +# of them: that entry point must validate queues before its linter ignores the +# unsupported field, and retain unrelated syntax diagnostics. +write_fixture +scaffold_workflow="$root/.github/workflows/validate-stacks.yaml" +scaffold_arguments=$(yq -r '.jobs.stack.steps[] | select(.uses // "" | contains("oxsecurity/megalinter/")) | .env.ACTION_ACTIONLINT_ARGUMENTS' "$scaffold_workflow") +read -r -a scaffold_lint_arguments <<<"$scaffold_arguments" +actionlint "${scaffold_lint_arguments[@]}" "$fixture" +yq -o=json '.jobs.stack.steps' "$scaffold_workflow" | jq -e ' + to_entries as $steps | + [$steps[] | select(.value.run // "" | contains("validate-workflow-queues.sh"))] as $guards | + [$steps[] | select(.value.uses // "" | contains("oxsecurity/megalinter/"))] as $linters | + ($guards | length) == 1 and ($linters | length) == 1 and + $guards[0].key < $linters[0].key and + $guards[0].value.if == $linters[0].value.if and + $guards[0].value."working-directory" == "${{ env.APP }}" +' >/dev/null || fail 'the scaffold compatibility rule lacks its preceding queue gate' +yq -r '.jobs.stack.steps[] | select(.run // "" | contains("validate-workflow-queues.sh")) | .run' "$scaffold_workflow" >"$scratch/scaffold-guard.sh" +mkdir -p "$scratch/scripts" +cp "$root/scripts/validate-workflow-queues.sh" "$scratch/scripts/" +scaffold_check() { (cd "$scratch" && bash -e -o pipefail "$scratch/scaffold-guard.sh"); } +scaffold_check +yq -i '.jobs.publish.concurrency.queue = "typo"' "$fixture" +if scaffold_check >"$scratch/out" 2>&1; then fail 'the scaffold queue gate accepted an invalid policy'; fi +grep -q 'workflow queues: invalid' "$scratch/out" || fail 'the scaffold gate failed for the wrong reason' +write_fixture +yq -i '.jobs.publish.concurrency.bogus = "typo"' "$fixture" +scaffold_check +if actionlint "${scaffold_lint_arguments[@]}" "$fixture" >"$scratch/lint" 2>&1; then + fail 'the scaffold compatibility arguments hid an unrelated concurrency typo' +fi +grep -q 'unexpected key "bogus"' "$scratch/lint" || fail 'the scaffold linter failed for the wrong reason' # A failed-jobs rerun retains successful slots from earlier attempts. Exercise # the real receipt step with that API shape, including an older failed slot. mkdir "$scratch/bin"