summaryrefslogtreecommitdiff
path: root/worker/scripts/checkout_ci.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-07-20 15:00:03 -0700
committerElizabeth Hunt <me@liz.coffee>2025-07-20 15:27:42 -0700
commit2e10e9172f8528868b70886335dbbe20f932f702 (patch)
tree373ee281d1219ee9d3cdd1bf6900e130bd91c20d /worker/scripts/checkout_ci.ts
parentfb6b516abfc74ae2158d451c62dda4fc29038b22 (diff)
downloadci-2e10e9172f8528868b70886335dbbe20f932f702.tar.gz
ci-2e10e9172f8528868b70886335dbbe20f932f702.zip
Fix joinRight, dockerfile optimizations, failure joining
Diffstat (limited to 'worker/scripts/checkout_ci.ts')
-rwxr-xr-xworker/scripts/checkout_ci.ts36
1 files changed, 20 insertions, 16 deletions
diff --git a/worker/scripts/checkout_ci.ts b/worker/scripts/checkout_ci.ts
index 6a1dcad..ac36d69 100755
--- a/worker/scripts/checkout_ci.ts
+++ b/worker/scripts/checkout_ci.ts
@@ -11,10 +11,11 @@ import {
prependWith,
TraceUtil,
getStdoutMany,
+ IEither,
} from '@emprespresso/pengueno';
import { mkdir, readFile, rm } from 'fs/promises';
import { join } from 'path';
-import { type CheckoutCiJob, type FetchCodeJob, PipelineImpl } from '@emprespresso/ci_model';
+import { type CheckoutCiJob, type FetchCodeJob, Pipeline, PipelineImpl } from '@emprespresso/ci_model';
import { executeJob, executePipeline } from '@emprespresso/ci_worker';
interface CiWorkflow {
@@ -102,21 +103,24 @@ await LogMetricTraceable.ofLogTraceable(logTraceableJob)
commands: getPipelineGenerationCommand(job, workflow),
}));
})
- .map(async (tEitherPipelineGenerationCommand) => {
- const eitherJobCommand = await tEitherPipelineGenerationCommand.get();
- const pipelineSerialized = await eitherJobCommand.flatMapAsync(({ commands }) =>
- getStdoutMany(
- tEitherPipelineGenerationCommand.move(commands).peek((t) => t.trace.trace(JSON.stringify(t.get()))),
- ),
- );
- return pipelineSerialized
- .flatMap((results) => {
- tEitherPipelineGenerationCommand.trace.trace(JSON.stringify(results));
- const pipeline = results.at(-1)!;
- return PipelineImpl.from(pipeline);
- })
- .joinRight(eitherJobCommand, (job, pipeline) => ({ job, pipeline }));
- })
+ .map(
+ async (
+ tEitherPipelineGenerationCommand,
+ ): Promise<IEither<Error, { job: CheckoutCiJob; pipeline: Pipeline }>> => {
+ const eitherJobCommand = await tEitherPipelineGenerationCommand.get();
+ const pipelineSerialized = await eitherJobCommand.flatMapAsync(({ commands }) =>
+ getStdoutMany(
+ tEitherPipelineGenerationCommand.move(commands).peek((t) => t.trace.trace(JSON.stringify(t.get()))),
+ ),
+ );
+ return pipelineSerialized
+ .flatMap((results) => {
+ const pipeline = results.at(-1)!;
+ return PipelineImpl.from(pipeline);
+ })
+ .joinRight(eitherJobCommand, ({ job }, pipeline) => ({ job, pipeline }));
+ },
+ )
.peek(
TraceUtil.promiseify((tEitherPipeline) =>
tEitherPipeline