Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/configurator-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
17 changes: 17 additions & 0 deletions landing-zone-configurator/infra/ci/production.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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";
Expand Down
5 changes: 5 additions & 0 deletions landing-zone-configurator/infra/mailout/README.de.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions landing-zone-configurator/infra/mailout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading