ACS-457: Build linkage, tagging and release

- improvements on the build scripts
This commit is contained in:
Cezar.Leahu
2020-08-18 11:21:12 +03:00
parent 6105ce9a67
commit ae27d6432f
3 changed files with 27 additions and 16 deletions

View File

@@ -21,7 +21,6 @@ branches:
only: only:
- master - master
- /release\/.*/ - /release\/.*/
- feature/ACS-457_travis-release-config
env: env:
global: global:
@@ -237,7 +236,6 @@ jobs:
- name: "Push to Nexus" - name: "Push to Nexus"
stage: release stage: release
if: false if: false
install: travis_retry travis_wait 30 mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true -Pinternal
before_script: bash scripts/travis/verify_release_tag.sh before_script: bash scripts/travis/verify_release_tag.sh
script: travis_wait 40 bash scripts/travis/maven_release.sh script: travis_wait 40 bash scripts/travis/maven_release.sh

View File

@@ -2,7 +2,13 @@
set -ev set -ev
pushd "$(dirname "${BASH_SOURCE[0]}")/../../" pushd "$(dirname "${BASH_SOURCE[0]}")/../../"
PROFILES="$([ "${TRAVIS_BUILD_STAGE_NAME,,}" = "release" ] && echo "-Pinternal" || echo "-PcommunityDocker" )" source "$(dirname "${BASH_SOURCE[0]}")/build_functions.sh"
if [ "${TRAVIS_BUILD_STAGE_NAME,,}" = "release" ] && [ "${TRAVIS_BRANCH}" = "master" ] && isBranchBuild ; then
PROFILES="-Pinternal"
else
PROFILES="-PcommunityDocker"
fi
mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true "${PROFILES}" mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true "${PROFILES}"

View File

@@ -65,6 +65,25 @@ function remoteBranchExists() {
git ls-remote --exit-code --heads "https://${GIT_USERNAME}:${GIT_PASSWORD}@${REMOTE_REPO}" "${BRANCH}" git ls-remote --exit-code --heads "https://${GIT_USERNAME}:${GIT_PASSWORD}@${REMOTE_REPO}" "${BRANCH}"
} }
function identifyUpstreamSourceBranch() {
local UPSTREAM_REPO="${1}"
# if it's a pull request, use the source branch name (if it exists)
if isPullRequestBuild && remoteBranchExists "${UPSTREAM_REPO}" "${TRAVIS_PULL_REQUEST_BRANCH}" ; then
echo "${TRAVIS_PULL_REQUEST_BRANCH}"
exit 0
fi
# otherwise use the current branch name (or in case of PRs, the target branch name)
if remoteBranchExists "${UPSTREAM_REPO}" "${TRAVIS_BRANCH}" ; then
echo "${TRAVIS_BRANCH}"
exit 0
fi
# if none of the previous exists, use the "master" branch
echo "master"
}
function pullUpstreamTag() { function pullUpstreamTag() {
local UPSTREAM_REPO="${1}" local UPSTREAM_REPO="${1}"
local TAG="${2}" local TAG="${2}"
@@ -75,20 +94,8 @@ function pullUpstreamTag() {
function pullAndBuildSameBranchOnUpstream() { function pullAndBuildSameBranchOnUpstream() {
local UPSTREAM_REPO="${1}" local UPSTREAM_REPO="${1}"
local EXTRA_BUILD_ARGUMENTS="${2}" local EXTRA_BUILD_ARGUMENTS="${2}"
local SOURCE_BRANCH="$(isBranchBuild && echo "${TRAVIS_BRANCH}" || echo "${TRAVIS_PULL_REQUEST_BRANCH}")"
if ! remoteBranchExists "${UPSTREAM_REPO}" "${SOURCE_BRANCH}" ; then local SOURCE_BRANCH="$(identifyUpstreamSourceBranch "${UPSTREAM_REPO}")"
printf "Branch \"%s\" not found on the %s repository\n" "${SOURCE_BRANCH}" "${UPSTREAM_REPO}"
#exit 1
fi
local SOURCE_BRANCH="${TRAVIS_BRANCH}"
if ! remoteBranchExists "${UPSTREAM_REPO}" "${SOURCE_BRANCH}" ; then
printf "Branch \"%s\" not found on the %s repository\n" "${SOURCE_BRANCH}" "${UPSTREAM_REPO}"
#exit 1
fi
# TODO remove this line and enable the previous "exit" commands:
local SOURCE_BRANCH="master"
cloneRepo "${UPSTREAM_REPO}" "${SOURCE_BRANCH}" cloneRepo "${UPSTREAM_REPO}" "${SOURCE_BRANCH}"