From 7d2c0a4aedad3c5e8a81bd19f4417aa4f9fb8360 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Tue, 1 Jul 2025 10:49:40 -0700 Subject: Use correct fetch code props --- .ci/ci.ts | 2 +- model/job/jobs.ts | 2 +- model/pipeline/builder.ts | 2 +- worker/executor.ts | 3 ++- worker/scripts/checkout_ci.ts | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.ci/ci.ts b/.ci/ci.ts index 38a8aad..3cc20a0 100644 --- a/.ci/ci.ts +++ b/.ci/ci.ts @@ -56,7 +56,7 @@ const getPipeline = () => { } const fetchAnsibleCode: FetchCodeJob = { - type: 'fetch_code.js', + type: 'fetch_code', arguments: { remoteUrl: `${REMOTE}/infra`, checkout: 'main', diff --git a/model/job/jobs.ts b/model/job/jobs.ts index 4ed5858..dc23070 100644 --- a/model/job/jobs.ts +++ b/model/job/jobs.ts @@ -7,7 +7,7 @@ export interface FetchCodeJobProps extends JobArgT { } export interface FetchCodeJob { - readonly type: 'fetch_code.js'; + readonly type: 'fetch_code'; readonly arguments: FetchCodeJobProps; } diff --git a/model/pipeline/builder.ts b/model/pipeline/builder.ts index c30867c..926a97f 100644 --- a/model/pipeline/builder.ts +++ b/model/pipeline/builder.ts @@ -30,7 +30,7 @@ export class DefaultGitHookPipelineBuilder extends BasePipelineBuilder { this.addStage({ parallelJobs: [ { - type: 'fetch_code.js', + type: 'fetch_code', arguments: { remoteUrl, checkout: rev, diff --git a/worker/executor.ts b/worker/executor.ts index bfcbc37..47b337c 100644 --- a/worker/executor.ts +++ b/worker/executor.ts @@ -18,7 +18,7 @@ export const executeJob = (tJob: ITraceable) => { const metric = jobTypeMetric(tJob.get().type); return tJob .flatMap(TraceUtil.withMetricTrace(metric)) - .peek((tJob) => tJob.trace.trace(`let's do this little job ok!! ${tJob.get()}`)) + .peek((tJob) => tJob.trace.trace(`let's do this little job ok!! ${JSON.stringify(tJob.get())}`)) .map((tJob) => validateExecutionEntries(tJob.get().arguments) .mapLeft((badEntries) => { @@ -28,6 +28,7 @@ export const executeJob = (tJob: ITraceable) => { .flatMapAsync((args) => getStdout(tJob.move(tJob.get().type), { env: args })), ) .flatMapAsync(TraceUtil.promiseify(TraceUtil.traceResultingEither(metric))) + .peek(TraceUtil.promiseify(t => t.traceScope(() => LogLevel.DEBUG).trace.trace(JSON.stringify(t.get())))) .get(); }; // -- -- diff --git a/worker/scripts/checkout_ci.ts b/worker/scripts/checkout_ci.ts index 0a8b30d..0c6d92c 100755 --- a/worker/scripts/checkout_ci.ts +++ b/worker/scripts/checkout_ci.ts @@ -51,7 +51,7 @@ await LogMetricTraceable.ofLogTraceable(_logJob) tEitherJob.get().flatMapAsync((ciJob) => { const wd = getWorkingDirectoryForCiJob(ciJob); const fetchPackageJob = { - type: 'fetch_code.js', + type: 'fetch_code', arguments: { remoteUrl: ciJob.arguments.remote, checkout: ciJob.arguments.rev, @@ -62,7 +62,7 @@ await LogMetricTraceable.ofLogTraceable(_logJob) mkdir(wd, { recursive: true }) .then(() => process.chdir(wd)) .then(() => tEitherJob.move(fetchPackageJob).map(executeJob).get()) - .then(() => ciJob), + .then((e) => e.fold(err => { throw err; }, () => ciJob)), ); }), ) -- cgit v1.2.3-70-g09d2