From 2e912abde0a287d3d31e77b268ef8539c09ff235 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Tue, 13 Feb 2024 04:43:58 +0000 Subject: [PATCH] fix(NA): run script over original cwd for promote manifest pipeline (#176781) This PR solves a problem introduced at https://github.com/elastic/kibana/pull/174756 where the addition into the bash script was not being correctly loaded for the promote manifest pipeline as it was not running in the original main cwd. --- .buildkite/scripts/steps/es_snapshots/promote_manifest.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.buildkite/scripts/steps/es_snapshots/promote_manifest.ts b/.buildkite/scripts/steps/es_snapshots/promote_manifest.ts index 0bcbf67c1e0480..274807a8e50385 100644 --- a/.buildkite/scripts/steps/es_snapshots/promote_manifest.ts +++ b/.buildkite/scripts/steps/es_snapshots/promote_manifest.ts @@ -18,6 +18,7 @@ import { BASE_BUCKET_DAILY, BASE_BUCKET_PERMANENT } from './bucket_config'; throw Error('Manifest URL missing'); } + const mainCWD = process.cwd(); const tempDir = fs.mkdtempSync('snapshot-promotion'); process.chdir(tempDir); @@ -35,13 +36,10 @@ import { BASE_BUCKET_DAILY, BASE_BUCKET_PERMANENT } from './bucket_config'; fs.writeFileSync('manifest-permanent.json', manifestPermanentJson); - const currentPath = execSync('pwd', { encoding: 'utf-8' }).trim(); - console.log('Current working directory:', currentPath); - execSync( ` set -euo pipefail - .buildkite/scripts/common/activate_service_account.sh ${bucket} + ${mainCWD}/.buildkite/scripts/common/activate_service_account.sh ${bucket} cp manifest.json manifest-latest-verified.json gsutil -h "Cache-Control:no-cache, max-age=0, no-transform" cp manifest-latest-verified.json gs://${BASE_BUCKET_DAILY}/${version}/ rm manifest.json