From 98a29f6007a3843e31a218b53a1606ebb683385c Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Mon, 6 Jan 2025 13:00:44 +0100 Subject: [PATCH] move deduplication to emitPipeline --- .buildkite/pipeline-utils/buildkite/emitPipeline.ts | 3 ++- .buildkite/scripts/pipelines/pull_request/pipeline.ts | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.buildkite/pipeline-utils/buildkite/emitPipeline.ts b/.buildkite/pipeline-utils/buildkite/emitPipeline.ts index 9e814e02e92f9..b0f12075eee79 100644 --- a/.buildkite/pipeline-utils/buildkite/emitPipeline.ts +++ b/.buildkite/pipeline-utils/buildkite/emitPipeline.ts @@ -7,6 +7,7 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -export function emitPipeline(pipelineStr: string) { +export function emitPipeline(pipelineSteps: string[]) { + const pipelineStr = [...new Set(pipelineSteps)].join('\n'); console.log(pipelineStr); } diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index cf58da0ad31eb..b5f9584e8c47c 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -48,7 +48,7 @@ const getPipeline = (filename: string, removeSteps = true) => { const skippable = await areChangesSkippable(SKIPPABLE_PR_MATCHERS, REQUIRED_PATHS); if (skippable) { - emitPipeline(emptyStep); + emitPipeline([emptyStep]); return; } @@ -58,7 +58,7 @@ const getPipeline = (filename: string, removeSteps = true) => { if (onlyRunQuickChecks) { pipeline.push(getPipeline('.buildkite/pipelines/pull_request/renovate.yml', false)); console.warn('Isolated changes to renovate.json. Skipping main PR pipeline.'); - emitPipeline([...new Set(pipeline)].join('\n')); + emitPipeline(pipeline); return; } @@ -411,8 +411,7 @@ const getPipeline = (filename: string, removeSteps = true) => { pipeline.push(getPipeline('.buildkite/pipelines/pull_request/post_build.yml')); - // remove duplicated steps - emitPipeline([...new Set(pipeline)].join('\n')); + emitPipeline(pipeline); } catch (ex) { console.error('Error while generating the pipeline steps: ' + ex.message, ex); process.exit(1);