Merge pull request #2611 from pikasTech/fix/migration-start-visibility
Pipelines as Code CI / hwlab-nc01-production-ci-poll- Success
Pipelines as Code CI / hwlab-nc01-production-ci-poll- Success
补齐 production migration 与 raw event 配置
This commit is contained in:
@@ -1000,6 +1000,11 @@ lanes:
|
||||
port: 5432
|
||||
migrationSecretName: hwlab-cloud-api-production-db
|
||||
migrationSecretKey: migration-database-url
|
||||
workbench:
|
||||
rawHwlabEventWindow:
|
||||
enabled: true
|
||||
maxEntries: 200
|
||||
maxRetainedBytes: 1048576
|
||||
envReuseServices: *v03EnvReuseServices
|
||||
bootScripts: *v03BootScripts
|
||||
serviceDeclarations: *v03ServiceDeclarations
|
||||
|
||||
@@ -14,6 +14,11 @@ import { CLOUD_CORE_MIGRATIONS, CLOUD_TRANSACTIONAL_REALTIME_MIGRATION_ID } from
|
||||
|
||||
test("production migration uses its YAML-declared database Secret key", async () => {
|
||||
const deploy = parseYaml(await readFile("deploy/deploy.yaml", "utf8"));
|
||||
assert.deepEqual(deploy.lanes.production.workbench.rawHwlabEventWindow, {
|
||||
enabled: true,
|
||||
maxEntries: 200,
|
||||
maxRetainedBytes: 1048576
|
||||
});
|
||||
const config = externalPostgresConfigForLane(deploy, "production", { nodeId: "NC01" });
|
||||
const manifest = externalPostgresManifest({
|
||||
profile: "production",
|
||||
@@ -753,6 +758,7 @@ test("v03 render keeps node identity as data instead of generated structure", as
|
||||
CLOUD_CORE_MIGRATIONS.map((migration) => path.basename(migration.path))
|
||||
);
|
||||
assert.match(externalPostgresMigrationConfig?.data?.["run.mjs"] ?? "", /DATABASE_URL is required/u);
|
||||
assert.match(externalPostgresMigrationConfig?.data?.["run.mjs"] ?? "", /hwlab-runtime-migration-started/u);
|
||||
assert.equal(externalPostgresMigrationConfig?.metadata?.annotations?.["argocd.argoproj.io/sync-wave"], "-2");
|
||||
assert.equal(externalPostgresMigrationJob?.metadata?.annotations?.["argocd.argoproj.io/sync-wave"], "-1");
|
||||
assert.equal(
|
||||
|
||||
@@ -866,6 +866,7 @@ function externalPostgresMigrationRunner() {
|
||||
'const files = (await readdir(root)).filter((name) => /^\\d+_.*\\.sql$/u.test(name)).sort();',
|
||||
'const connectionString = process.env.DATABASE_URL;',
|
||||
'if (!connectionString) throw new Error("DATABASE_URL is required");',
|
||||
'console.error(JSON.stringify({ event: "hwlab-runtime-migration-started", fileCount: files.length, valuesPrinted: false }));',
|
||||
'const pool = new Pool({ connectionString, max: 1 });',
|
||||
'try {',
|
||||
' for (const file of files) {',
|
||||
|
||||
Reference in New Issue
Block a user