From 3d85ea439da5436f7466a54e37cd1a03563b3ae7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 Oct 2022 14:56:24 +0200 Subject: [PATCH] Backport PR #14636 to 7.17: Fix/dra use another technique to extract branch name #14638 Avoid to leverage on git local commands to guess the local branch, it switches to listing the branches and checking against the the stack version. If doesn't exists it's main (cherry picked from commit 11ecaaea5a33ecbc654cd162d1a230a88022c34d) Co-authored-by: Andrea Selva --- ci/dra_upload.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ci/dra_upload.sh b/ci/dra_upload.sh index 6d5230b81..550ab19ce 100755 --- a/ci/dra_upload.sh +++ b/ci/dra_upload.sh @@ -13,7 +13,13 @@ STACK_VERSION=`cat versions.yml | sed -n 's/^logstash\:[[:space:]]\([[:digit:]]* # This is the branch selector that needs to be passed to the release-manager # It has to be the name of the branch which originates the artifacts. -RELEASE_BRANCH=`git rev-parse --abbrev-ref HEAD` +RELEASE_VER=`cat versions.yml | sed -n 's/^logstash\:[[:space:]]\([[:digit:]]*\.[[:digit:]]*\)\.[[:digit:]]*$/\1/p'` +if [ -n "$(git ls-remote --heads origin $RELEASE_VER)" ] ; then + RELEASE_BRANCH=$RELEASE_VER +else + RELEASE_BRANCH=main +fi + if [ -n "$VERSION_QUALIFIER_OPT" ]; then # Qualifier is passed from CI as optional field and specify the version postfix # in case of alpha or beta releases: @@ -26,6 +32,7 @@ if [ -n "$WORKFLOW_TYPE" ]; then STACK_VERSION=${STACK_VERSION}-SNAPSHOT WORKFLOW="snapshot" fi +echo "Uploading artifacts for ${WORKFLOW} workflow on branch: ${RELEASE_BRANCH}" echo "Download all the artifacts for version ${STACK_VERSION}" mkdir build/