mirror of
https://github.com/Alfresco/acs-community-packaging.git
synced 2026-09-16 18:13:21 +00:00
ACS-457: Build linkage, tagging and release
- add validation on release jobs for the latest upstream tag
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user