wishforge-ide/scripts/cluster-poc-project.ts
eust-w aa151d16f9 ✨ Deliver to Fanyu's cluster from the dev branch beside the POC
- 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>
2026-11-01 17:47:47 +08:00

39 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 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();
}