- Profiles pin each environment: POC (branch poc) and Fanyu (branch dev, 180.76.138.88, droboticflow-fanyu), with their Deployments by UID - Releases expect every Deployment of their profile; Fanyu's api image also runs its annotation processor and validator, each rolled back to its own image - Bindings may list several projects; each Runner has its own settings - fanyu-access: least-privilege identity and build-Pod admission policy in Fanyu's cluster, its token only in the executor and Fanyu's Runner - projects --replace: delete every project with all it holds, then create the POC and Fanyu projects, their environments and Runners - Ship the Runner's public keys in the ConfigMap, not a Mac path Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.8 KiB
TypeScript
39 lines
1.8 KiB
TypeScript
/**
|
||
* Points the bound projects' protected checks at this image (docs/cluster-poc-deployment.md):
|
||
* a project migrated from the Mac still names the Mac's Node and check script, which no check Pod
|
||
* has. The platform container runs this before the control plane starts; see clusterCheckCommands.
|
||
*/
|
||
import { readFile } from 'node:fs/promises';
|
||
import { PgStore } from '../apps/api/src/db/store.js';
|
||
import { touch } from '../apps/api/src/domain/control-plane.js';
|
||
import { localPocBindingSchema } from '../packages/runtime/src/index.js';
|
||
import type { Project } from '../packages/contracts/src/index.js';
|
||
import { clusterCheckCommands } from './cluster-poc-entry.mjs';
|
||
|
||
const bindings = [JSON.parse(await readFile(process.env.WF_LOCAL_POC_BINDING_FILE!, 'utf8'))]
|
||
.flat()
|
||
.map(binding => localPocBindingSchema.parse(binding));
|
||
const store = new PgStore(process.env.DATABASE_URL!);
|
||
try {
|
||
await store.assertSafeRole();
|
||
for (const binding of bindings) {
|
||
const changed = await store.transaction(binding.tenantId, async tx => {
|
||
const project = await tx.get<Project>('project', binding.projectId);
|
||
if (!project) return false;
|
||
const installCommands = clusterCheckCommands(project.installCommands, 'install');
|
||
const verificationCommands = clusterCheckCommands(project.verificationCommands, 'verify');
|
||
if (installCommands === project.installCommands && verificationCommands === project.verificationCommands)
|
||
return false;
|
||
await tx.put('project', touch({ ...project, installCommands, verificationCommands }));
|
||
return true;
|
||
});
|
||
console.log(
|
||
changed
|
||
? `Pointed project ${binding.projectId}’s protected checks at this image.`
|
||
: `Project ${binding.projectId}’s protected checks already point at this image.`,
|
||
);
|
||
}
|
||
} finally {
|
||
await store.close();
|
||
}
|