#!/usr/bin/env -S deno --allow-env --allow-net --allow-read import { type Job, PipelineImpl } from "@liz-ci/model"; import { getRequiredEnv, getStdout, validateIdentifier } from "@liz-ci/utils"; const stages = await (Deno.readTextFile(getRequiredEnv("pipeline"))) .then(PipelineImpl.from) .then((pipeline) => pipeline.getStages()); const validateJob = (job: Job) => { Object.entries(job.arguments).forEach((e) => { if (!e.every(validateIdentifier)) { throw new Error(`job of type ${job.type} has invalid entry ${e}`); } }); }; for (const stage of stages) { await Promise.all( stage.parallelJobs.map((job) => { validateJob(job); return getStdout(job.type, { env: job.arguments, }); }), ); }