ACS-550 Disable Docker image push on Continuous Releases

This commit is contained in:
Cezar.Leahu
2020-09-09 20:56:51 +03:00
parent cfd9508585
commit 53c39f98a0
3 changed files with 27 additions and 56 deletions

View File

@@ -12,8 +12,8 @@ git config user.email "${GIT_EMAIL}"
# Run the release plugin - with "[skip ci]" in the release commit message
mvn -B \
-Prelease,fullBuild,all-tas-tests \
"-Darguments=-Prelease,fullBuild,all-tas-tests -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \
-PfullBuild,all-tas-tests \
"-Darguments=-PfullBuild,all-tas-tests -DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER}" \
release:clean release:prepare release:perform \
-DscmCommentPrefix="[maven-release-plugin][skip ci] " \
-Dusername="${GIT_USERNAME}" \

View File

@@ -5,47 +5,19 @@ set -vex
pushd "$(dirname "${BASH_SOURCE[0]}")/../../"
#
# Check that the version to be released does not already have a docker tag.
# Check that the version to be released does not already have a git tag.
#
POM_VERSION=$(mvn -B -q help:evaluate -Dexpression=project.version -DforceStdout)
printf "POM version: %s\n" "${POM_VERSION}"
IMAGE_TAG="${POM_VERSION%-SNAPSHOT}"
TAG="${POM_VERSION%-SNAPSHOT}"
if git rev-parse "${IMAGE_TAG}^{tag}" &>/dev/null ; then
echo "The next tag \"${IMAGE_TAG}\" already exists in the git project"
if git rev-parse "${TAG}^{tag}" &>/dev/null ; then
echo "The next tag \"${TAG}\" already exists in the git project"
exit 1
fi
# get the image name from the pom file
ALFRESCO_DOCKER_IMAGE="$(mvn -B -q help:evaluate -f ./packaging/docker-alfresco/pom.xml -Dexpression=image.name -DforceStdout)"
DOCKER_IMAGE_FULL_NAME="${ALFRESCO_DOCKER_IMAGE}:${IMAGE_TAG}"
function docker_image_exists() {
local IMAGE_FULL_NAME="${1}"; shift
local WAIT_TIME="${1:-5}"
local SEARCH_TERM='Pulling|is up to date|not found'
echo "Looking to see if ${IMAGE_FULL_NAME} already exists..."
local RESULT=$( (timeout --preserve-status "${WAIT_TIME}" docker 2>&1 pull "${IMAGE_FULL_NAME}" &) | grep -v 'Pulling repository' | grep -E -o "${SEARCH_TERM}")
test "${RESULT}" || { echo "Timed out too soon. Try using a wait_time greater than ${WAIT_TIME}..."; return 1 ;}
if echo "${RESULT}" | grep -vq 'not found'; then
true
else
false
fi
}
if docker_image_exists "${DOCKER_IMAGE_FULL_NAME}" ; then
echo "Tag ${RELEASE_VERSION} already pushed, release process will interrupt."
exit 1
else
echo "The ${RELEASE_VERSION} tag was not found"
fi
popd
set +vex
echo "=========================== Finishing Verify Release Tag Script =========================="