diff options
author | liamfallon <liam.fallon@est.tech> | 2022-03-01 21:01:03 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2022-03-01 21:05:54 +0000 |
commit | d7d9a664cb6d45b1019f8ac897feac512e5b37e8 (patch) | |
tree | aeda2f2c5b71e61abb81a086e69530b021be6f62 /integration/src/release_scripts | |
parent | 006a229e166b5656fd9ba320e2b36d33c7e945a8 (diff) |
Update release scripts for branches
Release scripts are updated:
- Can now handle releasing on a branch for a maintenance release
- startPhase.sh script updated to handle all 13 phases of the release
process
- Various corrections and bug fixes found during the release
- scripts updated to comply with IntelliJ shekkcheck suggestions
Issue-ID: POLICY-3835
Change-Id: Ibfa49e4132ca61ae0541600fae5f6814cdf7a409
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'integration/src/release_scripts')
-rwxr-xr-x | integration/src/release_scripts/bumpSnapshots.sh | 43 | ||||
-rwxr-xr-x | integration/src/release_scripts/generateCommit.sh | 41 | ||||
-rwxr-xr-x | integration/src/release_scripts/getReleaseData.sh | 79 | ||||
-rwxr-xr-x | integration/src/release_scripts/mkart.sh | 20 | ||||
-rwxr-xr-x | integration/src/release_scripts/mkdock.sh | 23 | ||||
-rwxr-xr-x | integration/src/release_scripts/releasePhase.sh | 270 | ||||
-rwxr-xr-x | integration/src/release_scripts/releaseRepo.sh | 39 | ||||
-rwxr-xr-x | integration/src/release_scripts/releaseRepoImages.sh | 31 | ||||
-rwxr-xr-x | integration/src/release_scripts/updateOomImages.sh | 16 | ||||
-rwxr-xr-x | integration/src/release_scripts/updateParentRef.sh | 30 | ||||
-rwxr-xr-x | integration/src/release_scripts/updateRefs.sh | 115 |
11 files changed, 494 insertions, 213 deletions
diff --git a/integration/src/release_scripts/bumpSnapshots.sh b/integration/src/release_scripts/bumpSnapshots.sh index ced6453c..d7d22df7 100755 --- a/integration/src/release_scripts/bumpSnapshots.sh +++ b/integration/src/release_scripts/bumpSnapshots.sh @@ -22,7 +22,7 @@ set -e -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") repo_location="./" release_data_file="./pf_release_data.csv" @@ -138,11 +138,14 @@ fi for specified_repo in "${pf_repos[@]}" do - read repo \ + # shellcheck disable=SC2034 + # shellcheck disable=SC2046 + read -r repo \ latest_released_tag \ latest_snapshot_tag \ - changed_files docker_images \ - <<< $( grep $specified_repo $release_data_file | tr ',' ' ' ) + changed_files \ + docker_images \ + <<< $(grep "$specified_repo" "$release_data_file" | tr ',' ' ' ) if [ ! "$repo" = "$specified_repo" ] then @@ -154,28 +157,30 @@ do if [ "$latest_released_tag" = "$next_release_version" ] then - declare -i major_version=`echo $next_release_version | $SED -E 's/^([0-9]*)\.[0-9]*\.[0-9]*$/\1/'` - declare -i minor_version=`echo $next_release_version | $SED -E 's/^[0-9]*\.([0-9]*)\.[0-9]*$/\1/'` - declare -i patch_version=`echo $next_release_version | $SED -E 's/^[0-9]*\.[0-9]*\.([0-9]*)$/\1/'` - declare -i new_patch_version=$(($patch_version+1)) + major_version=$(echo "$next_release_version" | $SED -E 's/^([0-9]*)\.[0-9]*\.[0-9]*$/\1/') + minor_version=$(echo "$next_release_version" | $SED -E 's/^[0-9]*\.([0-9]*)\.[0-9]*$/\1/') + patch_version=$(echo "$next_release_version" | $SED -E 's/^[0-9]*\.[0-9]*\.([0-9]*)$/\1/') + # shellcheck disable=SC2004 + new_patch_version=$(($patch_version+1)) new_snapshot_tag="$major_version"."$minor_version"."$new_patch_version"-SNAPSHOT - echo updating snapshot version and references of repo $repo to $new_snapshot_tag . . . - mvn -f $repo_location/$repo \ - -DnewVersion=$new_snapshot_tag versions:set \ + echo "updating snapshot version and references of repo $repo to $new_snapshot_tag . . ." + mvn -f "$repo_location/$repo" \ + "-DnewVersion=$new_snapshot_tag" versions:set \ versions:update-child-modules versions:commit temp_file=$(mktemp) - echo updating snapshot version of repo $repo in $repo_location/$repo/version.properties - $SED -e "s/patch=$patch_version/patch=$new_patch_version/" $repo_location/$repo/version.properties > $temp_file - mv $temp_file $repo_location/$repo/version.properties + echo "updating snapshot version of repo $repo in $repo_location/$repo/version.properties" + $SED -e "s/patch=$patch_version/patch=$new_patch_version/" \ + "$repo_location/$repo/version.properties" > "$temp_file" + mv "$temp_file" "$repo_location/$repo/version.properties" fi - updateRefs.sh -pcmos -d $release_data_file -l $repo_location -r $repo + updateRefs.sh -pcmos -d "$release_data_file" -l "$repo_location" -r "$repo" - if [ "$(git -C $repo_location/$specified_repo status | grep '^[ \t]*modified:[ \t]*pom.xml' > /dev/null 2>&1)" = 0 ] + if [ "$(git -C "$repo_location/$specified_repo" status | grep '^[ \t]*modified:[ \t]*pom.xml' > /dev/null 2>&1)" = 0 ] then references_updated=0 else @@ -190,9 +195,9 @@ do echo "generating commit to update snapshot version and/or references of repo $repo . . ." generateCommit.sh \ - -l $repo_location \ - -r $repo \ - -i $issue_id \ + -l "$repo_location" \ + -r "$repo" \ + -i "$issue_id" \ -e "Update snapshot and/or references of $repo to latest snapshots" \ -m "$repo updated to its latest own and reference snapshots" diff --git a/integration/src/release_scripts/generateCommit.sh b/integration/src/release_scripts/generateCommit.sh index 8c21c308..29e600a2 100755 --- a/integration/src/release_scripts/generateCommit.sh +++ b/integration/src/release_scripts/generateCommit.sh @@ -22,7 +22,7 @@ set -e -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") repo_location="./" usage() @@ -47,13 +47,6 @@ usage() exit 255; } -update_parent=false -update_common=false -update_models=false -update_drools_pdp=false -update_snapshot=false -update_docker=false - while getopts "hl:r:i:e:m:" opt do case $opt in @@ -129,7 +122,7 @@ then exit 1 fi -git -C $repo_location/$specified_repo status | grep '^Your branch is up to date' > /dev/null 2>&1 +git -C "$repo_location/$specified_repo" status | grep '^Your branch is up to date' > /dev/null 2>&1 return_code=$? if [ $return_code -eq 0 ] @@ -137,30 +130,32 @@ then echo "generating commit '$commit_header' . . ." commit_msg_temp_file=$(mktemp) - echo "$commit_header" > $commit_msg_temp_file - echo "" >> $commit_msg_temp_file - echo "$commit_message" >> $commit_msg_temp_file - echo "" >> $commit_msg_temp_file - echo "*** This commit is generated by a PF release script ***" >> $commit_msg_temp_file - echo "" >> $commit_msg_temp_file - echo "Issue-ID: $issue_id" >> $commit_msg_temp_file - - git -C $repo_location/$specified_repo add . - git -C $repo_location/$specified_repo commit -s -F "$commit_msg_temp_file" - rm $commit_msg_temp_file + { + echo "$commit_header" + echo "" + echo "$commit_message" + echo "" + echo "*** This commit is generated by a PF release script ***" + echo "" + echo "Issue-ID: $issue_id" + } > "$commit_msg_temp_file" + + git -C "$repo_location/$specified_repo" add . + git -C "$repo_location/$specified_repo" commit -s -F "$commit_msg_temp_file" + rm "$commit_msg_temp_file" echo "commit '$commit_header' generated" else echo "updating commit '$commit_header' . . ." - git -C $repo_location/$specified_repo add . - git -C $repo_location/$specified_repo commit -as --amend --no-edit + git -C "$repo_location/$specified_repo" add . + git -C "$repo_location/$specified_repo" commit -as --amend --no-edit echo "commit '$commit_header' updated" fi echo "sending commit '$commit_header' to gerrit . . ." -git -C $repo_location/$specified_repo review +git -C "$repo_location/$specified_repo" review echo "commit '$commit_header' sent to gerrit . . ." diff --git a/integration/src/release_scripts/getReleaseData.sh b/integration/src/release_scripts/getReleaseData.sh index 3d3bad9d..4afd1bd9 100755 --- a/integration/src/release_scripts/getReleaseData.sh +++ b/integration/src/release_scripts/getReleaseData.sh @@ -22,9 +22,10 @@ set -e -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") repo_location="./" release_data_file="./pf_release_data.csv" +branch="master" # Use the bash internal OSTYPE variable to check for MacOS if [[ "$OSTYPE" == "darwin"* ]] @@ -59,18 +60,22 @@ usage() echo "" echo " options" echo " -h - this help message" + echo " -b branch - the branch to release on, defaults to '$branch'" echo " -d data_file - the policy release data file to create, defaults to '$release_data_file'" echo " -l location - the location of the policy framework repos on the file system," echo " defaults to '$repo_location'" exit 255; } -while getopts "hd:l:" opt +while getopts "hb:d:l:" opt do case $opt in h) usage ;; + b) + branch=$OPTARG + ;; d) release_data_file=$OPTARG ;; @@ -84,15 +89,15 @@ do esac done -if [ $OPTIND -eq 1 ] +if [[ -z "$repo_location" ]] then - echo "no arguments were specified" - usage + echo "policy repo location not specified on -l flag" + exit 1 fi -if [[ -z "$repo_location" ]] +if [[ -z "$branch" ]] then - echo "policy repo location not specified on -l flag" + echo "policy branch not specified on -b flag" exit 1 fi @@ -113,15 +118,16 @@ update_repos() { for repo in "${pf_repos[@]}" do - echo "updating data from repo $repo to data file '$release_data_file' . . ." + echo "updating data from repo $repo branch $branch to data file '$release_data_file' . . ." - if [ -d $repo_location/$repo ] + if [ -d "$repo_location/$repo" ] then echo "updating repository '$repo' . . ." - git -C $repo_location/$repo checkout master - git -C $repo_location/$repo pull - git -C $repo_location/$repo rebase - git -C $repo_location/$repo fetch --tags + git -C "$repo_location/$repo" checkout -- . + git -C "$repo_location/$repo" checkout "$branch" + git -C "$repo_location/$repo" pull + git -C "$repo_location/$repo" rebase + git -C "$repo_location/$repo" fetch --tags else echo "repo $repo does not exist" exit 1 @@ -132,45 +138,54 @@ update_repos() { echo "policy framework data from '$repo_location' updated to data file '$release_data_file' . . ." } - get_tags() { - echo "Repo, Last Tag Version,Master Snapshot Version,Changed Files,Docker Images" - echo "repo, Last Tag Version,Master Snapshot Version,Changed Files,Docker Images" > $release_data_file + echo "Repo, Last Tag Version,Snapshot Version,Changed Files,Docker Images" + echo "repo, Last Tag Version,Snapshot Version,Changed Files,Docker Images" > "$release_data_file" for repo in "${pf_repos[@]}" do - latest_released_tag=`git -C $repo_location/$repo tag | \ - grep '^[0-9]*\.[0-9]*\.[0-9]*$' | \ - sort -V | \ - tail -1` - - latest_snapshot_tag=`mvn -f $repo_location/$repo clean | \ + latest_snapshot_tag=$(mvn -f "$repo_location/$repo" clean | \ grep "SNAPSHOT" | \ tail -1 | \ - $SED -r 's/^.* ([0-9]*\.[0-9]*\.[0-9]*-SNAPSHOT).*$/\1/'` + $SED -r 's/^.* ([0-9]*\.[0-9]*\.[0-9]*-SNAPSHOT).*$/\1/') + + if [[ $branch == *master ]] + then + latest_released_tag=$(git -C "$repo_location/$repo" tag | \ + grep '^[0-9]*\.[0-9]*\.[0-9]*$' | \ + sort -V | \ + tail -1) + else + # shellcheck disable=SC2001 + latest_snapshot_major_minor=$(echo "$latest_snapshot_tag" | sed 's/\.[0-9]*-SNAPSHOT$//') + latest_released_tag=$(git -C "$repo_location/$repo" tag | \ + grep '^[0-9]*\.[0-9]*\.[0-9]*$' | \ + grep "$latest_snapshot_major_minor" | \ + sort -V | \ + tail -1) + fi - changed_files=`git -C $repo_location/$repo diff --name-only $latest_released_tag origin/master | \ + changed_files=$(git -C "$repo_location/$repo" diff --name-only "$latest_released_tag" "$branch" | \ grep -v 'pom.xml$' | \ grep -v '^version.properties$' | \ grep -v "^releases/$latest_released_tag.yaml$" | \ - grep -v "^releases/$latest_released_tag-container.yaml$" | \ - wc -l | \ - $SED 's/^[[:space:]]*//g'` + grep -cv "^releases/$latest_released_tag-container.yaml$" | \ + $SED 's/^[[:space:]]*//g') - if [ -f $repo_location/$repo/releases/$latest_released_tag-container.yaml ] + latest_container_yaml=$(find "$repo_location/$repo/releases" -name "*container.yaml" | sort | tail -1) + if [ "$latest_container_yaml" != "" ] then - docker_images=`grep '\- name:' $repo_location/$repo/releases/$latest_released_tag-container.yaml | \ + docker_images=$(grep '\- name:' "$latest_container_yaml" | \ $SED -e 's/\- //g' -e 's/\://g' -e "s/\'//g" -e 's/^[[:space:]]*//g' -e 's/^name //' | \ tr '\n' ':' | \ - $SED 's/:$//'` + $SED 's/:$//') else docker_images="" fi echo "$repo,$latest_released_tag,$latest_snapshot_tag,$changed_files,$docker_images" - echo "$repo,$latest_released_tag,$latest_snapshot_tag,$changed_files,$docker_images" >> $release_data_file + echo "$repo,$latest_released_tag,$latest_snapshot_tag,$changed_files,$docker_images" >> "$release_data_file" done } update_repos get_tags - diff --git a/integration/src/release_scripts/mkart.sh b/integration/src/release_scripts/mkart.sh index 62ec0302..2243e293 100755 --- a/integration/src/release_scripts/mkart.sh +++ b/integration/src/release_scripts/mkart.sh @@ -65,7 +65,7 @@ if [ -z "${BRANCH}" ]; then echo "cannot extract default branch from ${TOPDIR}/.gitreview" >&2 exit 1 fi -echo Branch: ${BRANCH} +echo Branch: "${BRANCH}" PROJECT=$(awk -F= '$1 == "project" { print $2 }' "${TOPDIR}/.gitreview" | $SED 's/.git$//') @@ -73,9 +73,8 @@ 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!/!-!') +echo Project: "${PROJECT}" +DPROJ=$(echo "${PROJECT}" | $SED 's!/!-!') VERSION=$( xmllint --xpath \ @@ -87,11 +86,11 @@ if [ -z "${VERSION}" ]; then echo "cannot extract version from ${TOPDIR}/pom.xml" >&2 exit 1 fi -echo Version: ${VERSION} +echo "Version: ${VERSION}" prefix='https://jenkins.onap.org/view/policy/job/' STAGE_ID=$( - curl --silent ${prefix}${DPROJ}-maven-stage-${BRANCH}/ | + curl --silent "${prefix}${DPROJ}-maven-stage-${BRANCH}/" | grep "Last completed build" | $SED -e 's!.*Last completed build .#!!' -e 's!).*!!' | head -1 @@ -100,18 +99,19 @@ if [ -z "${STAGE_ID}" ]; then echo "cannot extract last maven stage ID from jenkins" >&2 exit 1 fi -STAGE_ID=${DPROJ}-maven-stage-${BRANCH}/${STAGE_ID}/ -echo Stage ID: ${STAGE_ID} +STAGE_ID="${DPROJ}-maven-stage-${BRANCH}/${STAGE_ID}/" +echo Stage ID: "${STAGE_ID}" prefix='https://jenkins.onap.org/view/policy/job/' -JOB_OUT=$(curl --silent ${prefix}${STAGE_ID}/console) +JOB_OUT=$(curl --silent "${prefix}${STAGE_ID}/consoleFull") echo "${JOB_OUT}" | grep -q "Finished: SUCCESS" +# shellcheck disable=SC2181 if [ $? -ne 0 ]; then echo "last jenkins build has not completed successfully" >&2 exit 1 fi -echo Creating ${TOPDIR}/releases/${VERSION}.yaml +echo Creating "${TOPDIR}/releases/${VERSION}.yaml" echo "distribution_type: 'maven'" > "${TOPDIR}/releases/${VERSION}.yaml" echo "version: '${VERSION}'" >> "${TOPDIR}/releases/${VERSION}.yaml" diff --git a/integration/src/release_scripts/mkdock.sh b/integration/src/release_scripts/mkdock.sh index 4f1b3e2c..0df4abad 100755 --- a/integration/src/release_scripts/mkdock.sh +++ b/integration/src/release_scripts/mkdock.sh @@ -47,6 +47,7 @@ else SED="sed" fi +# shellcheck disable=SC2166 if [ $# -lt 1 -o "$1" = "-?" ] then echo "arg(s): docker-container-name1 docker-container-name2 ..." >&2 @@ -64,7 +65,7 @@ if [ -z "${BRANCH}" ]; then echo "cannot extract default branch from ${TOPDIR}/.gitreview" >&2 exit 1 fi -echo Branch: ${BRANCH} +echo "Branch: ${BRANCH}" PROJECT=$(awk -F= '$1 == "project" { print $2 }' "${TOPDIR}/.gitreview" | $SED 's/.git$//') @@ -72,9 +73,8 @@ 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!/!-!') +echo "Project: ${PROJECT}" +DPROJ=$(echo "${PROJECT}" | $SED 's!/!-!') RELEASE=$( xmllint --xpath \ @@ -86,18 +86,18 @@ if [ -z "${RELEASE}" ]; then echo "cannot extract release from ${TOPDIR}/pom.xml" >&2 exit 1 fi -echo Release: ${RELEASE} +echo "Release: ${RELEASE}" REF_ID=$(git log | grep commit | head -1 | awk '{ print $2 }') if [ -z "${REF_ID}" ]; then echo "cannot extract ref from 'git log'" >&2 exit 1 fi -echo Ref: ${REF_ID} +echo "Ref: ${REF_ID}" prefix='https://jenkins.onap.org/view/policy/job/' STAGE_ID=$( - curl --silent ${prefix}${DPROJ}-maven-docker-stage-${BRANCH}/ | + curl --silent "${prefix}${DPROJ}-maven-docker-stage-${BRANCH}/" | grep "Last completed build" | $SED -e 's!.*Last completed build .#!!' -e 's!).*!!' | head -1 @@ -107,17 +107,18 @@ if [ -z "${STAGE_ID}" ]; then exit 1 fi STAGE_ID=${DPROJ}-maven-docker-stage-${BRANCH}/${STAGE_ID} -echo Stage ID: ${STAGE_ID} +echo "Stage ID: ${STAGE_ID}" prefix='https://jenkins.onap.org/view/policy/job/' -JOB_OUT=$(curl --silent ${prefix}${STAGE_ID}/console) +JOB_OUT=$(curl --silent "${prefix}${STAGE_ID}/consoleFull") echo "${JOB_OUT}" | grep -q "Finished: SUCCESS" +# shellcheck disable=SC2181 if [ $? -ne 0 ]; then echo "last docker build has not completed successfully" >&2 exit 1 fi -echo Creating ${TOPDIR}/releases/${RELEASE}-container.yaml +echo "Creating ${TOPDIR}/releases/${RELEASE}-container.yaml" cat >"${TOPDIR}/releases/${RELEASE}-container.yaml" <<EOT distribution_type: 'container' container_release_tag: '${RELEASE}' @@ -144,7 +145,7 @@ do echo "cannot extract ${CONT_NAME} version from jenkins build output" >&2 exit 1 fi - echo ${CONT_NAME} version: ${VERSION} + echo "${CONT_NAME} version: ${VERSION}" cat >>"${TOPDIR}/releases/${RELEASE}-container.yaml" <<EOT_LOOP - name: '${CONT_NAME}' diff --git a/integration/src/release_scripts/releasePhase.sh b/integration/src/release_scripts/releasePhase.sh index 26a4588e..b3f7e0af 100755 --- a/integration/src/release_scripts/releasePhase.sh +++ b/integration/src/release_scripts/releasePhase.sh @@ -22,7 +22,7 @@ set -e -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") repo_location="./" release_data_file="./pf_release_data.csv" @@ -129,11 +129,11 @@ fi release_phase_1() { echo "Updating parent references in the parent pom and generating commit . . ." - updateRefs.sh -d $release_data_file -l $repo_location -r policy/parent -p + updateRefs.sh -d "$release_data_file" -l "$repo_location" -r policy/parent -p generateCommit.sh \ - -l $repo_location \ + -l "$repo_location" \ -r policy/parent \ - -i $issue_id \ + -i "$issue_id" \ -e "update parent references in policy/parent pom" \ -m "updated the parent references in the policy/parent pom" echo "Updated parent references in the parent pom and generated commit" @@ -141,41 +141,240 @@ release_phase_1() { release_phase_2() { echo "Generating artifact release yaml file and commit for policy/parent . . ." - releaseRepo.sh -d $release_data_file -l $repo_location -r policy/parent -i $issue_id + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/parent -i "$issue_id" echo "Generated artifact release yaml file and commit for policy/parent" } release_phase_3() { echo "Updating snapshots for policy/parent, updating references on policy/docker and policy/common . . ." bumpSnapshots.sh \ - -d $release_data_file \ - -l $repo_location \ - -i $issue_id + -d "$release_data_file" \ + -l "$repo_location" \ + -i "$issue_id" updateRefs.sh \ -p \ - -d $release_data_file \ - -l $repo_location \ - -r policy/docker + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/docker" updateRefs.sh \ -p \ - -d $release_data_file \ - -l $repo_location \ - -r policy/common + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/common" generateCommit.sh \ - -l $repo_location \ - -r policy/docker \ - -i $issue_id \ + -l "$repo_location" \ + -r "policy/docker" \ + -i "$issue_id" \ -e "update parent references in policy/docker pom" \ -m "updated the parent references in the policy/docker pom" generateCommit.sh \ - -l $repo_location \ - -r policy/common \ - -i $issue_id \ + -l "$repo_location" \ + -r "policy/common" \ + -i "$issue_id" \ -e "update parent references in policy/common pom" \ -m "updated the parent references in the policy/common pom" echo "Updated snapshots for policy/parent, updating references on policy/docker and policy/common" } +release_phase_4() { + echo "Generating artifact release yaml file and commit for policy/common . . ." + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/common -i "$issue_id" + echo "Generated artifact release yaml file and commit for policy/common" + + echo "Generating docker release yaml file and commit for policy/docker . . ." + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/docker -i "$issue_id" + echo "Generated docker release yaml file and commit for policy/docker" +} + +release_phase_5() { + echo "Updating snapshots for policy/common and policy/docker, updating references on policy/models . . ." + bumpSnapshots.sh \ + -d "$release_data_file" \ + -l "$repo_location" \ + -i "$issue_id" + updateRefs.sh \ + -pc \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/models" + generateCommit.sh \ + -l "$repo_location" \ + -r "policy/models" \ + -i "$issue_id" \ + -e "update parent,common references in policy/models pom" \ + -m "updated the parent and common references in the policy/models pom" + echo "Updated snapshots for policy/common and policy/docker, updated references on policy/models" +} + +release_phase_6() { + echo "Generating artifact release yaml file and commit for policy/models . . ." + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/models -i "$issue_id" + echo "Generated artifact release yaml file and commit for policy/models" +} + +release_phase_7() { + echo "Updating snapshots for policy/models, updating references on other repos . . ." + bumpSnapshots.sh \ + -d "$release_data_file" \ + -l "$repo_location" \ + -i "$issue_id" + updateRefs.sh \ + -pcmk \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/apex-pdp" + updateRefs.sh \ + -pcmk \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/api" + updateRefs.sh \ + -pcmk \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/clamp" + updateRefs.sh \ + -pcmk \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/distribution" + updateRefs.sh \ + -pcmk \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/drools-pdp" + updateRefs.sh \ + -pcmk \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/gui" + updateRefs.sh \ + -pcmk \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/pap" + updateRefs.sh \ + -pcmk \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/xacml-pdp" + generateCommit.sh \ + -l "$repo_location" \ + -r "policy/apex-pdp" \ + -i "$issue_id" \ + -e "update references in policy/apex-pdp pom" \ + -m "updated references in the policy/apex-pdp pom" + generateCommit.sh \ + -l "$repo_location" \ + -r "policy/api" \ + -i "$issue_id" \ + -e "update references in policy/api pom" \ + -m "updated references in the policy/api pom" + generateCommit.sh \ + -l "$repo_location" \ + -r "policy/clamp" \ + -i "$issue_id" \ + -e "update references in policy/clamp pom" \ + -m "updated references in the policy/clamp pom" + generateCommit.sh \ + -l "$repo_location" \ + -r "policy/distribution" \ + -i "$issue_id" \ + -e "update references in policy/distribution pom" \ + -m "updated references in the policy/distribution pom" + generateCommit.sh \ + -l "$repo_location" \ + -r "policy/drools-pdp" \ + -i "$issue_id" \ + -e "update references in policy/drools-pdp pom" \ + -m "updated references in the policy/drools-pdp pom" + generateCommit.sh \ + -l "$repo_location" \ + -r "policy/gui" \ + -i "$issue_id" \ + -e "update references in policy/gui pom" \ + -m "updated references in the policy/gui pom" + generateCommit.sh \ + -l "$repo_location" \ + -r "policy/pap" \ + -i "$issue_id" \ + -e "update references in policy/pap pom" \ + -m "updated references in the policy/pap pom" + generateCommit.sh \ + -l "$repo_location" \ + -r "policy/xacml-pdp" \ + -i "$issue_id" \ + -e "update references in policy/xacml-pdp pom" \ + -m "updated references in the policy/xacml-pdp pom" + echo "Updated snapshots for policy/models, updated references on other repos" +} + +release_phase_8() { + echo "Generating artifact release yaml file and commit for repos . . ." + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/apex-pdp -i "$issue_id" + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/api -i "$issue_id" + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/clamp -i "$issue_id" + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/distribution -i "$issue_id" + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-pdp -i "$issue_id" + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/gui -i "$issue_id" + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/pap -i "$issue_id" + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/xacml-pdp -i "$issue_id" + echo "Generated artifact release yaml file and commit for repos" +} + +release_phase_9() { + echo "Generating docker release yaml file and commit for repos . . ." + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/apex-pdp -i "$issue_id" + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/api -i "$issue_id" + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/clamp -i "$issue_id" + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/distribution -i "$issue_id" + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-pdp -i "$issue_id" + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/gui -i "$issue_id" + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/pap -i "$issue_id" + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/xacml-pdp -i "$issue_id" + echo "Generated docker release yaml file and commit for repos" +} + +release_phase_10() { + echo "Updating snapshots for repos, updating references on policy/drools-applications . . ." + bumpSnapshots.sh \ + -d "$release_data_file" \ + -l "$repo_location" \ + -i "$issue_id" + updateRefs.sh \ + -pcmok \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/drools-applications" + generateCommit.sh \ + -l "$repo_location" \ + -r "policy/drools-applications" \ + -i "$issue_id" \ + -e "update references in policy/drools-applications pom" \ + -m "updated references in the policy/drools-applications pom" + echo "Updated snapshots for repos, updated references on policy/drools-applications" +} + +release_phase_11() { + echo "Generating artifact release yaml file and commit for policy/drools-applications . . ." + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-applications -i "$issue_id" + echo "Generated artifact release yaml file and commit for policy/drools-applications" +} + +release_phase_12() { + echo "Generating docker release yaml file and commit for policy/drools-applications . . ." + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/drools-applications -i "$issue_id" + echo "Generated docker release yaml file and commit for policy/drools-applications" +} + +release_phase_13() { + echo "Updating snapshots on policy/drools-applications . . ." + bumpSnapshots.sh \ + -d "$release_data_file" \ + -l "$repo_location" \ + -i "$issue_id" +} + case "$release_phase" in 1) release_phase_1 @@ -187,7 +386,36 @@ case "$release_phase" in 3) release_phase_3 ;; +4) release_phase_4 + ;; + +5) release_phase_5 + ;; + +6) release_phase_6 + ;; + +7) release_phase_7 + ;; + +8) release_phase_8 + ;; + +9) release_phase_9 + ;; + +10) release_phase_10 + ;; + +11) release_phase_11 + ;; + +12) release_phase_12 + ;; + +13) release_phase_13 + ;; + *) echo "specified release phase '$release_phase' is invalid" ;; esac - diff --git a/integration/src/release_scripts/releaseRepo.sh b/integration/src/release_scripts/releaseRepo.sh index c2aa95a4..ef1592f2 100755 --- a/integration/src/release_scripts/releaseRepo.sh +++ b/integration/src/release_scripts/releaseRepo.sh @@ -20,9 +20,7 @@ # ============LICENSE_END================================================== # -set -e - -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") repo_location="./" release_data_file="./pf_release_data.csv" @@ -121,11 +119,14 @@ then exit 1 fi -read repo \ +# shellcheck disable=SC2034 +# shellcheck disable=SC2046 +read -r repo \ latest_released_tag \ latest_snapshot_tag \ - changed_files docker_images \ - <<< $( grep $specified_repo $release_data_file | tr ',' ' ' ) + changed_files \ + docker_images \ + <<< $(grep "$specified_repo" "$release_data_file" | tr ',' ' ' ) if [ ! "$repo" = "$specified_repo" ] then @@ -137,7 +138,7 @@ next_release_version=${latest_snapshot_tag%-*} while true do - read -p "have you run 'stage_release' on the '$repo' repo? " yes_no + read -r -p "have you run 'stage_release' on the '$repo' repo? " yes_no case $yes_no in [Yy]* ) break ;; @@ -150,22 +151,30 @@ do esac done -saved_current_dir=`pwd` -cd $repo_location/$repo +saved_current_dir=$(pwd) +cd "$repo_location/$repo" || exit 1 if [ "$docker_images" != "" ] then - mkart.sh -d + mkart_flag="-d" else - mkart.sh + mkart_flag="" +fi + +if ! mkart.sh "$mkart_flag" +then + echo "generation of artifact release yaml file failed" + cd "$saved_current_dir" || exit 1 + exit 1 fi -cd $saved_current_dir + +cd "$saved_current_dir" || exit 1 echo "generating commit for $repo release: $latest_released_tag-->$next_release_version . . ." generateCommit.sh \ - -l $repo_location \ - -r $repo \ - -i $issue_id \ + -l "$repo_location" \ + -r "$repo" \ + -i "$issue_id" \ -e "Release $repo: $next_release_version" \ -m "This commit releases repo $repo." diff --git a/integration/src/release_scripts/releaseRepoImages.sh b/integration/src/release_scripts/releaseRepoImages.sh index d7c5bea3..0bcae6a4 100755 --- a/integration/src/release_scripts/releaseRepoImages.sh +++ b/integration/src/release_scripts/releaseRepoImages.sh @@ -20,9 +20,7 @@ # ============LICENSE_END================================================== # -set -e - -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") repo_location="./" release_data_file="./pf_release_data.csv" @@ -121,12 +119,13 @@ then exit 1 fi -read repo \ +# shellcheck disable=SC2034 +read -r repo \ latest_released_tag \ latest_snapshot_tag \ changed_files \ docker_images \ - <<< $( grep $specified_repo $release_data_file | tr ',' ' ' ) + <<< "$(grep "$specified_repo" "$release_data_file" | tr ',' ' ' )" if [ ! "$repo" = "$specified_repo" ] then @@ -138,7 +137,7 @@ next_release_version=${latest_snapshot_tag%-*} while true do - read -p "have you run 'stage_release' on the '$repo' repo? " yes_no + read -r -p "have you run 'stage_release' on the '$repo' repo? " yes_no case $yes_no in [Yy]* ) break ;; @@ -153,10 +152,16 @@ done if [ "$docker_images" != "" ] then - saved_current_dir=`pwd` - cd $repo_location/$repo - mkdock.sh `echo "$docker_images" | tr ':' " "` - cd $saved_current_dir + saved_current_dir=$(pwd) + cd "$repo_location/$repo" || exit 1 + # shellcheck disable=SC2046 + if ! mkdock.sh $(echo "$docker_images" | sed -e "s/'//g" -e "s/:/ /g") + then + echo "generation of docker image release container yaml file failed" + cd "$saved_current_dir" || exit 1 + exit 1 + fi + cd "$saved_current_dir" || exit 1 else echo "repo '$repo' does not have any docker images" exit 1 @@ -165,9 +170,9 @@ fi echo "generating commit for $repo docker image release: $latest_released_tag-->$next_release_version . . ." generateCommit.sh \ - -l $repo_location \ - -r $repo \ - -i $issue_id \ + -l "$repo_location" \ + -r "$repo" \ + -i "$issue_id" \ -e "Release docker images for $repo: $next_release_version" \ -m "This commit releases docker images for repo $repo." diff --git a/integration/src/release_scripts/updateOomImages.sh b/integration/src/release_scripts/updateOomImages.sh index e5a7d39c..ad337a8c 100755 --- a/integration/src/release_scripts/updateOomImages.sh +++ b/integration/src/release_scripts/updateOomImages.sh @@ -22,7 +22,7 @@ set -e -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") repo_location="./" release_data_file="./pf_release_data.csv" @@ -137,11 +137,13 @@ fi for specified_repo in "${pf_repos[@]}" do - read repo \ + # shellcheck disable=SC2034 + # shellcheck disable=SC2046 + read -r repo \ latest_released_tag \ latest_snapshot_tag \ changed_files docker_images \ - <<< $( grep $specified_repo $release_data_file | tr ',' ' ' ) + <<< $(grep "$specified_repo" "$release_data_file" | tr ',' ' ' ) if [ ! "$repo" = "$specified_repo" ] then @@ -154,12 +156,12 @@ do continue fi - for docker_image in `echo $docker_images | tr ':' ' '` + for docker_image in $(echo "$docker_images" | tr ':' ' ') do new_image="$docker_image:$latest_released_tag" echo "updating OOM image $new_image . . ." - find $repo_location/oom/kubernetes/policy/components \ + find "$repo_location/oom/kubernetes/policy/components" \ -name values.yaml \ -exec \ $SED -i \ @@ -172,9 +174,9 @@ done echo "generating OOM commit to update policy framework docker image versions . . ." generateCommit.sh \ - -l $repo_location \ + -l "$repo_location" \ -r oom \ - -i $issue_id \ + -i "$issue_id" \ -e "[POLICY] Update docker images to latest versions" \ -m "The image versions in policy values.yaml files have been updated" diff --git a/integration/src/release_scripts/updateParentRef.sh b/integration/src/release_scripts/updateParentRef.sh index 0f10cfbb..0f72aa53 100755 --- a/integration/src/release_scripts/updateParentRef.sh +++ b/integration/src/release_scripts/updateParentRef.sh @@ -22,7 +22,7 @@ set -e -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") # Use the bash internal OSTYPE variable to check for MacOS if [[ "$OSTYPE" == "darwin"* ]] @@ -107,22 +107,24 @@ then exit 1 fi -pom_lines=`wc -l $pom_file | $SED 's/^[ \t]*//' | cut -f1 -d' '` -parent_start_line=`grep -n '^[\t ]*<parent>[\t ]*$' $pom_file | cut -f1 -d':'` -parent_end_line=`grep -n '^[\t ]*</parent>[\t ]*$' $pom_file | cut -f1 -d':'` +pom_lines=$(wc -l "$pom_file" | $SED 's/^[ \t]*//' | cut -f1 -d' ') +parent_start_line=$(grep -n '^[\t ]*<parent>[\t ]*$' "$pom_file" | cut -f1 -d':') +parent_end_line=$(grep -n '^[\t ]*</parent>[\t ]*$' "$pom_file" | cut -f1 -d':') pom_head_lines=$((parent_start_line-1)) pom_tail_lines=$((pom_lines-parent_end_line)) pom_temp_file=$(mktemp) -head -$pom_head_lines $pom_file > $pom_temp_file -echo " <parent>" >> $pom_temp_file -echo " <groupId>$group_id</groupId>" >> $pom_temp_file -echo " <artifactId>$artifact_id</artifactId>" >> $pom_temp_file -echo " <version>$version</version>" >> $pom_temp_file -echo " <relativePath />" >> $pom_temp_file -echo " </parent>" >> $pom_temp_file -tail -$pom_tail_lines $pom_file >> $pom_temp_file - -mv $pom_temp_file $pom_file +{ + head -$pom_head_lines "$pom_file" + echo " <parent>" + echo " <groupId>$group_id</groupId>" + echo " <artifactId>$artifact_id</artifactId>" + echo " <version>$version</version>" + echo " <relativePath />" + echo " </parent>" + tail -$pom_tail_lines "$pom_file" +} > "$pom_temp_file" + +mv "$pom_temp_file" "$pom_file" diff --git a/integration/src/release_scripts/updateRefs.sh b/integration/src/release_scripts/updateRefs.sh index ea677487..01ea31a0 100755 --- a/integration/src/release_scripts/updateRefs.sh +++ b/integration/src/release_scripts/updateRefs.sh @@ -22,7 +22,7 @@ set -e -SCRIPT_NAME=`basename $0` +SCRIPT_NAME=$(basename "$0") repo_location="./" release_data_file="./pf_release_data.csv" @@ -150,47 +150,59 @@ then exit 1 fi -read parent_repo \ +# shellcheck disable=SC2034 +# shellcheck disable=SC2046 +read -r parent_repo \ parent_latest_released_tag \ parent_latest_snapshot_tag \ parent_changed_files \ parent_docker_images \ - <<< $( grep policy/parent $release_data_file | tr ',' ' ' ) + <<< $(grep policy/parent "$release_data_file" | tr ',' ' ' ) -read common_repo \ +# shellcheck disable=SC2034 +# shellcheck disable=SC2046 +read -r common_repo \ common_latest_released_tag \ common_latest_snapshot_tag \ common_changed_files \ common_docker_images \ - <<< $( grep policy/common $release_data_file | tr ',' ' ' ) + <<< $(grep policy/common "$release_data_file" | tr ',' ' ' ) -read docker_repo \ +# shellcheck disable=SC2034 +# shellcheck disable=SC2046 +read -r docker_repo \ docker_latest_released_tag \ docker_latest_snapshot_tag \ docker_changed_files \ docker_docker_images \ - <<< $( grep policy/docker $release_data_file | tr ',' ' ' ) + <<< $(grep policy/docker "$release_data_file" | tr ',' ' ' ) -read models_repo \ +# shellcheck disable=SC2034 +# shellcheck disable=SC2046 +read -r models_repo \ models_latest_released_tag \ models_latest_snapshot_tag \ models_changed_files \ models_docker_images \ - <<< $( grep policy/models $release_data_file | tr ',' ' ' ) + <<< $(grep policy/models "$release_data_file" | tr ',' ' ' ) -read drools_pdp_repo \ +# shellcheck disable=SC2034 +# shellcheck disable=SC2046 +read -r drools_pdp_repo \ drools_pdp_latest_released_tag \ drools_pdp_latest_snapshot_tag \ drools_pdp_changed_files \ drools_pdp_docker_images \ - <<< $( grep policy/drools-pdp $release_data_file | tr ',' ' ' ) + <<< $(grep policy/drools-pdp "$release_data_file" | tr ',' ' ' ) -read target_repo \ +# shellcheck disable=SC2034 +# shellcheck disable=SC2046 +read -r target_repo \ target_latest_released_tag \ target_latest_snapshot_tag \ target_changed_files \ target_docker_images \ - <<< $( grep $specified_repo $release_data_file | tr ',' ' ' ) + <<< $(grep "$specified_repo" "$release_data_file" | tr ',' ' ' ) if [ -z "$target_repo" ] then @@ -210,45 +222,52 @@ then then if [ "$update_snapshot" = true ] then - echo updating policy parent reference to $parent_latest_snapshot_tag on $repo_location/$target_repo . . . + major_version=$(echo "$parent_latest_released_tag" | $SED -E 's/^([0-9]*)\.[0-9]*\.[0-9]*$/\1/') + minor_version=$(echo "$parent_latest_released_tag" | $SED -E 's/^[0-9]*\.([0-9]*)\.[0-9]*$/\1/') + patch_version=$(echo "$parent_latest_released_tag" | $SED -E 's/^[0-9]*\.[0-9]*\.([0-9]*)$/\1/') + new_patch_version=$(("$patch_version"+1)) + + new_snapshot_tag="$major_version"."$minor_version"."$new_patch_version"-SNAPSHOT + + echo updating policy parent reference to "$new_snapshot_tag" on "$repo_location/$target_repo" . . . $SED -i \ - "s/<version.parent.resources>.*<\/version.parent.resources>/<version.parent.resources>$parent_latest_snapshot_tag<\/version.parent.resources>/" \ - $repo_location/policy/parent/integration/pom.xml + "s/<version.parent.resources>.*<\/version.parent.resources>/<version.parent.resources>$new_snapshot_tag<\/version.parent.resources>/" \ + "$repo_location/policy/parent/integration/pom.xml" result_code=$? else next_release_version=${parent_latest_snapshot_tag%-*} - echo updating policy parent reference to $next_release_version on $repo_location/$target_repo . . . + echo "updating policy parent reference to $next_release_version on $repo_location/$target_repo . . ." $SED -i \ "s/<version.parent.resources>.*<\/version.parent.resources>/<version.parent.resources>$next_release_version<\/version.parent.resources>/" \ - $repo_location/policy/parent/integration/pom.xml + "$repo_location/policy/parent/integration/pom.xml" result_code=$? fi else if [ "$update_snapshot" = true ] then - echo updating policy parent reference to $parent_latest_snapshot_tag on $repo_location/$target_repo . . . + echo "updating policy parent reference to $parent_latest_snapshot_tag on $repo_location/$target_repo . . ." updateParentRef.sh \ - -f $repo_location/$target_repo/pom.xml \ + -f "$repo_location/$target_repo/pom.xml" \ -g org.onap.policy.parent \ -a integration \ - -v $parent_latest_snapshot_tag + -v "$parent_latest_snapshot_tag" result_code=$? else - echo updating policy parent reference to $parent_latest_released_tag on $repo_location/$target_repo . . . + echo "updating policy parent reference to $parent_latest_released_tag on $repo_location/$target_repo . . ." updateParentRef.sh \ - -f $repo_location/$target_repo/pom.xml \ + -f "$repo_location/$target_repo/pom.xml" \ -g org.onap.policy.parent \ -a integration \ - -v $parent_latest_released_tag + -v "$parent_latest_released_tag" result_code=$? fi fi if [[ "$result_code" -eq 0 ]] then - echo policy parent reference updated on $repo_location/$target_repo + echo "policy parent reference updated on $repo_location/$target_repo" else - echo policy parent reference update failed on $repo_location/$target_repo + echo "policy parent reference update failed on $repo_location/$target_repo" exit 1 fi fi @@ -257,25 +276,25 @@ if [ "$update_common" = true ] then if [ "$update_snapshot" = true ] then - echo updating policy common reference to $common_latest_snapshot_tag on $repo_location/$target_repo . . . + echo "updating policy common reference to $common_latest_snapshot_tag on $repo_location/$target_repo . . ." $SED -i \ -e "s/<policy.common.version>.*<\/policy.common.version>/<policy.common.version>$common_latest_snapshot_tag<\/policy.common.version>/" \ -e "s/<version.policy.common>.*<\/version.policy.common>/<version.policy.common>$common_latest_snapshot_tag<\/version.policy.common>/" \ - $repo_location/$target_repo/pom.xml + "$repo_location/$target_repo/pom.xml" result_code=$? else - echo updating policy common reference to $common_latest_released_tag on $repo_location/$target_repo . . . + echo "updating policy common reference to $common_latest_released_tag on $repo_location/$target_repo . . ." $SED -i \ -e "s/<policy.common.version>.*<\/policy.common.version>/<policy.common.version>$common_latest_released_tag<\/policy.common.version>/" \ -e "s/<version.policy.common>.*<\/version.policy.common>/<version.policy.common>$common_latest_released_tag<\/version.policy.common>/" \ - $repo_location/$target_repo/pom.xml + "$repo_location/$target_repo/pom.xml" result_code=$? fi if [[ "$result_code" -eq 0 ]] then - echo policy common reference updated on $repo_location/$target_repo + echo "policy common reference updated on $repo_location/$target_repo" else - echo policy common reference update failed on $repo_location/$target_repo + echo "policy common reference update failed on $repo_location/$target_repo" exit 1 fi fi @@ -284,25 +303,25 @@ if [ "$update_models" = true ] then if [ "$update_snapshot" = true ] then - echo updating policy models reference to $models_latest_snapshot_tag on $repo_location/$target_repo . . . + echo "updating policy models reference to $models_latest_snapshot_tag on $repo_location/$target_repo . . ." $SED -i \ -e "s/<policy.models.version>.*<\/policy.models.version>/<policy.models.version>$models_latest_snapshot_tag<\/policy.models.version>/" \ -e "s/<version.policy.models>.*<\/version.policy.models>/<version.policy.models>$models_latest_snapshot_tag<\/version.policy.models>/" \ - $repo_location/$target_repo/pom.xml + "$repo_location/$target_repo/pom.xml" result_code=$? else - echo updating policy models reference to $models_latest_released_tag on $repo_location/$target_repo . . . + echo "updating policy models reference to $models_latest_released_tag on $repo_location/$target_repo . . ." $SED -i \ -e "s/<policy.models.version>.*<\/policy.models.version>/<policy.models.version>$models_latest_released_tag<\/policy.models.version>/" \ -e "s/<version.policy.models>.*<\/version.policy.models>/<version.policy.models>$models_latest_released_tag<\/version.policy.models>/" \ - $repo_location/$target_repo/pom.xml + "$repo_location/$target_repo/pom.xml" result_code=$? fi if [[ "$result_code" -eq 0 ]] then - echo policy models reference updated on $repo_location/$target_repo + echo "policy models reference updated on $repo_location/$target_repo" else - echo policy models reference update failed on $repo_location/$target_repo + echo "policy models reference update failed on $repo_location/$target_repo" exit 1 fi fi @@ -311,41 +330,41 @@ if [ "$update_drools_pdp" = true ] then if [ "$update_snapshot" = true ] then - echo updating policy drools-pdp reference to $drools_pdp_latest_snapshot_tag on $repo_location/$target_repo . . . + echo "updating policy drools-pdp reference to $drools_pdp_latest_snapshot_tag on $repo_location/$target_repo . . ." $SED -i \ -e "s/<policy.drools-pdp.version>.*<\/policy.drools-pdp.version>/<policy.drools-pdp.version>$drools_pdp_latest_snapshot_tag<\/policy.drools-pdp.version>/" \ -e "s/<version.policy.drools-pdp>.*<\/version.policy.drools-pdp>/<version.policy.drools-pdp>$drools_pdp_latest_snapshot_tag<\/version.policy.drools-pdp>/" \ - $repo_location/$target_repo/pom.xml + "$repo_location/$target_repo/pom.xml" result_code=$? else - echo updating policy drools-pdp reference to $drools_pdp_latest_released_tag on $repo_location/$target_repo . . . + echo "updating policy drools-pdp reference to $drools_pdp_latest_released_tag on $repo_location/$target_repo . . ." $SED -i \ -e "s/<policy.drools-pdp.version>.*<\/policy.drools-pdp.version>/<policy.drools-pdp.version>$drools_pdp_latest_released_tag<\/policy.drools-pdp.version>/" \ -e "s/<version.policy.drools-pdp>.*<\/version.policy.drools-pdp>/<version.policy.drools-pdp>$drools_pdp_latest_released_tag<\/version.policy.drools-pdp>/" \ - $repo_location/$target_repo/pom.xml + "$repo_location/$target_repo/pom.xml" result_code=$? fi if [[ "$result_code" -eq 0 ]] then - echo policy drools-pdp reference updated on $repo_location/$target_repo + echo "policy drools-pdp reference updated on $repo_location/$target_repo" else - echo policy drools-pdp reference update failed on $repo_location/$target_repo + echo "policy drools-pdp reference update failed on $repo_location/$target_repo" exit 1 fi fi if [ "$update_docker" = true ] && [ "$target_docker_images" != "" ] then - echo updating docker base images to version $docker_latest_released_tag on repo $repo_location/$target_repo - find $repo_location/$target_repo \ + echo "updating docker base images to version $docker_latest_released_tag on repo $repo_location/$target_repo . . ." + find "$repo_location/$target_repo" \ -name '*Docker*' \ -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)2.3.1$/\1$docker_latest_released_tag/" {} \; result_code=$? if [[ "$result_code" -eq 0 ]] then - echo docker base images updated on $repo_location/$target_repo + echo "docker base images updated on $repo_location/$target_repo" else - echo docker base images update failed on $repo_location/$target_repo + echo "docker base images update failed on $repo_location/$target_repo" exit 1 fi fi |