ACS-457: Build linkage, tagging and release

- add validation on release jobs for the latest upstream tag
This commit is contained in:
Cezar.Leahu
2020-08-26 15:23:43 +03:00
parent 4b6dc109f7
commit 67a7af857c
2 changed files with 23 additions and 0 deletions
+8
View File
@@ -18,12 +18,20 @@ if [[ $(isPullRequestBuild) && "${DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ && "${TR
exit 1
fi
# Prevent release jobs from starting when there are SNAPSHOT upstream dependencies
if [[ "${DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] && [ "${TRAVIS_BUILD_STAGE_NAME,,}" = "release" ] ; then
printf "Cannot release project with SNAPSHOT dependencies!\n"
exit 1
fi
UPSTREAM_REPO="github.com/Alfresco/alfresco-community-repo.git"
# For release jobs, check if the upstream dependency is the latest tag on the upstream repository (on the same branch)
if isBranchBuild && [ "${TRAVIS_BUILD_STAGE_NAME,,}" = "release" ] && [ "${DEPENDENCY_VERSION}" = "$(retieveLatestTag "${UPSTREAM_REPO}" "${TRAVIS_BRANCH}")" ] ; then
printf "Upstream dependency is not up to date with %s / %s\n" "${UPSTREAM_REPO}" "${TRAVIS_BRANCH}"
exit 1
fi
# Search, checkout and build the same branch on the upstream project in case of SNAPSHOT dependencies
# Otherwise just checkout the upstream dependency sources
if [[ "${DEPENDENCY_VERSION}" =~ ^.+-SNAPSHOT$ ]] ; then
+15
View File
@@ -111,3 +111,18 @@ function pullAndBuildSameBranchOnUpstream() {
popd
}
function retieveLatestTag() {
local REPO="${1}"
local BRANCH="${2}"
local LOCAL_PATH="/tmp/$(basename "${REPO%.git}")"
git clone -q -b "${BRANCH}" "https://${GIT_USERNAME}:${GIT_PASSWORD}@${REPO}" "${LOCAL_PATH}"
pushd "${LOCAL_PATH}" >/dev/null
git describe --abbrev=0 --tags
popd >/dev/null
rm -rf "${LOCAL_PATH}"
}