diff options
Diffstat (limited to 'worker/scripts/run_pipeline')
-rwxr-xr-x | worker/scripts/run_pipeline | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/worker/scripts/run_pipeline b/worker/scripts/run_pipeline index 9991001..abb13b3 100755 --- a/worker/scripts/run_pipeline +++ b/worker/scripts/run_pipeline @@ -1,11 +1,11 @@ #!/usr/bin/env -S deno run --allow-env --allow-net --allow-run --allow-read --allow-write -import { type Job, PipelineImpl } from "@liz-ci/model"; +import { PipelineImpl } from "@liz-ci/model"; import { getRequiredEnv, getStdout, + invalidExecutionEntriesOf, loggerWithPrefix, - validateIdentifier, } from "@liz-ci/utils"; const pipelinePath = getRequiredEnv("pipeline"); @@ -13,39 +13,32 @@ const logger = loggerWithPrefix(() => `[${new Date().toISOString()}] [run_pipeline.${pipelinePath}]` ); -const jobValidForExecution = (job: Job) => { - return Object - .entries(job.arguments) - .filter((e) => { - if (e.every(validateIdentifier)) return true; - logger.error(`job of type ${job.type} has invalid args ${e}`); - return false; - }) - .length === 0; -}; - const run = async () => { - logger.log("starting pipeline execution"); + logger.log("starting pipeline execution~ time to work hard!"); const stages = await (Deno.readTextFile(pipelinePath)) .then(PipelineImpl.from) .then((pipeline) => pipeline.getStages()); for (const stage of stages) { - logger.log("executing stage", stage); + logger.log("executing stage. do your best little stage :>", stage); await Promise.all( stage.parallelJobs.map(async (job, jobIdx) => { - logger.log(`executing job ${jobIdx}`, job); - if (!jobValidForExecution(job)) throw new Error("invalid job"); + logger.log(`let's do this little job ok!! ${jobIdx}`, job); + const invalidArgs = invalidExecutionEntriesOf(job.arguments); + if (invalidArgs.length) { + logger.error(`oh nooes`, invalidArgs); + throw new Error("invalid job arguments"); + } const result = await getStdout(job.type, { env: job.arguments }); - logger.log(jobIdx, "outputs", { result }); + logger.log(jobIdx, "brought something to you! look :D", { result }); }), ); } - logger.log("ok! yay!"); + logger.log("all done! everything worked! yay~ (⑅˘꒳˘)"); }; if (import.meta.main) { |