From 806662d2114b0ad00568d83d1b0a5c40e8881ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Weberru=C3=9F?= Date: Sat, 28 Nov 2026 22:19:16 +0000 Subject: [PATCH] fix(release): keep runner capacity bound to the selected source --- .github/workflows/configurator-production.yml | 4 ++-- docs/workflows.de.md | 2 +- docs/workflows.md | 2 +- .../docs/production.de.md | 4 ++++ landing-zone-configurator/docs/production.md | 4 ++++ .../infra/ci/production.test.mjs | 20 ++++++++++++++++++- .../infra/ci/release-notes.mjs | 1 + 7 files changed, 32 insertions(+), 5 deletions(-) diff --git a/.github/workflows/configurator-production.yml b/.github/workflows/configurator-production.yml index 41566a9..e65a88c 100644 --- a/.github/workflows/configurator-production.yml +++ b/.github/workflows/configurator-production.yml @@ -204,7 +204,6 @@ jobs: LZC_EXECUTION_ENABLED: 'true' LZC_APPLICATION_EXECUTION_ENABLED: 'true' LZC_RETIREMENTS_ENABLED: ${{ vars.LZC_RETIREMENTS_ENABLED }} - LZC_RUNNER_POOL_SIZE: '4' LZC_DEPLOYMENT_ARTIFACT_KEY: ${{ secrets.LZC_DEPLOYMENT_ARTIFACT_KEY }} - name: Login with application-space deployer env: @@ -302,11 +301,12 @@ jobs: run: node infra/ci/check-production-route.mjs - name: Verify runtime service and isolated Runner connections run: | + pool_size="$(node --input-type=module -e 'import { deploymentStage } from "./infra/ci/stages.mjs"; const size=deploymentStage("lzc-prod").runnerPoolSize; if(!Number.isInteger(size)||size<1||size>4)throw new Error("Invalid published Runner capacity"); console.log(size);')" node infra/ci/verify-mailout-binding.mjs cf run-task landing-zone-configurator --command './runtime/bin/node apps/api/dist/check-connections.js' --name "connections-$GITHUB_RUN_ID" -m 128M -k 4096M --wait cf run-task landing-zone-configurator --command "./runtime/bin/node apps/api/dist/check-plan-runner.js $GITHUB_RUN_ID" --name "runner-$GITHUB_RUN_ID" -m 128M -k 4096M --wait for attempt in 1 2 3; do - if cf logs landing-zone-configurator --recent | node infra/ci/runner-evidence.mjs "$GITHUB_RUN_ID" 4; then break; fi + if cf logs landing-zone-configurator --recent | node infra/ci/runner-evidence.mjs "$GITHUB_RUN_ID" "$pool_size"; then break; fi test "$attempt" -lt 3 || exit 1 sleep 5 done diff --git a/docs/workflows.de.md b/docs/workflows.de.md index 6c6c612..66af58a 100644 --- a/docs/workflows.de.md +++ b/docs/workflows.de.md @@ -92,7 +92,7 @@ umetikettieren. [Configurator Production Release](https://github.com/stackitcloud/stackit-landing-zone/actions/workflows/configurator-production.yml) · [Quelle](../.github/workflows/configurator-production.yml) veröffentlicht ein stabiles Release und deployt erst nach manueller Freigabe von `lzc-prod-release`. Eingaben: `version` (Standard `v2.1.0`), `publish` (Standard `true`), `release_run_id` (für Veröffentlichung erforderlich) und `release_mode` (Standard `skip`, alternativ `qualified`). Einen vollständig erfolgreichen **Configurator Release** von derselben `main`-Revision mit demselben Modus verwenden, unabhängig davon, ob dieser Dev deployt oder `build_only=true` genutzt hat. Ein zweiter Build ist nicht erforderlich. `skip` dokumentiert die übersprungene Assistant-Qualifikation, ohne historische Dev-only-Artefakte umzudeuten. Alle Prüfungen außerhalb der Inferenz bleiben verpflichtend. -Ein veröffentlichtes stabiles GitHub Release mit den erforderlichen quellgebundenen Assets startet den Workflow ebenfalls. Veröffentlichung über `GITHUB_TOKEN` setzt im selben Lauf fort und benötigt kein zweites Ereignis. `publish=false` deployt ein bestehendes kompatibles veröffentlichtes Release nach neuer manueller Freigabe. Pre-Releases und beliebige Artefakte werden abgelehnt. Produktion hält vier gemeinsam genutzte warme Einmal-Runner für Plattform-, Application- und Rückbauaufträge bereit. Produktion verwendet unveränderliche angehängte Anwendungs-/Runner-Assets, begrenzte CF-Zugänge und Rolling Deployment mit drei Web-Repliken. +Ein veröffentlichtes stabiles GitHub Release mit den erforderlichen quellgebundenen Assets startet den Workflow ebenfalls. Veröffentlichung über `GITHUB_TOKEN` setzt im selben Lauf fort und benötigt kein zweites Ereignis. `publish=false` deployt ein bestehendes kompatibles veröffentlichtes Release nach neuer manueller Freigabe. Pre-Releases und beliebige Artefakte werden abgelehnt. Das aktuelle Produktionsrelease hält vier gemeinsam genutzte warme Einmal-Runner für Plattform-, Application- und Rückbauaufträge bereit; beim erneuten Deployment älterer Releases bleibt deren geprüfte quellgebundene Kapazität erhalten. Produktion verwendet unveränderliche angehängte Anwendungs-/Runner-Assets, begrenzte CF-Zugänge und Rolling Deployment mit drei Web-Repliken. Bootstrap, Platform und Runtime akzeptieren jetzt `environment` (Standard `lzc-dev`, alternativ `lzc-prod`). Plan-/Apply-Environments und Schreibwarteschlangen folgen der ausgewählten Stage. Prod Platform wählt die Replica-Set-Datenbank; Prod Runtime ergänzt eigene DNS-Zone, öffentliche Domain und Space-begrenzte Konten. Der lokale verschlüsselte Bootstrap `operator-project` importiert ein bestehendes Betreiberprojekt und provisioniert seine eigene projektbegrenzte Identität. Siehe [vollständiges Produktionshandbuch](../landing-zone-configurator/docs/production.de.md) für Bootstrap, Bindings, Zugangsrotation und Wiederherstellung. diff --git a/docs/workflows.md b/docs/workflows.md index 4354736..4277a5c 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -82,7 +82,7 @@ selection. A failed qualification cannot be relabeled as `skip`. [Configurator Production Release](https://github.com/stackitcloud/stackit-landing-zone/actions/workflows/configurator-production.yml) · [source](../.github/workflows/configurator-production.yml) publishes a stable release and deploys only after manual `lzc-prod-release` approval. It accepts `version` (default `v2.1.0`), `publish` (default `true`), `release_run_id` (required for publication) and `release_mode` (`skip` by default, or `qualified`). Reuse a fully successful **Configurator Release** from the same `main` revision and mode, whether it deployed Dev or used `build_only=true`. A second build is unnecessary. `skip` records skipped Assistant qualification without reinterpreting historical Dev-only artifacts. All non-inference checks remain mandatory. -A published stable GitHub Release with the required source-bound assets also triggers this workflow. Publication with `GITHUB_TOKEN` continues within the same run, avoiding reliance on another event. `publish=false` redeploys an existing compatible published release under a fresh manual approval. Pre-releases and arbitrary artifacts are rejected. Production maintains four shared one-shot warm Runner reserves for Platform, Application and Retirement jobs. Production uses immutable attached application/Runner assets, scoped CF credentials and rolling deployment of three web replicas. +A published stable GitHub Release with the required source-bound assets also triggers this workflow. Publication with `GITHUB_TOKEN` continues within the same run, avoiding reliance on another event. `publish=false` redeploys an existing compatible published release under a fresh manual approval. Pre-releases and arbitrary artifacts are rejected. The current production release maintains four shared one-shot warm Runner reserves for Platform, Application and Retirement jobs; redeploying older releases retains their reviewed source-bound capacity. Production uses immutable attached application/Runner assets, scoped CF credentials and rolling deployment of three web replicas. The Bootstrap, Platform and Runtime inputs now include `environment` (`lzc-dev` by default, or `lzc-prod`). Their plan/apply Environments and mutation queues follow the selected stage. Prod platform inputs select the replica-set database; Prod runtime adds the dedicated DNS zone, public domain and space-scoped identities. The local encrypted `operator-project` bootstrap imports an existing operator project and provisions its dedicated project-limited identity. See the [complete production runbook](../landing-zone-configurator/docs/production.md) for bootstrap, bindings, credential rotation and recovery. diff --git a/landing-zone-configurator/docs/production.de.md b/landing-zone-configurator/docs/production.de.md index 2e2d5a4..9662290 100644 --- a/landing-zone-configurator/docs/production.de.md +++ b/landing-zone-configurator/docs/production.de.md @@ -83,6 +83,10 @@ Deployment berücksichtigen. PostgreSQL-Sperren begrenzen die warmen Reserven gemeinsam; jede API-Replik erzeugt keinen eigenen zusätzlichen Pool. Infrastrukturjobs und Release-Aktivierung verwenden `configurator-lzc-prod-mutation` als gemeinsamen einzelnen Schreiber. +Das erneute Deployment eines älteren veröffentlichten Releases verwendet dessen +geprüfte warme Kapazität (aktuelles Release: vier; frühere Releases: zwei). Runtime- +Vorbereitung und Smoke-Test lesen dieselbe quellgebundene Stage. Der neueste +Workflow erzwingt somit keine neue Kapazität für ältere Assets. Laufende STACKIT-Anmeldungen und Organisationsnachweise verwenden denselben PostgreSQL-Dienst wie Sitzungen und werden mit dem dauerhaften diff --git a/landing-zone-configurator/docs/production.md b/landing-zone-configurator/docs/production.md index 9cc28a6..3e6ba5b 100644 --- a/landing-zone-configurator/docs/production.md +++ b/landing-zone-configurator/docs/production.md @@ -75,6 +75,10 @@ three-instance cap. Allow capacity for staging, migration, checks and the extra web process during rolling deployment. Warm reserves are shared through PostgreSQL locks, not multiplied by the web replica count. Infrastructure jobs and release activation share `configurator-lzc-prod-mutation` as their single writer. +Redeploying an older published release uses that release's reviewed warm capacity +(current release: four; earlier releases: two). Runtime preparation and its smoke +check read the same source-bound stage, so the newest workflow does not impose a +new capacity on old assets. Pending STACKIT login and organization-proof flows use the same PostgreSQL service as sessions, encrypted with the durable application artifact key. Their diff --git a/landing-zone-configurator/infra/ci/production.test.mjs b/landing-zone-configurator/infra/ci/production.test.mjs index 8368a29..2a72172 100644 --- a/landing-zone-configurator/infra/ci/production.test.mjs +++ b/landing-zone-configurator/infra/ci/production.test.mjs @@ -30,6 +30,24 @@ test("production project binding is available to every deployment phase",()=>{ const jobEnvironment=deployment.split("\n env:\n")[1]?.split("\n steps:\n")[0]; assert.match(jobEnvironment??"",/^ LZC_PROJECT_ID: \$\{\{ vars\.LZC_PROJECT_ID \}\}$/m,"The project ID must reach backend AND application preparation"); }); +test("redeployment follows the selected release's warm capacity rather than forcing the newest capacity",()=>{ + const workflow=readFileSync(new URL("../../../.github/workflows/configurator-production.yml",import.meta.url),"utf8"); + const prepare=workflow.split(" - name: Prepare authenticated production runtime\n")[1]?.split(" - name:")[0]; + assert.ok(prepare);assert.doesNotMatch(prepare,/LZC_RUNNER_POOL_SIZE:/,"Let preparation use the checked-out release's reviewed stage"); + const script=workflow.match(/pool_size="\$\(node --input-type=module -e '([^']+)'\)"/)?.[1]; + assert.ok(script,"Runtime smoke must use the same selected release capacity"); + assert.match(workflow,/runner-evidence\.mjs "\$GITHUB_RUN_ID" "\$pool_size"/); + const directory=mkdtempSync(join(tmpdir(),"lzc-source-capacity-")); + try{ + mkdirSync(join(directory,"infra/ci"),{recursive:true}); + for(const size of [2,4,0,5,"4",null]){ + writeFileSync(join(directory,"infra/ci/stages.mjs"),`export function deploymentStage(name){if(name!=="lzc-prod")throw Error("Wrong stage");return {runnerPoolSize:${JSON.stringify(size)}};}`); + const result=spawnSync(process.execPath,["--input-type=module","-e",script],{cwd:directory,encoding:"utf8"}); + if(size===2||size===4){assert.equal(result.status,0,result.stderr);assert.equal(result.stdout.trim(),String(size));} + else assert.notEqual(result.status,0); + } + }finally{rmSync(directory,{recursive:true,force:true});} +}); test("release publication excludes infrastructure identities and binds both spaces to the production project",()=>{ const [platform,runtime]=outputs(),binding=productionBindings(platform,runtime,id); assert.equal(validateProductionBindings(binding,id),binding); @@ -97,7 +115,7 @@ test("production preparation uses scoped bindings, exact PKCE origin and three r try{ const artifact=join(directory,".local/release/apps/api");mkdirSync(artifact,{recursive:true});symlinkSync(apiDist,join(artifact,"dist"),"dir"); const [platform,runtime]=outputs(); - const env={...process.env,GITHUB_REPOSITORY:"stackitcloud/stackit-landing-zone",GITHUB_REF:"refs/heads/main",LZC_ENVIRONMENT:"lzc-prod",LZC_PUBLISHED_RELEASE:"true",LZC_RELEASE_MODE:"accepted-assistant-limitations",LZC_RELEASE_REVISION:"a".repeat(40),RUNNER_TEMP:directory,GITHUB_ENV:join(directory,"environment"),LZC_RELEASE_BINDINGS:JSON.stringify(productionBindings(platform,runtime,id)),LZC_PROJECT_ID:id,LZC_AUTH_ENABLED:"true",LZC_ASSISTANT_ENABLED:"true",LZC_STACKIT_DEVICE_ENABLED:"true",LZC_STACKIT_CLI_CLIENT_APPROVED:"false",LZC_STACKIT_AUTH_FLOW:"authorization-code",LZC_STACKIT_CLIENT_ID:"production-public-client",LZC_STACKIT_REDIRECT_URI:"https://app.landing-zone.runs.onstackit.cloud/auth/stackit/callback",LZC_EXECUTION_ENABLED:"true",LZC_APPLICATION_EXECUTION_ENABLED:"true",LZC_RUNNER_POOL_SIZE:"4",LZC_DEPLOYMENT_ARTIFACT_KEY:Buffer.alloc(32,5).toString("base64"),LZC_GITHUB_CLIENT_ID:"",LZC_GITHUB_CLIENT_SECRET:""}; + const env={...process.env,GITHUB_REPOSITORY:"stackitcloud/stackit-landing-zone",GITHUB_REF:"refs/heads/main",LZC_ENVIRONMENT:"lzc-prod",LZC_PUBLISHED_RELEASE:"true",LZC_RELEASE_MODE:"accepted-assistant-limitations",LZC_RELEASE_REVISION:"a".repeat(40),RUNNER_TEMP:directory,GITHUB_ENV:join(directory,"environment"),LZC_RELEASE_BINDINGS:JSON.stringify(productionBindings(platform,runtime,id)),LZC_PROJECT_ID:id,LZC_AUTH_ENABLED:"true",LZC_ASSISTANT_ENABLED:"true",LZC_STACKIT_DEVICE_ENABLED:"true",LZC_STACKIT_CLI_CLIENT_APPROVED:"false",LZC_STACKIT_AUTH_FLOW:"authorization-code",LZC_STACKIT_CLIENT_ID:"production-public-client",LZC_STACKIT_REDIRECT_URI:"https://app.landing-zone.runs.onstackit.cloud/auth/stackit/callback",LZC_EXECUTION_ENABLED:"true",LZC_APPLICATION_EXECUTION_ENABLED:"true",LZC_DEPLOYMENT_ARTIFACT_KEY:Buffer.alloc(32,5).toString("base64"),LZC_GITHUB_CLIENT_ID:"",LZC_GITHUB_CLIENT_SECRET:""}; const run=mode=>spawnSync(process.execPath,[new URL("./prepare-release.mjs",import.meta.url).pathname,mode],{env,cwd:directory,encoding:"utf8"}); assert.equal(run("backend").status,0); const result=run("application");assert.equal(result.status,0,result.stderr); diff --git a/landing-zone-configurator/infra/ci/release-notes.mjs b/landing-zone-configurator/infra/ci/release-notes.mjs index 1325e8e..585068a 100644 --- a/landing-zone-configurator/infra/ci/release-notes.mjs +++ b/landing-zone-configurator/infra/ci/release-notes.mjs @@ -6,6 +6,7 @@ const notes={ changes:[ "Use prepared one-shot Runners for retirement Plans and Applies while retaining the separate Retirement worker, approvals and State checks; retire consumed reserves only after confirmed completion.", "Increase production warm capacity from two to four shared reserves and keep cold startup as the fallback when reserves are busy.", + "Keep redeployment compatible with the reviewed Runner capacity of each selected release.", ], }, "v2.3.8": {