diff --git a/.github/workflows/configurator-production.yml b/.github/workflows/configurator-production.yml index 0f8dc423..41566a9c 100644 --- a/.github/workflows/configurator-production.yml +++ b/.github/workflows/configurator-production.yml @@ -204,7 +204,7 @@ jobs: LZC_EXECUTION_ENABLED: 'true' LZC_APPLICATION_EXECUTION_ENABLED: 'true' LZC_RETIREMENTS_ENABLED: ${{ vars.LZC_RETIREMENTS_ENABLED }} - LZC_RUNNER_POOL_SIZE: '2' + LZC_RUNNER_POOL_SIZE: '4' LZC_DEPLOYMENT_ARTIFACT_KEY: ${{ secrets.LZC_DEPLOYMENT_ARTIFACT_KEY }} - name: Login with application-space deployer env: @@ -306,7 +306,7 @@ jobs: 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" 2; then break; fi + if cf logs landing-zone-configurator --recent | node infra/ci/runner-evidence.mjs "$GITHUB_RUN_ID" 4; 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 0c65cef4..6c6c612b 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 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. 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. 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 b4408ef4..43547365 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 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. 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. 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/app/apps/api/db/112_retirement_runner_pool_cleanup.sql b/landing-zone-configurator/app/apps/api/db/112_retirement_runner_pool_cleanup.sql new file mode 100644 index 00000000..7af050f3 --- /dev/null +++ b/landing-zone-configurator/app/apps/api/db/112_retirement_runner_pool_cleanup.sql @@ -0,0 +1,22 @@ +-- A stopped, durably reconciled Retirement no longer needs its one-shot process. +-- Unresolved State recovery and mismatched app/source bindings remain protected. +CREATE FUNCTION lzc_auth.retire_completed_retirement_runners(p_space uuid,p_origin text) +RETURNS integer LANGUAGE plpgsql SECURITY DEFINER SET search_path=pg_catalog AS $$ +DECLARE retired integer; +BEGIN + UPDATE lzc.runner_pool_slots slot SET status='retiring',assignment=NULL,token_hash=NULL + FROM lzc.retirement_jobs job + WHERE slot.space_id=p_space AND slot.origin=p_origin AND slot.status='consumed' + AND NOT slot.is_probe AND slot.job_id=job.id + AND slot.app_id=job.runner_app_id AND slot.source_droplet_id=job.runner_package_id + AND job.status IN ('succeeded','failed') AND job.stopped_at IS NOT NULL + AND job.finished_at IS NOT NULL + AND (job.recovery_adopted_at IS NOT NULL OR ( + job.recovery_ciphertext IS NULL AND NOT coalesce((job.result->>'recoveryRequired')::boolean,false) + )) + AND NOT EXISTS(SELECT 1 FROM lzc.retirement_execution_scopes scope WHERE scope.lock_run_id=job.id); + GET DIAGNOSTICS retired=ROW_COUNT; + RETURN retired; +END $$; +REVOKE ALL ON FUNCTION lzc_auth.retire_completed_retirement_runners(uuid,text) FROM PUBLIC; +GRANT EXECUTE ON FUNCTION lzc_auth.retire_completed_retirement_runners(uuid,text) TO configurator_app; diff --git a/landing-zone-configurator/app/apps/api/src/main.ts b/landing-zone-configurator/app/apps/api/src/main.ts index 175ece00..33bb8275 100644 --- a/landing-zone-configurator/app/apps/api/src/main.ts +++ b/landing-zone-configurator/app/apps/api/src/main.ts @@ -226,6 +226,7 @@ if (process.env.LZC_AUTH_ENABLED === "true") { broker: "retirement", dropletId, inspection: platformInspection, + ...(runnerPool ? { warm: runnerPool } : {}), }); const cloud = new StackitRetirementCloud(); retirementPreparation = new RetirementPreparation( diff --git a/landing-zone-configurator/app/apps/api/src/plans/cloud-foundry.ts b/landing-zone-configurator/app/apps/api/src/plans/cloud-foundry.ts index 61d4fdce..b7b071bd 100644 --- a/landing-zone-configurator/app/apps/api/src/plans/cloud-foundry.ts +++ b/landing-zone-configurator/app/apps/api/src/plans/cloud-foundry.ts @@ -65,7 +65,7 @@ export interface WarmRunnerDispatch { id: string, ticket: string, origin: string, - broker: "platform" | "application", + broker: "platform" | "application" | "retirement", record: (appId: string, sourceDropletId: string) => Promise, ): Promise; remove(id: string, appId: string | null): Promise; @@ -215,14 +215,13 @@ export class CloudFoundryPlanRunner implements PlanRunner { ) { guid(id); if ( - this.config.broker !== "retirement" && - (await this.config.warm?.start( + await this.config.warm?.start( id, ticket, origin, this.config.broker ?? "platform", record, - )) + ) ) return; const { call, appId } = await this.prepare( diff --git a/landing-zone-configurator/app/apps/api/src/plans/runner-pool.ts b/landing-zone-configurator/app/apps/api/src/plans/runner-pool.ts index 797c4781..a42f7be2 100644 --- a/landing-zone-configurator/app/apps/api/src/plans/runner-pool.ts +++ b/landing-zone-configurator/app/apps/api/src/plans/runner-pool.ts @@ -165,7 +165,7 @@ export class RunnerPool implements WarmRunnerDispatch { id: string, ticket: string, origin: string, - broker: "platform" | "application", + broker: "platform" | "application" | "retirement", record: (appId: string, sourceDropletId: string) => Promise, probe = false, ): Promise { @@ -256,6 +256,10 @@ export class RunnerPool implements WarmRunnerDispatch { "SELECT lzc_auth.retire_completed_application_runners($1,$2)", [this.config.spaceId, this.config.origin], ); + await this.database.query( + "SELECT lzc_auth.retire_completed_retirement_runners($1,$2)", + [this.config.spaceId, this.config.origin], + ); await this.database.query( "UPDATE lzc.runner_pool_slots SET status='retiring',assignment=NULL,token_hash=NULL WHERE space_id=$1 AND origin=$2 AND ((status IN ('warming','ready','reserved','assigned') AND (expires_at<=now() OR (status='ready' AND last_seen_at shutdown.abort(); const removeShutdownListeners = () => { @@ -34,6 +32,10 @@ const outcome = pool removeShutdownListeners(); return runWorker(options); }, + executeRetirement: (options) => { + removeShutdownListeners(); + return runRetirementWorker(options); + }, }, ).finally(removeShutdownListeners) : broker === "retirement" diff --git a/landing-zone-configurator/app/apps/worker/src/warm-runner.ts b/landing-zone-configurator/app/apps/worker/src/warm-runner.ts index 7198ddb0..1c936129 100644 --- a/landing-zone-configurator/app/apps/worker/src/warm-runner.ts +++ b/landing-zone-configurator/app/apps/worker/src/warm-runner.ts @@ -3,6 +3,7 @@ import { type RunnerPoolAssignment, runnerPoolAssignmentSchema, } from "@lzc/contracts"; +import { runRetirementWorker } from "./retirement.js"; import { hostedBrokerOrigin, runWorker } from "./runner.js"; const idleLifetimeMilliseconds = 15 * 60 * 1000; @@ -16,6 +17,7 @@ interface WarmRunnerOptions { interface WarmRunnerDependencies { execute?: typeof runWorker; + executeRetirement?: typeof runRetirementWorker; now?: () => number; wait?: (milliseconds: number, signal: AbortSignal) => Promise; } @@ -104,14 +106,20 @@ export async function runWarmRunner( throw new Error("Warm runner claim failed"); } checkIdle(); - if (claimed) - return (dependencies.execute ?? runWorker)({ + if (claimed) { + const input = { root: options.root, id: claimed.id, ticket: claimed.ticket, - broker: claimed.broker, brokerOrigin, + }; + if (claimed.broker === "retirement") + return (dependencies.executeRetirement ?? runRetirementWorker)(input); + return (dependencies.execute ?? runWorker)({ + ...input, + broker: claimed.broker, }); + } try { await wait(Math.min(1000, deadline - now()), options.signal); } catch { diff --git a/landing-zone-configurator/app/integration/platform-retirement.test.ts b/landing-zone-configurator/app/integration/platform-retirement.test.ts index 704df12e..897d231e 100644 --- a/landing-zone-configurator/app/integration/platform-retirement.test.ts +++ b/landing-zone-configurator/app/integration/platform-retirement.test.ts @@ -1498,6 +1498,92 @@ it("transfers only a captured same-State scope to independent encrypted custody }, })), }); + const warmCleanup = async (jobId: string) => { + const slotId = randomUUID(), + spaceId = randomUUID(), + origin = "https://configurator.example"; + const binding = ( + await admin.query( + "SELECT runner_app_id,runner_package_id FROM lzc.retirement_jobs WHERE id=$1", + [jobId], + ) + ).rows[0]; + await admin.query( + "INSERT INTO lzc.runner_pool_slots(id,pool_key,origin,space_id,source_droplet_id,app_id,status,job_id,expires_at) VALUES($1,'retirement-fixture',$2,$3,$4,$5,'consumed',$6,now()+interval '1 hour')", + [ + slotId, + origin, + spaceId, + binding.runner_package_id, + binding.runner_app_id, + jobId, + ], + ); + const retire = async (space = spaceId, address = origin) => + Number( + ( + await runtime.query( + "SELECT lzc_auth.retire_completed_retirement_runners($1,$2) AS count", + [space, address], + ) + ).rows[0].count, + ); + const protectedRun = async () => expect(await retire()).toBe(0); + await protectedRun(); + return { + protectedRun, + completed: async () => { + expect(await retire(randomUUID())).toBe(0); + expect(await retire(spaceId, "https://other.example")).toBe(0); + await admin.query( + "UPDATE lzc.runner_pool_slots SET source_droplet_id=$2 WHERE id=$1", + [slotId, randomUUID()], + ); + await protectedRun(); + await admin.query( + "UPDATE lzc.runner_pool_slots SET source_droplet_id=$2 WHERE id=$1", + [slotId, binding.runner_package_id], + ); + await admin.query( + "UPDATE lzc.runner_pool_slots SET app_id=$2 WHERE id=$1", + [slotId, randomUUID()], + ); + await protectedRun(); + await admin.query( + "UPDATE lzc.runner_pool_slots SET app_id=$2 WHERE id=$1", + [slotId, binding.runner_app_id], + ); + const previousResult = ( + await admin.query( + "SELECT result FROM lzc.retirement_jobs WHERE id=$1", + [jobId], + ) + ).rows[0].result; + await admin.query( + "UPDATE lzc.retirement_jobs SET result=jsonb_set(coalesce(result,'{}'),'{recoveryRequired}','true') WHERE id=$1", + [jobId], + ); + await protectedRun(); + await admin.query( + "UPDATE lzc.retirement_jobs SET result=$2 WHERE id=$1", + [jobId, previousResult], + ); + expect(await retire()).toBe(1); + expect( + ( + await admin.query( + "SELECT status FROM lzc.runner_pool_slots WHERE id=$1", + [slotId], + ) + ).rows[0].status, + ).toBe("retiring"); + expect(await retire()).toBe(0); + await admin.query("DELETE FROM lzc.runner_pool_slots WHERE id=$1", [ + slotId, + ]); + }, + }; + }; const createPlan = async () => { const job = await execution.plan(owner, entry.id, { generation: entry.generation, @@ -1505,6 +1591,7 @@ it("transfers only a captured same-State scope to independent encrypted custody }), ticket = await waitTicket(job.id), input = await execution.input(ticket); + const cleanup = await warmCleanup(job.id); expect(input.key).toEqual(key); const nativeOutput = { text: "$ tofu init\nInitializing the backend...\n", @@ -1561,7 +1648,9 @@ it("transfers only a captured same-State scope to independent encrypted custody (j) => j.id === job.id, )?.canApply, ).toBe(false); + await cleanup.protectedRun(); await execution.inspect(owner, entry.id, job.id, entry.generation); + await cleanup.completed(); expect( (await execution.review(owner, entry.id)).jobs.find( (j) => j.id === job.id, @@ -1582,6 +1671,7 @@ it("transfers only a captured same-State scope to independent encrypted custody }), ticket = await waitTicket(job.id), input = await execution.input(ticket); + const cleanup = await warmCleanup(job.id); expect(input.plan?.sha256).toBe(artifactHash); await execution.stage(ticket, "validating"); await execution.stage(ticket, "applying"); @@ -1644,7 +1734,15 @@ it("transfers only a captured same-State scope to independent encrypted custody ) ).rows[0].result, ).toBe("protected"); - return execution.inspect(owner, entry.id, job.id, entry.generation); + await cleanup.protectedRun(); + const inspected = await execution.inspect( + owner, + entry.id, + job.id, + entry.generation, + ); + await cleanup.completed(); + return inspected; }; const applicationRetirementPlan = await createPlan(); const applicationRemoved = await runApply(applicationRetirementPlan.id, true); diff --git a/landing-zone-configurator/app/integration/runner-pool.test.ts b/landing-zone-configurator/app/integration/runner-pool.test.ts index 5284a6e2..e4410281 100644 --- a/landing-zone-configurator/app/integration/runner-pool.test.ts +++ b/landing-zone-configurator/app/integration/runner-pool.test.ts @@ -99,46 +99,87 @@ afterAll(async () => { await admin.end(); }); -it("encrypts an assignment, records identity before handoff, consumes once and replenishes a fresh slot", async () => { - const pool = create(); - const slot = await ready(pool); - const assignment = job(); - const record = vi.fn(async (appId: string, source: string) => { - expect(appId).toBe(slot.appId); - expect(source).toBe(config.dropletId); - expect(await pool.claim(slot.id, slot.ticket)).toBeNull(); - }); +it.each(["platform", "application", "retirement"] as const)( + "encrypts a %s assignment, records identity before handoff, consumes once and replenishes a fresh slot", + async (broker) => { + const pool = create(); + const slot = await ready(pool); + const assignment = { ...job(), broker }; + const record = vi.fn(async (appId: string, source: string) => { + expect(appId).toBe(slot.appId); + expect(source).toBe(config.dropletId); + expect(await pool.claim(slot.id, slot.ticket)).toBeNull(); + }); + expect( + await pool.start( + assignment.id, + assignment.ticket, + config.origin, + assignment.broker, + record, + ), + ).toBe(true); + const stored = await database.query( + "SELECT token_hash,assignment FROM lzc.runner_pool_slots WHERE id=$1", + [slot.id], + ); + expect(JSON.stringify(stored.rows)).not.toContain(assignment.ticket); + expect(JSON.stringify(stored.rows)).not.toContain(slot.ticket); + expect(stored.rows[0].assignment).toBeInstanceOf(Buffer); + expect(await pool.claim(slot.id, slot.ticket)).toEqual(assignment); + await expect(pool.claim(slot.id, slot.ticket)).rejects.toThrow(); + const consumed = await database.query( + "SELECT token_hash,assignment,status FROM lzc.runner_pool_slots WHERE id=$1", + [slot.id], + ); + expect(consumed.rows[0]).toEqual({ + token_hash: null, + assignment: null, + status: "consumed", + }); + await pool.maintain(); + expect(driver.prepareWarm).toHaveBeenCalledTimes(2); + await pool.remove(assignment.id, slot.appId); + expect(driver.removeWarm).toHaveBeenCalledWith(slot.id, slot.appId); + }, +); + +it("shares four reserves across retirement, platform and application jobs and replenishes without reusing consumed slots", async () => { + const pool = create({ size: 4 }); + await pool.maintain(); + expect(slots.size).toBe(4); + const initial = [...slots.entries()]; + for (const [id, slot] of initial) + expect(await pool.claim(id, slot.ticket)).toBeNull(); + const assignments = ( + ["retirement", "platform", "application", "retirement"] as const + ).map((broker) => ({ ...job(), broker })); + const record = vi.fn(async () => {}); expect( - await pool.start( - assignment.id, - assignment.ticket, - config.origin, - assignment.broker, - record, + await Promise.all( + assignments.map((assignment) => + pool.start( + assignment.id, + assignment.ticket, + config.origin, + assignment.broker, + record, + ), + ), ), - ).toBe(true); - const stored = await database.query( - "SELECT token_hash,assignment FROM lzc.runner_pool_slots WHERE id=$1", - [slot.id], + ).toEqual([true, true, true, true]); + const handedOff = await Promise.all( + initial.map(([id, slot]) => pool.claim(id, slot.ticket)), ); - expect(JSON.stringify(stored.rows)).not.toContain(assignment.ticket); - expect(JSON.stringify(stored.rows)).not.toContain(slot.ticket); - expect(stored.rows[0].assignment).toBeInstanceOf(Buffer); - expect(await pool.claim(slot.id, slot.ticket)).toEqual(assignment); - await expect(pool.claim(slot.id, slot.ticket)).rejects.toThrow(); - const consumed = await database.query( - "SELECT token_hash,assignment,status FROM lzc.runner_pool_slots WHERE id=$1", - [slot.id], - ); - expect(consumed.rows[0]).toEqual({ - token_hash: null, - assignment: null, - status: "consumed", - }); + expect(handedOff).toEqual(expect.arrayContaining(assignments)); + for (const [id, slot] of initial) + await expect(pool.claim(id, slot.ticket)).rejects.toThrow(); await pool.maintain(); - expect(driver.prepareWarm).toHaveBeenCalledTimes(2); - await pool.remove(assignment.id, slot.appId); - expect(driver.removeWarm).toHaveBeenCalledWith(slot.id, slot.appId); + expect(driver.prepareWarm).toHaveBeenCalledTimes(8); + for (const assignment of assignments) await pool.remove(assignment.id, null); + expect( + (await database.query("SELECT status FROM lzc.runner_pool_slots")).rows, + ).toEqual(Array.from({ length: 4 }, () => ({ status: "warming" }))); }); it("leases a standby to at most one concurrent job", async () => { diff --git a/landing-zone-configurator/app/packages/contracts/src/index.ts b/landing-zone-configurator/app/packages/contracts/src/index.ts index 55ee427a..230df017 100644 --- a/landing-zone-configurator/app/packages/contracts/src/index.ts +++ b/landing-zone-configurator/app/packages/contracts/src/index.ts @@ -36,7 +36,7 @@ export type FirewallAdministration = z.infer< export const runnerPoolAssignmentSchema = z.strictObject({ id: z.uuid(), ticket: z.string().regex(/^[A-Za-z0-9_-]{43}$/), - broker: z.enum(["platform", "application"]), + broker: z.enum(["platform", "application", "retirement"]), }); export type RunnerPoolAssignment = z.infer; diff --git a/landing-zone-configurator/app/tests/runner-copy.test.ts b/landing-zone-configurator/app/tests/runner-copy.test.ts index e08dc2e6..57757402 100644 --- a/landing-zone-configurator/app/tests/runner-copy.test.ts +++ b/landing-zone-configurator/app/tests/runner-copy.test.ts @@ -46,6 +46,7 @@ function fixture(readyAfter: number, state = "STAGED") { return new Response(JSON.stringify(body)); }), ); + const warmStart = vi.fn(async () => false); const runner = new CloudFoundryPlanRunner({ spaceId: space, templateId: template, @@ -53,6 +54,7 @@ function fixture(readyAfter: number, state = "STAGED") { username: "test", password: "private", broker: "retirement", + warm: { start: warmStart, remove: vi.fn(async () => false) }, inspection: { packageId: "test-package", retirementEnabled: true, @@ -71,7 +73,7 @@ function fixture(readyAfter: number, state = "STAGED") { "https://configurator.example", record, ); - return { start, calls, record, app, source }; + return { start, calls, record, app, source, warmStart }; } it("waits beyond the former 30s poll and 120s request deadlines before dispatching exactly once", async () => { const f = fixture(150_000); @@ -80,6 +82,13 @@ it("waits beyond the former 30s poll and 120s request deadlines before dispatchi expect(f.calls.some((c) => c.path.endsWith("/tasks"))).toBe(false); await vi.advanceTimersByTimeAsync(1000); await running; + expect(f.warmStart).toHaveBeenCalledExactlyOnceWith( + expect.any(String), + expect.any(String), + "https://configurator.example", + "retirement", + f.record, + ); expect(f.record).toHaveBeenCalledExactlyOnceWith(f.app, f.source); expect( f.calls.filter( diff --git a/landing-zone-configurator/app/tests/runner-pool.test.ts b/landing-zone-configurator/app/tests/runner-pool.test.ts index 3b209258..71bdc46a 100644 --- a/landing-zone-configurator/app/tests/runner-pool.test.ts +++ b/landing-zone-configurator/app/tests/runner-pool.test.ts @@ -101,57 +101,106 @@ it("prepares a fixed-source route-free single-instance process without any job c expect(calls.at(-1)?.url).toContain(`/apps/${appId}/actions/start`); }); -it("dispatches a ready warm runner without CF authentication, copying or task creation", async () => { - const fetch = vi.fn(); - vi.stubGlobal("fetch", fetch); - const start = vi.fn(async () => true); - const runner = new CloudFoundryPlanRunner({ - spaceId: randomUUID(), - templateId: randomUUID(), - username: "operator", - password: "private", - warm: { start, remove: vi.fn(async () => true) }, - }); - const id = randomUUID(); - const record = vi.fn(); - await runner.start(id, "job-ticket", "https://configurator.example", record); - expect(start).toHaveBeenCalledExactlyOnceWith( - id, - "job-ticket", - "https://configurator.example", - "platform", - record, - ); - expect(fetch).not.toHaveBeenCalled(); - await runner.remove(id, randomUUID()); - expect(fetch).not.toHaveBeenCalled(); -}); - -it("does not silently fall back after a warm reservation or recording failure", async () => { - const fetch = vi.fn(); - vi.stubGlobal("fetch", fetch); - const runner = new CloudFoundryPlanRunner({ - spaceId: randomUUID(), - templateId: randomUUID(), - username: "operator", - password: "private", - warm: { - start: vi.fn(async () => { - throw new Error("record_failed"); - }), - remove: vi.fn(async () => false), - }, - }); - await expect( - runner.start( - randomUUID(), - "ticket", +it.each(["platform", "application", "retirement"] as const)( + "dispatches a ready %s warm runner without CF authentication, copying or task creation", + async (broker) => { + const fetch = vi.fn(); + vi.stubGlobal("fetch", fetch); + const start = vi.fn(async () => true); + const runner = new CloudFoundryPlanRunner({ + spaceId: randomUUID(), + templateId: randomUUID(), + username: "operator", + password: "private", + broker, + ...(broker === "retirement" + ? { + dropletId: randomUUID(), + inspection: { + retirementEnabled: true, + packageId: "fixture", + acceleratorCommit: "fixture", + preview: async () => ({}), + output: async () => ({ + text: "", + truncated: false, + kind: "live" as const, + }), + start: async () => {}, + remove: async () => {}, + }, + } + : {}), + warm: { start, remove: vi.fn(async () => true) }, + }); + const id = randomUUID(); + const record = vi.fn(); + await runner.start( + id, + "job-ticket", "https://configurator.example", - vi.fn(), - ), - ).rejects.toThrow("record_failed"); - expect(fetch).not.toHaveBeenCalled(); -}); + record, + ); + expect(start).toHaveBeenCalledExactlyOnceWith( + id, + "job-ticket", + "https://configurator.example", + broker, + record, + ); + expect(fetch).not.toHaveBeenCalled(); + await runner.remove(id, randomUUID()); + expect(fetch).not.toHaveBeenCalled(); + }, +); + +it.each(["platform", "application", "retirement"] as const)( + "does not silently fall back after a %s warm reservation or recording failure", + async (broker) => { + const fetch = vi.fn(); + vi.stubGlobal("fetch", fetch); + const runner = new CloudFoundryPlanRunner({ + spaceId: randomUUID(), + templateId: randomUUID(), + username: "operator", + password: "private", + broker, + ...(broker === "retirement" + ? { + dropletId: randomUUID(), + inspection: { + retirementEnabled: true, + packageId: "fixture", + acceleratorCommit: "fixture", + preview: async () => ({}), + output: async () => ({ + text: "", + truncated: false, + kind: "live" as const, + }), + start: async () => {}, + remove: async () => {}, + }, + } + : {}), + warm: { + start: vi.fn(async () => { + throw new Error("record_failed"); + }), + remove: vi.fn(async () => false), + }, + }); + await expect( + runner.start( + randomUUID(), + "ticket", + "https://configurator.example", + vi.fn(), + ), + ).rejects.toThrow("record_failed"); + expect(fetch).not.toHaveBeenCalled(); + }, +); it("exposes only bearer-authenticated no-store assignment claims", async () => { const ticket = randomBytes(32).toString("base64url"); diff --git a/landing-zone-configurator/app/tests/runner-stopped.test.ts b/landing-zone-configurator/app/tests/runner-stopped.test.ts index 705d29bb..57b5f3fd 100644 --- a/landing-zone-configurator/app/tests/runner-stopped.test.ts +++ b/landing-zone-configurator/app/tests/runner-stopped.test.ts @@ -3,7 +3,7 @@ import { afterEach, expect, it, vi } from "vitest"; import { CloudFoundryPlanRunner } from "../apps/api/src/plans/cloud-foundry.js"; afterEach(() => vi.unstubAllGlobals()); -function fixture() { +function fixture(broker: "application" | "retirement" = "application") { const id = randomUUID(), app = randomUUID(), space = randomUUID(), @@ -56,21 +56,42 @@ function fixture() { password: "private-test-password", spaceId: space, templateId: template, - broker: "application", + broker, + ...(broker === "retirement" + ? { + dropletId: source, + inspection: { + packageId: "fixture", + acceleratorCommit: "fixture", + retirementEnabled: true, + start: async () => {}, + remove: async () => {}, + preview: async () => ({}), + output: async () => ({ + text: "", + truncated: false, + kind: "live" as const, + }), + }, + } + : {}), }); const run = () => runner.isStopped(id, app, source); return { id, app, space, template, source, cloned, data, calls, run, runner }; } -it("verifies a stopped warm copy by immutable source checksum and exact owning apps", async () => { - const f = fixture(); - await expect(f.run()).resolves.toBe(true); - expect(f.cloned).not.toBe(f.source); - expect( - f.calls - .filter((c) => c.url.includes("/v3/")) - .every((c) => c.method === "GET"), - ).toBe(true); -}); +it.each(["application", "retirement"] as const)( + "verifies a stopped %s warm copy by immutable source checksum and exact owning apps", + async (broker) => { + const f = fixture(broker); + await expect(f.run()).resolves.toBe(true); + expect(f.cloned).not.toBe(f.source); + expect( + f.calls + .filter((c) => c.url.includes("/v3/")) + .every((c) => c.method === "GET"), + ).toBe(true); + }, +); it("verifies a completed one-shot task on the exact job app", async () => { const f = fixture(); (f.data[`apps/${f.app}`] as { name: string }).name = `lzc-plan-${f.id}`; diff --git a/landing-zone-configurator/app/tests/warm-runner.test.ts b/landing-zone-configurator/app/tests/warm-runner.test.ts index 0fcfc831..bfeba16b 100644 --- a/landing-zone-configurator/app/tests/warm-runner.test.ts +++ b/landing-zone-configurator/app/tests/warm-runner.test.ts @@ -40,6 +40,10 @@ const server = createServer(async (request, response) => { let controller: AbortController; const execute = vi.fn(); +const executeRetirement = + vi.fn< + typeof import("../apps/worker/src/retirement.js").runRetirementWorker + >(); const run = ( env: NodeJS.ProcessEnv = {}, dependencies: Parameters[1] = {}, @@ -55,13 +59,14 @@ const run = ( ...env, }, }, - { execute, ...dependencies }, + { execute, executeRetirement, ...dependencies }, ); beforeEach(async () => { controller = new AbortController(); requests = []; execute.mockReset().mockResolvedValue("succeeded"); + executeRetirement.mockReset().mockResolvedValue("succeeded"); respond = (response) => response.end(JSON.stringify(claimed)); server.listen(0, "127.0.0.1"); await once(server, "listening"); @@ -132,6 +137,34 @@ it("takes the platform profile only from the assignment and retains the package }); }); +it.each(["succeeded", "failed"] as const)( + "runs an assigned retirement once through its separate worker (%s)", + async (outcome) => { + executeRetirement.mockResolvedValue(outcome); + respond = (response) => + response.end(JSON.stringify({ ...claimed, broker: "retirement" })); + expect(await run({ LZC_RUNNER_BROKER: "platform" })).toBe(outcome); + expect(execute).not.toHaveBeenCalled(); + expect(executeRetirement).toHaveBeenCalledExactlyOnceWith({ + root: "/immutable/runner-package", + id: jobId, + ticket: jobTicket, + brokerOrigin: trusted.origin, + }); + expect(requests).toHaveLength(1); + }, +); + +it("does not reclaim or run a platform worker after a retirement callback failure", async () => { + respond = (response) => + response.end(JSON.stringify({ ...claimed, broker: "retirement" })); + executeRetirement.mockRejectedValue(Error("retirement callback lost")); + await expect(run()).rejects.toThrow("retirement callback lost"); + expect(requests).toHaveLength(1); + expect(executeRetirement).toHaveBeenCalledOnce(); + expect(execute).not.toHaveBeenCalled(); +}); + it.each([ "{not JSON", "null", diff --git a/landing-zone-configurator/deploy/runner/README.de.md b/landing-zone-configurator/deploy/runner/README.de.md index 1390965d..40aaf69c 100644 --- a/landing-zone-configurator/deploy/runner/README.de.md +++ b/landing-zone-configurator/deploy/runner/README.de.md @@ -46,7 +46,7 @@ OpenTofu-Schritte stehen in `run-plan.sh`. Ablauf und Freigabegrenzen: [Plan-Aus ## Optionaler einmaliger Warm-Pool -Der Warm-Pool ist standardmäßig deaktiviert (`LZC_RUNNER_POOL_SIZE=0`; die geplante +Der Warm-Pool ist standardmäßig deaktiviert (`LZC_RUNNER_POOL_SIZE=0`; die Betreibereinstellung akzeptiert 0..4). Ein warmer Runner hält einen wartenden Node-Prozess im selben CF-Container bereit, mit ausschließlich unveränderlichen Paketdateien. Vor der Zuweisung entstehen weder Auftragszugangsdaten noch @@ -60,7 +60,7 @@ bestehenden vertrauenswürdigen `LZC_BROKER_ORIGIN`. Der Pool-Modus lehnt authentifiziert ausschließlich `POST /api/internal/runner-pool/{id}/claim`; es ist kein Auftragsticket. Nur ein unzugewiesener Status `204` wird ungefähr sekündlich wiederholt. Eine strikt validierte `200`-Zuweisung liefert genau eine -Auftrags-ID, ein Auftragsticket und das Broker-Profil platform/application, +Auftrags-ID, ein Auftragsticket und das Broker-Profil platform/application/retirement, niemals einen neuen Origin, Quellcode oder Paketpfad. Anfragen einschließlich Antwortinhalt laufen nach höchstens 10 Sekunden ab. Weiterleitungen, ungültige Zuweisungen, Autorisierungs-/Konfliktfehler und Netzwerkfehler beenden den Prozess @@ -68,7 +68,7 @@ ohne Wiederholung, weil eine verlorene Antwort die Zuweisung bereits verbraucht haben könnte. Wartende Runner laufen nach 15 Minuten ab; SIGTERM oder SIGINT brechen wartende -Anfragen und Pausen ab. Nach einer Zuweisung ruft der Prozess den bestehenden +Anfragen und Pausen ab. Nach einer Zuweisung ruft der Prozess den zum Broker gehörenden bestehenden Worker genau einmal auf und endet, auch bei Auftrags- oder Ergebnis-Callback-Fehlern. Er akzeptiert niemals einen zweiten Auftrag. Ohne Pool-Bootstrap-Variablen bleibt das Verhalten des kalten und lokalen `main.js`-Einstiegspunkts unverändert. Diese diff --git a/landing-zone-configurator/deploy/runner/README.md b/landing-zone-configurator/deploy/runner/README.md index 01723434..280c4bc4 100644 --- a/landing-zone-configurator/deploy/runner/README.md +++ b/landing-zone-configurator/deploy/runner/README.md @@ -44,7 +44,7 @@ OpenTofu steps are in `run-plan.sh`. Process and approval boundaries: [Plan exec ## Optional one-shot warm pool -The warm pool is default-off (`LZC_RUNNER_POOL_SIZE=0`; the planned operator +The warm pool is default-off (`LZC_RUNNER_POOL_SIZE=0`; the operator setting accepts 0..4). A warm Runner keeps an idle Node process in the same CF container, with only immutable packaged assets available. It creates no job credentials, configuration or workspace before assignment. There is no shared @@ -56,14 +56,14 @@ Pool bootstrap requires both `LZC_POOL_RUNNER_ID` (UUID) and `LZC_POOL_TICKET` Runner mode. The bootstrap ticket authenticates only `POST /api/internal/runner-pool/{id}/claim`; it is not a job ticket. Only an unassigned `204` repeats, approximately once per second. A strict `200` -assignment supplies one job ID, job ticket and platform/application broker +assignment supplies one job ID, job ticket and platform/application/retirement broker profile, never a new origin, source or package root. Requests (including body reads) time out after at most 10 seconds; redirects, malformed assignments, authorization/conflict errors and network failures terminate without retrying, because a lost response might already have consumed the assignment. Idle Runners expire after 15 minutes and cancel idle polling/sleep on SIGTERM or -SIGINT. After one assignment the process invokes the existing worker once and +SIGINT. After one assignment the process invokes the existing worker for the assigned broker once and exits, including job or result-callback failure; it never accepts a second job. Cold and local `main.js` entry behavior remains unchanged when pool bootstrap variables are absent. These bootstrap semantics do not deploy infrastructure: diff --git a/landing-zone-configurator/docs/production.de.md b/landing-zone-configurator/docs/production.de.md index 8a6dac54..2e2d5a4a 100644 --- a/landing-zone-configurator/docs/production.de.md +++ b/landing-zone-configurator/docs/production.de.md @@ -72,7 +72,7 @@ das Abschalten während des Stagings. ## Bereitstellung und Verfügbarkeit -Die geprüfte Stage `lzc-prod` definiert drei Web/API-Instanzen, zwei gemeinsam +Die geprüfte Stage `lzc-prod` definiert drei Web/API-Instanzen, vier gemeinsam verwaltete warme Einmal-Runner und PostgreSQL 17 mit dem Replica-Set-Tarif `2.4-replica`. Die Datenbank erhält 20 GB Speicher, tägliche Backups um 02:00 UTC und 32 Tage Aufbewahrung. Anwendungs- und Runner-Organisation verwenden jeweils diff --git a/landing-zone-configurator/docs/production.md b/landing-zone-configurator/docs/production.md index cdacc770..9cc28a6d 100644 --- a/landing-zone-configurator/docs/production.md +++ b/landing-zone-configurator/docs/production.md @@ -66,7 +66,7 @@ copies, bootstrap, disabled values, secret isolation and staging suspension. ## Deployment and availability -The reviewed `lzc-prod` stage defines three web/API instances, two shared warm +The reviewed `lzc-prod` stage defines three web/API instances, four shared warm one-shot Runner reserves and PostgreSQL 17 on the `2.4-replica` replica-set flavor. The database has 20 GB storage, a nightly 02:00 UTC backup schedule and 32-day retention. CF application and Runner organizations each use the public EU01 diff --git a/landing-zone-configurator/docs/retirement.de.md b/landing-zone-configurator/docs/retirement.de.md index 6437f891..d99aa16d 100644 --- a/landing-zone-configurator/docs/retirement.de.md +++ b/landing-zone-configurator/docs/retirement.de.md @@ -80,6 +80,16 @@ dieser Nachweise startet keinen weiteren Plan/Apply und ändert keine Cloud-Ress 8. Nachweise und Abschlussmeldungen bleiben außerhalb der gelöschten Landing Zone verfügbar. Gelöschte Ressourcen werden nicht automatisch wiederhergestellt. +In der aktuellen Oberfläche startet der Owner den abschließenden Folder-Plan und +das Apply noch selbst. Vor dem Abschluss das STACKIT-Aufbewahrungsfenster abwarten: +Projekte können nach der Löschung noch bis zu sieben Tage unsichtbar bestehen +([Upstream-Issue](https://github.com/stackitcloud/terraform-provider-stackit/issues/1075)). +Wiederholte Pläne beschleunigen oder beweisen diese endgültige Löschung nicht. Meldet +das native Folder-Apply den bekannten Konflikt mit verbleibenden Projekten, dessen +State-/Stopp-Prüfung abschließen und vor einem neuen Plan warten. Terminierte +Erinnerungen und eine automatische Aufforderung zum Abschluss sind noch nicht +implementiert; ein unbeaufsichtigtes abschließendes Apply findet nicht statt. + ## State, Zugangsdaten und unterbrochene Ausführungen Migrationen 103–106 speichern Absicht, genaue State-/Folder-/Revisionsbindung, @@ -89,9 +99,15 @@ diese Tabellen nicht direkt verändern. Eine kurze Transaktionssperre ordnet neu Zugriffe und die späte Freigabe von Zugangsdaten; sie besteht nicht während einer mehrtägigen Wartezeit. -Die Ausführung verwendet einen eigenen kalten Cloud-Foundry-Job-Broker. Die bisherige +Die Ausführung behält ihren eigenen Cloud-Foundry-Job-Broker und Retirement-Worker. +Sie nutzt dieselben vorbereiteten Einmal-Runner wie Plattform- und Application- +Aufträge; nur ohne freie Reserve wird ein kalter Runner gestartet. Die verschlüsselte +Zuweisung wählt den Worker, erhält das unveränderliche Paket samt Quellpfad +und wird genau einmal verbraucht. Die bisherige Bestellerbindung der Application-Ausführung wird weder erweitert noch ausgeliehen. -Jede Zugangsdatenfreigabe prüft den real freigebenden Owner und seine Sitzung, +Migration 112 gibt verbrauchte Reserven erst nach genauer App-/Quellzuordnung, +bestätigtem Prozessstopp und dauerhaftem Abschlussabgleich zur Bereinigung frei. +Ungeklärte State-Recovery bleibt geschützt. Jede Zugangsdatenfreigabe prüft den real freigebenden Owner und seine Sitzung, Profil-/Schlüsselversion, Organisationszugriff, Generation sowie Quelle/Paket erneut. Native State-Zugriffe verwenden ein anwendungskontrolliertes HTTP-Backend mit Datenbanksperre pro Job. Plan-Jobs können keinen State schreiben. Ein nachgewiesen diff --git a/landing-zone-configurator/docs/retirement.md b/landing-zone-configurator/docs/retirement.md index ce42184f..926c30ad 100644 --- a/landing-zone-configurator/docs/retirement.md +++ b/landing-zone-configurator/docs/retirement.md @@ -69,6 +69,15 @@ not run another Plan/Apply or change cloud resources. 8. Completion records and requester notices persist outside the destroyed landing zone. There is no automatic rollback or re-creation of deleted resources. +The current interface still requires the final Folder Plan and Apply to be started +by the owner. Allow STACKIT's project-retention window before trying finalization; +projects can remain hidden for up to seven days after deletion +([upstream issue](https://github.com/stackitcloud/terraform-provider-stackit/issues/1075)). +Repeated Plans do not accelerate that purge or prove that it has happened. If the +native folder Apply reports the known child-project conflict, complete its State/ +stop inspection and wait before creating the next Plan. Scheduled reminders and an +automatic readiness prompt are not implemented; there is no unattended final Apply. + ## State, credentials and interrupted execution Migrations 103–106 retain intent, exact State/folder/revision scopes, affected @@ -77,8 +86,13 @@ HTTP-State custody and separate retirement jobs. Runtime has no direct mutation grant on this ledger. A short transaction advisory fence orders admissions and late credential release; it is never held throughout the multi-day purge wait. -Actual execution uses a dedicated cold Cloud Foundry job broker. It does not widen -or borrow the old requester-bound Application execution capability. Every credential +Actual execution retains its dedicated Cloud Foundry job broker and Retirement +worker. It shares prepared one-shot Runner capacity with Platform and Application +jobs, falling back to a cold Runner only when no reserve is available. The encrypted +assignment selects the worker, keeps the immutable package/root and is consumed +exactly once. It does not widen or borrow requester-bound Application capability. Migration 112 retires consumed reserves only after exact app/source matching, a +confirmed process stop and durable reconciliation; unresolved State recovery remains +protected. Every credential release rechecks the real approving owner/session, profile/key version, organization access, current generation and source/package identity. Native State reads/writes use an application-controlled, per-job HTTP backend and database lock. Plan jobs cannot diff --git a/landing-zone-configurator/infra/ci/production.test.mjs b/landing-zone-configurator/infra/ci/production.test.mjs index 4d17e5da..8368a294 100644 --- a/landing-zone-configurator/infra/ci/production.test.mjs +++ b/landing-zone-configurator/infra/ci/production.test.mjs @@ -97,12 +97,13 @@ 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:"2",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_RUNNER_POOL_SIZE:"4",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); const prepared=JSON.parse(readFileSync(join(directory,"lzc-release/app-vars.json"),"utf8")); - assert.equal(prepared.LZC_APP_INSTANCES,3);assert.equal(prepared.LZC_APP_ROUTE,"app.landing-zone.runs.onstackit.cloud");assert.equal(prepared.LZC_ASSISTANT_ENABLED,"true");assert.equal(prepared.LZC_RUNNER_CF_USERNAME,"runner-space-deployer"); + assert.equal(prepared.LZC_RUNNER_POOL_SIZE,"4");assert.equal(prepared.LZC_APP_INSTANCES,3);assert.equal(prepared.LZC_APP_ROUTE,"app.landing-zone.runs.onstackit.cloud");assert.equal(prepared.LZC_ASSISTANT_ENABLED,"true");assert.equal(prepared.LZC_RUNNER_CF_USERNAME,"runner-space-deployer"); + env.LZC_RUNNER_POOL_SIZE="2";assert.notEqual(run("application").status,0,"Stale capacity must not override reviewed production capacity");env.LZC_RUNNER_POOL_SIZE="4"; assert.ok(!JSON.stringify(prepared).includes("org-manager"));assert.equal(existsSync(join(directory,"lzc-release/platform.backend.hcl")),false); const mailout={schemaVersion:1,projectId:id,domainId:id,senderId:runnerId,from:"notifications@landing-zone.runs.onstackit.cloud",host:"smtp.mailout.eu01.stackit.cloud",port:25,username:"synthetic-smtp-user",password:"synthetic-smtp-password"}; env.LZC_MAILOUT_BINDINGS=JSON.stringify(mailout); diff --git a/landing-zone-configurator/infra/ci/release-notes.mjs b/landing-zone-configurator/infra/ci/release-notes.mjs index 2ddfa9b7..1325e8e6 100644 --- a/landing-zone-configurator/infra/ci/release-notes.mjs +++ b/landing-zone-configurator/infra/ci/release-notes.mjs @@ -1,6 +1,13 @@ const tag=process.env.LZC_RELEASE_TAG; if(!/^v(?:[2-9]|[1-9][0-9]+)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.test(tag??""))throw new Error("Expected a stable product release tag"); const notes={ + "v2.3.9": { + introduction:"Faster retirement startup with shared warm Runner capacity.", + 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.", + ], + }, "v2.3.8": { introduction:"Complete retirement of non-empty buckets, including existing partial retirements.", changes:[ diff --git a/landing-zone-configurator/infra/ci/stages.mjs b/landing-zone-configurator/infra/ci/stages.mjs index 297adc11..c5b7d5a9 100644 --- a/landing-zone-configurator/infra/ci/stages.mjs +++ b/landing-zone-configurator/infra/ci/stages.mjs @@ -18,7 +18,7 @@ const stages = { route: "app.landing-zone.runs.onstackit.cloud", mutationGroup: "configurator-lzc-prod-mutation", appInstances: 3, - runnerPoolSize: 2, + runnerPoolSize: 4, zone: "landing-zone.runs.onstackit.cloud", }, };