// node socialweb-computer-cicd.compose.ts > socialweb-computer-cicd.composition.json import { composition, host } from "../../atlibs/javascript/src/compose/build.js"; import { cicdWorkload, irohUserData, policyBidPayload, policyRequesterTangledVouch, processMcp, requester, userData } from "./atlibs.modules.js"; const c = composition({ name: "socialweb.computer CI", description: "A CI job on a VM rented for it on the socialweb.computer market: the requester rents it (bids judged by tangled-vouch and bid-payload), user-data and iroh-user-data make its cloud-init, cicd-workload runs the job's steps over process-mcp, and the requester releases it.", limits: { depth: 4, calls: 100000 }, }); const bidders = c.param("bidders", { label: "Bidder DIDs", type: "array", required: true, description: "The bidders to ask, by DID." }); const cpus = c.param("cpus", { label: "vCPUs", type: "integer", minimum: 1, maximum: 8, values: { default: 2 } }); const mem = c.param("mem", { label: "Memory (GiB)", type: "integer", minimum: 1, maximum: 32, values: { default: 4 } }); const machine = c.instance("machine", requester, { session: "requester", input: { bidders, kind: "vm", cpus, mem, ssh_key: host("sshPublicKey"), shell: true, iroh: true, via: "iroh", release: false, poll_ms: 5000, max_polls: 120, reason: "a knotless run" }, }); const user_data = c.instance("user_data", userData); const iroh_user_data = c.instance("iroh_user_data", irohUserData); const vouch = c.instance("vouch", policyRequesterTangledVouch); const payload = c.instance("payload", policyBidPayload); const process_ = c.instance("process", processMcp); const workload = c.instance("workload", cicdWorkload); c.route(machine, "com.publicdomainrelay.temp.market.evaluatePolicy", vouch, "the requester or its operator vouched for the bidder"); c.route(machine, "com.publicdomainrelay.temp.market.evaluatePolicy", payload, "only free bids"); c.route(machine, "computer.socialweb.vm.userData", user_data, "the VM's cloud-init: the guest agent's shell, iroh in front of sshd"); c.route(user_data, "computer.socialweb.vm.irohUserData", iroh_user_data, "root ssh with the host's key, dumbpipe in front of sshd"); for (const step of ["start", "write", "read"] as const) c.route(workload, `computer.socialweb.cicd.process.${step}`, process_, `the job's ${step} on the VM`); c.export("computer.socialweb.vm.prepare", machine, "bind_key"); c.export("computer.socialweb.vm.provision", machine); c.export("computer.socialweb.vm.release", machine); c.export("computer.socialweb.cicd.workload.run", workload); process.stdout.write(await c.json());