JIB image name is not correct when using private registry
Describe the bug
When CI_REGISTRY_IMAGE contains ':', the JIB release image name is wrong.
Expected behavior
When releasing JIB image, MAVEN_JIB_RELEASE_IMAGE variable should have only the tag 'main' replaced with the version number.
Actual behavior
The tag is replacing too much.
Logs and/or screenshots
...
++ export MAVEN_JIB_RELEASE_IMAGE=repo:5002/project:main
++ MAVEN_JIB_RELEASE_IMAGE=repo:5002/project:main
...
if [[ "${SEMREL_INFO_ON}" && "${MVN_SEMREL_RELEASE_DISABLED}" != "true" ]]
then
if [[ -z "${SEMREL_INFO_NEXT_VERSION}" ]]
then
log_warn "[semantic-release] no new version to release: skip"
exit 0
else
MAVEN_JIB_RELEASE_IMAGE=$(echo "$MAVEN_JIB_RELEASE_IMAGE" | sed "s/\(:.*\)\{0,1\}$/:$SEMREL_INFO_NEXT_VERSION/")
log_info "[semantic-release] new Image tag is set: $MAVEN_JIB_RELEASE_IMAGE"
fi
fi
...
++ [[ -n prod ]]
++ [[ '' != \t\r\u\e ]]
++ [[ -z 1.0.0 ]]
+++ echo repo:5002/project:main
+++ sed 's/\(:.*\)\{0,1\}$/:1.0.0/'
++ MAVEN_JIB_RELEASE_IMAGE=repo:1.0.0
++ log_info '[semantic-release] new Image tag is set: repo:1.0.0'
...
In this example, MAVEN_JIB_RELEASE_IMAGE is repo:5002/project:main and should be changed to repo:5002/project:1.0.0, but instead was changed to repo:1.0.0, which is not correct.
Context & Configuration
The issue was reproduced using:
- Version of the template: 4.3
- GitLab server(s): self-managed server
Edited by Benjamin Plusquellec