fix: label guarded deploy route
This commit is contained in:
parent
77836ac7fe
commit
07ba5de227
|
|
@ -8,11 +8,11 @@ describe("factory check", () => {
|
||||||
it("prints live counts from response data", () => {
|
it("prints live counts from response data", () => {
|
||||||
const out = formatFactoryCheck(
|
const out = formatFactoryCheck(
|
||||||
{ status: "ok", phase: 4, containers: 24, agents: 6, infra: 14, monitoring: 5, skills: 63 },
|
{ status: "ok", phase: 4, containers: 24, agents: 6, infra: 14, monitoring: 5, skills: 63 },
|
||||||
{ status: "ok", service: "deploy-webhook", phase: 4 },
|
{ status: "ok", service: "git-proxy-deploy", phase: 4 },
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(out).toContain("Containers: 24");
|
expect(out).toContain("Containers: 24");
|
||||||
expect(out).toContain("Deploy webhook: ok (deploy-webhook)");
|
expect(out).toContain("Deploy route: ok (git-proxy-deploy)");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("accepts factory-status 200", async () => {
|
it("accepts factory-status 200", async () => {
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ async function checkDeployRoute(fetcher: FetchLike, timeoutMs: number): Promise<
|
||||||
try {
|
try {
|
||||||
const res = await fetcher(DEPLOY_HEALTH_URL, { method: "POST", signal: controller.signal });
|
const res = await fetcher(DEPLOY_HEALTH_URL, { method: "POST", signal: controller.signal });
|
||||||
if (res.status !== 401 && !res.ok) throw new Error(`${DEPLOY_HEALTH_URL} returned ${res.status}`);
|
if (res.status !== 401 && !res.ok) throw new Error(`${DEPLOY_HEALTH_URL} returned ${res.status}`);
|
||||||
return { status: "ok", service: "deploy-webhook" };
|
return { status: "ok", service: "git-proxy-deploy" };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error && error.name === "AbortError") throw new Error(`${DEPLOY_HEALTH_URL} timed out`);
|
if (error instanceof Error && error.name === "AbortError") throw new Error(`${DEPLOY_HEALTH_URL} timed out`);
|
||||||
throw error;
|
throw error;
|
||||||
|
|
@ -108,7 +108,7 @@ export function formatFactoryCheck(factory: FactoryStatus, deploy: DeployHealth,
|
||||||
` Infra: ${factory.infra ?? "unknown"}`,
|
` Infra: ${factory.infra ?? "unknown"}`,
|
||||||
` Monitoring: ${factory.monitoring ?? "unknown"}`,
|
` Monitoring: ${factory.monitoring ?? "unknown"}`,
|
||||||
` Skills: ${factory.skills ?? "unknown"}`,
|
` Skills: ${factory.skills ?? "unknown"}`,
|
||||||
` Deploy webhook: ${deploy.status ?? "unknown"}${deploy.service ? ` (${deploy.service})` : ""}`,
|
` Deploy route: ${deploy.status ?? "unknown"}${deploy.service ? ` (${deploy.service})` : ""}`,
|
||||||
...errors.map((e) => ` Warning: ${e}`),
|
...errors.map((e) => ` Warning: ${e}`),
|
||||||
"",
|
"",
|
||||||
].join("\n");
|
].join("\n");
|
||||||
|
|
|
||||||
|
|
@ -1524,7 +1524,7 @@ async function printFactoryCheck(runId?: string): Promise<{ ready: boolean }> {
|
||||||
|
|
||||||
factory
|
factory
|
||||||
.command("check")
|
.command("check")
|
||||||
.description("Check factory status and deploy-webhook health")
|
.description("Check factory status and 8099 deploy route health")
|
||||||
.option("--run <id>", "Emit factory check event to .runs/<id>/channel.jsonl")
|
.option("--run <id>", "Emit factory check event to .runs/<id>/channel.jsonl")
|
||||||
.action(async (opts: { run?: string }) => {
|
.action(async (opts: { run?: string }) => {
|
||||||
await printFactoryCheck(opts.run);
|
await printFactoryCheck(opts.run);
|
||||||
|
|
@ -1620,7 +1620,7 @@ factory
|
||||||
.description("Post an approved command to the factory deploy webhook")
|
.description("Post an approved command to the factory deploy webhook")
|
||||||
.option("--token <token>", "Deploy token; defaults to FACTORY_DEPLOY_TOKEN or DEPLOY_TOKEN")
|
.option("--token <token>", "Deploy token; defaults to FACTORY_DEPLOY_TOKEN or DEPLOY_TOKEN")
|
||||||
.requiredOption("--gate-receipt <path>", "ZTE/factory gate receipt JSONL containing a passed status")
|
.requiredOption("--gate-receipt <path>", "ZTE/factory gate receipt JSONL containing a passed status")
|
||||||
.option("--url <url>", "Deploy webhook URL", "http://77.42.112.29:8099/deploy")
|
.option("--url <url>", "Deploy route URL", "http://77.42.112.29:8099/deploy")
|
||||||
.option("--out <path>", "Deploy receipt path")
|
.option("--out <path>", "Deploy receipt path")
|
||||||
.option("--yes", "Confirm this is an approved deploy command")
|
.option("--yes", "Confirm this is an approved deploy command")
|
||||||
.option("--run <id>", "Emit deploy receipt event to .runs/<id>/channel.jsonl")
|
.option("--run <id>", "Emit deploy receipt event to .runs/<id>/channel.jsonl")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue