feat(hlcc): dispatch approved deployments by explicit signal
This commit is contained in:
parent
357ac5e67a
commit
5897eb6850
13 changed files with 270 additions and 11 deletions
17
server-tools/lake-lamp-authz/deployment-event.test.js
Normal file
17
server-tools/lake-lamp-authz/deployment-event.test.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
"use strict";
|
||||
const test = require("node:test");
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs");
|
||||
const os = require("node:os");
|
||||
const path = require("node:path");
|
||||
const { enqueueDeploymentEvent } = require("./deployment-event");
|
||||
test("only an immutable deployment intent creates a resident-agent event", () => {
|
||||
const queue = fs.mkdtempSync(path.join(os.tmpdir(), "lake-lamp-deploy-events-"));
|
||||
const sha = "a".repeat(40), push = { repo: "bingshuo/guanghu-ice-heart", branch: "main", commit_sha: sha };
|
||||
try {
|
||||
const queued = enqueueDeploymentEvent({ schema: "guanghu.deployment-intent/v1", repo: push.repo, branch: "main", commit_sha: sha, resource: `GLS-0239-DEPLOY@${sha}`, manifest: "deployment/requests/GLS-0239.json", workorder_id: "order-1" }, push, queue);
|
||||
assert.equal(queued.state, "queued_for_resident_agent");
|
||||
assert.equal(fs.readdirSync(queue).length, 1);
|
||||
assert.equal(enqueueDeploymentEvent({ schema: "guanghu.deployment-intent/v1", repo: push.repo, branch: "main", commit_sha: sha, resource: `GLS-0239-DEPLOY@${"b".repeat(40)}`, manifest: "deployment/requests/GLS-0239.json" }, push, queue).diagnostic_code, "deployment_intent_resource_invalid");
|
||||
} finally { fs.rmSync(queue, { recursive: true, force: true }); }
|
||||
});
|
||||
Loading…
Reference in a new issue