From fa8f3f9465e87d499f7d6428323f496a884b7818 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Sat, 10 May 2025 16:57:03 -0700 Subject: initial commit --- worker/scripts/run_pipeline | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 worker/scripts/run_pipeline (limited to 'worker/scripts/run_pipeline') diff --git a/worker/scripts/run_pipeline b/worker/scripts/run_pipeline new file mode 100644 index 0000000..ad58573 --- /dev/null +++ b/worker/scripts/run_pipeline @@ -0,0 +1,28 @@ +#!/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, + }); + }), + ); +} -- cgit v1.2.3-70-g09d2