From 5cfe52fe4e76eb9389354d13493f2bda84e34651 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 16:33:06 +0300 Subject: [PATCH] [7.17](backport #38736) Fix the dynamic step for pipeline upload on the x-pack Heartbeat (#38737) Fix unbound BEATS_PROJECT_NAME Signed-off-by: Alexandros Sapranidis (cherry picked from commit a455d0508128ffc3bd2b37d6bdfe721d46b9caa6) Co-authored-by: Alexandros Sapranidis --- .buildkite/scripts/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.buildkite/scripts/common.sh b/.buildkite/scripts/common.sh index 6e6b0919abae..51f88d4ed768 100755 --- a/.buildkite/scripts/common.sh +++ b/.buildkite/scripts/common.sh @@ -69,7 +69,8 @@ case "${BUILDKITE_PIPELINE_SLUG}" in esac check_and_set_beat_vars() { - if [[ -n "$BEATS_PROJECT_NAME" && "$BEATS_PROJECT_NAME" == *"x-pack/"* ]]; then + local BEATS_PROJECT_NAME=${BEATS_PROJECT_NAME:=""} + if [[ "${BEATS_PROJECT_NAME:=""}" == *"x-pack/"* ]]; then BEATS_XPACK_PROJECT_NAME=${BEATS_PROJECT_NAME//-/} #remove - BEATS_XPACK_PROJECT_NAME=${BEATS_XPACK_PROJECT_NAME//\//_} #replace / to _ BEATS_XPACK_LABEL_PROJECT_NAME=${BEATS_PROJECT_NAME//\//-} #replace / to - for labels