Skip to content
Snippets Groups Projects
Commit afcc0b0c authored by Yanis Guérault's avatar Yanis Guérault Committed by Pierre Smeyers
Browse files

fix: add Git branch slug in SNAPSHOT versions for Merge Request

parent d45f8d6e
No related branches found
No related tags found
No related merge requests found
...@@ -576,12 +576,12 @@ stages: ...@@ -576,12 +576,12 @@ stages:
# only on a branch commit, with deploy and "SNAPSHOT with slug" enabled # only on a branch commit, with deploy and "SNAPSHOT with slug" enabled
function maybe_inject_slug_in_version() { function maybe_inject_slug_in_version() {
if [[ "$CI_COMMIT_BRANCH" ]] && [[ "$MAVEN_DEPLOY_ENABLED" == "true" ]] && [[ "$MAVEN_DEPLOY_SNAPSHOT_WITH_SLUG_ENABLED" == "true" ]] if [[ -z "$CI_COMMIT_TAG" ]] && [[ "$MAVEN_DEPLOY_ENABLED" == "true" ]] && [[ "$MAVEN_DEPLOY_SNAPSHOT_WITH_SLUG_ENABLED" == "true" ]]
then then
# check if on non-prod branch # check if on non-prod branch
prod_ref_expr=${PROD_REF#/} prod_ref_expr=${PROD_REF#/}
prod_ref_expr=${prod_ref_expr%/} prod_ref_expr=${prod_ref_expr%/}
if [[ ! "$CI_COMMIT_BRANCH" =~ $prod_ref_expr ]] if [[ ! "$CI_COMMIT_REF_NAME" =~ $prod_ref_expr ]]
then then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
pom_version=$(mvn $MAVEN_CLI_OPTS $mvn_settings_opt $java_proxy_args help:evaluate -Dexpression=project.version -q -DforceStdout | tail -n 1) pom_version=$(mvn $MAVEN_CLI_OPTS $mvn_settings_opt $java_proxy_args help:evaluate -Dexpression=project.version -q -DforceStdout | tail -n 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment