From b76315a09b466166a6eec6f0b22f58d3e432c7b9 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 12 Jan 2022 13:24:54 +0000 Subject: Add release script, fix sed for MacOS This commit: - Adds a releease phase script that somewhat automates releases - updates the scritps to use GNU sed on MacOS Issue-ID: POLICY-3835 Change-Id: I2b79c6a3cc3476280ac00a2288e3cb8686ee976a Signed-off-by: liamfallon --- integration/src/release_scripts/mkdock.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'integration/src/release_scripts/mkdock.sh') diff --git a/integration/src/release_scripts/mkdock.sh b/integration/src/release_scripts/mkdock.sh index dfbee9f8..4f1b3e2c 100755 --- a/integration/src/release_scripts/mkdock.sh +++ b/integration/src/release_scripts/mkdock.sh @@ -39,6 +39,14 @@ set -e +# Use the bash internal OSTYPE variable to check for MacOS +if [[ "$OSTYPE" == "darwin"* ]] +then + SED="gsed" +else + SED="sed" +fi + if [ $# -lt 1 -o "$1" = "-?" ] then echo "arg(s): docker-container-name1 docker-container-name2 ..." >&2 @@ -59,20 +67,20 @@ fi echo Branch: ${BRANCH} PROJECT=$(awk -F= '$1 == "project" { print $2 }' "${TOPDIR}/.gitreview" | - sed 's/.git$//') + $SED 's/.git$//') if [ -z "${PROJECT}" ]; then echo "cannot extract project from ${TOPDIR}/.gitreview" >&2 exit 1 fi echo Project: ${PROJECT} -TPROJ=$(echo ${PROJECT} | sed 's!/!%2F!') -DPROJ=$(echo ${PROJECT} | sed 's!/!-!') +TPROJ=$(echo ${PROJECT} | $SED 's!/!%2F!') +DPROJ=$(echo ${PROJECT} | $SED 's!/!-!') RELEASE=$( xmllint --xpath \ '/*[local-name()="project"]/*[local-name()="version"]/text()' \ "${TOPDIR}/pom.xml" | - sed 's!-SNAPSHOT!!' + $SED 's!-SNAPSHOT!!' ) if [ -z "${RELEASE}" ]; then echo "cannot extract release from ${TOPDIR}/pom.xml" >&2 @@ -91,7 +99,7 @@ prefix='https://jenkins.onap.org/view/policy/job/' STAGE_ID=$( curl --silent ${prefix}${DPROJ}-maven-docker-stage-${BRANCH}/ | grep "Last completed build" | - sed -e 's!.*Last completed build .#!!' -e 's!).*!!' | + $SED -e 's!.*Last completed build .#!!' -e 's!).*!!' | head -1 ) if [ -z "${STAGE_ID}" ]; then @@ -129,7 +137,7 @@ do found == 1 && /Tag with/ { print } " | head -1 | - sed 's!.*Tag with!!' | + $SED 's!.*Tag with!!' | cut -d, -f2 ) if [ -z "${VERSION}" ]; then -- cgit 1.2.3-korg