From ab6ecdb3a5f6ec1df45668982987cdd236441563 Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Wed, 5 Jun 2024 17:10:00 +0200 Subject: [PATCH] [CI] Fix inverted DRY_RUN behaviour (#184841) ## Summary We added this check in https://github.com/elastic/kibana/pull/177736 but we haven't really tested it in action, it looks like we had the dry-run behaviour inverted. --- .../emergency_release/trigger_container_build.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.buildkite/scripts/serverless/emergency_release/trigger_container_build.ts b/.buildkite/scripts/serverless/emergency_release/trigger_container_build.ts index daf7c904ffd46..c45fb75b5823f 100644 --- a/.buildkite/scripts/serverless/emergency_release/trigger_container_build.ts +++ b/.buildkite/scripts/serverless/emergency_release/trigger_container_build.ts @@ -16,16 +16,16 @@ async function main() { const commitSha = process.env.OVERRIDE_COMMIT || process.env.BUILDKITE_COMMIT; if (!isCurrentHeadInMain(commitSha!)) { - if (!DRY_RUN) { + if (DRY_RUN) { console.log( `DRY_RUN: Commit ${commitSha} isn't in main, triggering container build :green_heart:` ); } else { console.log(`Commit ${commitSha} isn't in main, triggering container build :green_heart:`); - uploadTriggerBuildStep(); + uploadTriggerBuildStep(commitSha!); } } else { - if (!DRY_RUN) { + if (DRY_RUN) { console.log(`DRY_RUN: Commit ${commitSha} is in main, no build necessary :yellow_heart:`); } else { console.log(`Commit ${commitSha} is in main, no trigger necessary :yellow_heart:`); @@ -41,12 +41,14 @@ function isCurrentHeadInMain(commitSha: string) { return parseInt(containmentTest, 10) >= 1; } -function uploadTriggerBuildStep() { +function uploadTriggerBuildStep(commitSha: string) { const triggerStep: BuildkiteTriggerStep = { label: ':point_right: Trigger emergency commit container build', trigger: 'kibana-artifacts-container-image', build: { message: `Triggered by '${process.env.BUILDKITE_PIPELINE_NAME || 'unknown'}'`, + branch: process.env?.BUILDKITE_BRANCH || 'main', + commit: commitSha, env: {}, }, };