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 11ecaaea5a)

Co-authored-by: Andrea Selva <selva.andre@gmail.com>
This commit is contained in:
github-actions[bot] 2022-10-12 14:56:24 +02:00 committed by GitHub
parent 60765f5ad1
commit 3d85ea439d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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/