From 92c49aa152a259b3cbcced56424f7e33873e14d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Weberru=C3=9F?= Date: Fri, 20 Nov 2026 19:06:53 +0000 Subject: [PATCH 1/2] fix(ci): retain production project context for MailOut preparation --- .github/workflows/configurator-production.yml | 1 + .../infra/ci/production.test.mjs | 17 +++++++++++++++++ .../infra/mailout/README.md | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/.github/workflows/configurator-production.yml b/.github/workflows/configurator-production.yml index 7cb743c..b7ce0b8 100644 --- a/.github/workflows/configurator-production.yml +++ b/.github/workflows/configurator-production.yml @@ -143,6 +143,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} LZC_PUBLISHED_RELEASE: 'true' + LZC_PROJECT_ID: ${{ vars.LZC_PROJECT_ID }} LZC_RELEASE_REVISION: ${{ needs.source.outputs.revision }} LZC_RELEASE_RUN_ID: ${{ needs.source.outputs.run_id }} LZC_RELEASE_MODE: ${{ needs.source.outputs.mode }} diff --git a/landing-zone-configurator/infra/ci/production.test.mjs b/landing-zone-configurator/infra/ci/production.test.mjs index e5309a3..dd50f6d 100644 --- a/landing-zone-configurator/infra/ci/production.test.mjs +++ b/landing-zone-configurator/infra/ci/production.test.mjs @@ -14,6 +14,13 @@ function outputs(){ const values=Object.fromEntries(runtimeKeys.map(key=>[key,`synthetic-${key}`])); return [{cf_runtime:{value:cf},plan_runner_cf:{value:runner},database_migration:{value:{host:values.LZC_DATABASE_HOST,port:values.LZC_DATABASE_PORT,database:"configurator",username:"configurator_migration",password:"migration-only"}},assistant_test_model_serving_token:{value:"test-token-never-publish"}}, {space:{value:{id,name:"configurator"}},runner_space:{value:{id:runnerId,name:"plans",org_id:runnerId}},app_environment:{value:{...values,LZC_SERVICE_ACCOUNT_KEY:"no"}},release_credentials:{value:{username:"app-space-deployer",password:"app-space-only"}},dispatcher_credentials:{value:{credentials:{username:"runner-space-deployer",password:"runner-space-only"}}},public_endpoint:{value:{origin:"https://app.landing-zone.runs.onstackit.cloud"}}}]; } +test("production project binding is available to every deployment phase",()=>{ + const workflow=readFileSync(new URL("../../../.github/workflows/configurator-production.yml",import.meta.url),"utf8"); + const deployment=workflow.split("\n deploy:\n")[1]; + assert.ok(deployment,"Production deployment job is required"); + 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("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); @@ -88,6 +95,16 @@ test("production preparation uses scoped bindings, exact PKCE origin and three r 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.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); + assert.equal(run("application").status,0,"Production SMTP preparation must accept the bound project"); + const withMail=JSON.parse(readFileSync(join(directory,"lzc-release/app-vars.json"),"utf8")); + assert.equal(withMail.LZC_MAILOUT_ENABLED,"true");assert.equal(withMail.LZC_MAILOUT_FROM,mailout.from); + delete env.LZC_PROJECT_ID; + assert.notEqual(run("application").status,0,"Missing production project must reject SMTP binding"); + env.LZC_PROJECT_ID=runnerId; + assert.notEqual(run("application").status,0,"Another project must not accept the SMTP binding"); + env.LZC_PROJECT_ID=id; env.LZC_STACKIT_REDIRECT_URI="https://lzc-dev-configurator.apps.01.cf.eu01.stackit.cloud/auth/stackit/callback";assert.notEqual(run("application").status,0); env.LZC_STACKIT_REDIRECT_URI="https://app.landing-zone.runs.onstackit.cloud/auth/stackit/callback"; env.LZC_RELEASE_MODE="skip"; diff --git a/landing-zone-configurator/infra/mailout/README.md b/landing-zone-configurator/infra/mailout/README.md index 20364ef..2abb5f9 100644 --- a/landing-zone-configurator/infra/mailout/README.md +++ b/landing-zone-configurator/infra/mailout/README.md @@ -79,6 +79,10 @@ gh secret set LZC_MAILOUT_BINDINGS --repo stackitcloud/stackit-landing-zone \ ``` Production deployment requires the SMTP binding and fails before activation if it is missing. +The protected `lzc-prod-release` variable `LZC_PROJECT_ID` must match the binding’s +project. It is passed to both backend and application preparation. A +`mailout_bindings_invalid` error before staging can indicate a missing or mismatched +project in runtime preparation; verify the binding and project variable together. The Production Release workflow passes this secret to runtime preparation and verifies the actual CF MailOut binding before SMTP connection checks. Staging email is disabled. Runner and migration applications never receive SMTP credentials or send mail. From 8a3722d73ba5a4c2253dc992ff7c44995eb2f2bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Weberru=C3=9F?= Date: Fri, 20 Nov 2026 19:07:23 +0000 Subject: [PATCH 2/2] docs(mailout): explain production project binding diagnostics in German --- landing-zone-configurator/infra/mailout/README.de.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/landing-zone-configurator/infra/mailout/README.de.md b/landing-zone-configurator/infra/mailout/README.de.md index e01bc62..825c1b5 100644 --- a/landing-zone-configurator/infra/mailout/README.de.md +++ b/landing-zone-configurator/infra/mailout/README.de.md @@ -84,6 +84,11 @@ gh secret set LZC_MAILOUT_BINDINGS --repo stackitcloud/stackit-landing-zone \ ``` Das Prod-Deployment verlangt die SMTP-Bindung und bricht bei fehlender Bindung vor der Aktivierung ab. +Die geschützte Variable `LZC_PROJECT_ID` in `lzc-prod-release` muss zum Projekt der +Bindung passen. Sie wird an Backend- und Anwendungsvorbereitung übergeben. +`mailout_bindings_invalid` vor dem Staging kann auf eine fehlende oder abweichende +Projekt-ID in der Runtime-Vorbereitung hinweisen; Bindung und Projektvariable +gemeinsam prüfen. Production Release übergibt dieses Secret an die Runtime-Vorbereitung und prüft die tatsächliche CF-MailOut-Bindung vor dem SMTP-Verbindungstest. Im Staging ist der Versand deaktiviert. Runner und Migrations-App erhalten keine SMTP-Zugangsdaten und versenden keine Mails.