From 4d071bf628a11c0c5148eed7462c4bdf8443cb3b Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 16 Mar 2022 14:27:21 +0000 Subject: update release scripts for gui apex dependency policy-gui nas a dependency on apex-pdp that was missed in the earlier versions of the release scripts. Issue-ID: POLICY-3982 Change-Id: Ic729e2a315c7035e47a62255a375058a536ecf9a Signed-off-by: liamfallon --- integration/src/release_scripts/bumpSnapshots.sh | 2 +- integration/src/release_scripts/generateCommit.sh | 2 - integration/src/release_scripts/releasePhase.sh | 33 ++++++++-------- integration/src/release_scripts/updateRefs.sh | 47 ++++++++++++++++++++++- 4 files changed, 63 insertions(+), 21 deletions(-) diff --git a/integration/src/release_scripts/bumpSnapshots.sh b/integration/src/release_scripts/bumpSnapshots.sh index d7d22df7..c67e81ff 100755 --- a/integration/src/release_scripts/bumpSnapshots.sh +++ b/integration/src/release_scripts/bumpSnapshots.sh @@ -178,7 +178,7 @@ do mv "$temp_file" "$repo_location/$repo/version.properties" fi - updateRefs.sh -pcmos -d "$release_data_file" -l "$repo_location" -r "$repo" + updateRefs.sh -pcmoxs -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 ] then diff --git a/integration/src/release_scripts/generateCommit.sh b/integration/src/release_scripts/generateCommit.sh index 29e600a2..a62cf493 100755 --- a/integration/src/release_scripts/generateCommit.sh +++ b/integration/src/release_scripts/generateCommit.sh @@ -20,8 +20,6 @@ # ============LICENSE_END================================================== # -set -e - SCRIPT_NAME=$(basename "$0") repo_location="./" diff --git a/integration/src/release_scripts/releasePhase.sh b/integration/src/release_scripts/releasePhase.sh index b3f7e0af..920998db 100755 --- a/integration/src/release_scripts/releasePhase.sh +++ b/integration/src/release_scripts/releasePhase.sh @@ -243,11 +243,6 @@ release_phase_7() { -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" \ @@ -288,12 +283,6 @@ release_phase_7() { -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" \ @@ -316,7 +305,6 @@ release_phase_8() { 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" @@ -329,14 +317,13 @@ release_phase_9() { 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 . . ." + echo "Updating snapshots for repos, updating references on policy/drools-applications, policy/gui . . ." bumpSnapshots.sh \ -d "$release_data_file" \ -l "$repo_location" \ @@ -346,33 +333,47 @@ release_phase_10() { -d "$release_data_file" \ -l "$repo_location" \ -r "policy/drools-applications" + updateRefs.sh \ + -pcmxk \ + -d "$release_data_file" \ + -l "$repo_location" \ + -r "policy/gui" 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" + 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" + echo "Updated snapshots for repos, updated references on policy/drools-applications, policy/gui" } 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" + releaseRepo.sh -d "$release_data_file" -l "$repo_location" -r policy/gui -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" + releaseRepoImages.sh -d "$release_data_file" -l "$repo_location" -r policy/gui -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 . . ." + echo "Updating snapshots on policy/drools-applications, policy/gui . . ." bumpSnapshots.sh \ -d "$release_data_file" \ -l "$repo_location" \ -i "$issue_id" + echo "Updated snapshots on policy/drools-applications, policy/gui" } case "$release_phase" in diff --git a/integration/src/release_scripts/updateRefs.sh b/integration/src/release_scripts/updateRefs.sh index 01ea31a0..0f253f97 100755 --- a/integration/src/release_scripts/updateRefs.sh +++ b/integration/src/release_scripts/updateRefs.sh @@ -52,6 +52,7 @@ usage() echo " -c - update policy/common references" echo " -m - update policy/model references" echo " -o - update policy/drools-pdp references" + echo " -x - update policy/apex-pdp references" echo " -k - update docker base images in Dockerfiles" echo " -s - update release references to snapshot references," echo " if omitted, snapshot references are updated to release references" @@ -71,10 +72,11 @@ update_parent=false update_common=false update_models=false update_drools_pdp=false +update_apex_pdp=false update_snapshot=false update_docker=false -while getopts "hd:l:r:pcmoks" opt +while getopts "hd:l:r:pcmoxks" opt do case $opt in h) @@ -101,6 +103,9 @@ do o) update_drools_pdp=true ;; + x) + update_apex_pdp=true + ;; k) update_docker=true ;; @@ -195,6 +200,15 @@ read -r drools_pdp_repo \ drools_pdp_docker_images \ <<< $(grep policy/drools-pdp "$release_data_file" | tr ',' ' ' ) +# shellcheck disable=SC2034 +# shellcheck disable=SC2046 +read -r apex_pdp_repo \ + apex_pdp_latest_released_tag \ + apex_pdp_latest_snapshot_tag \ + apex_pdp_changed_files \ + apex_pdp_docker_images \ + <<< $(grep policy/apex-pdp "$release_data_file" | tr ',' ' ' ) + # shellcheck disable=SC2034 # shellcheck disable=SC2046 read -r target_repo \ @@ -353,12 +367,41 @@ then fi fi +if [ "$update_apex_pdp" = true ] +then + if [ "$update_snapshot" = true ] + then + echo "updating policy apex-pdp reference to $apex_pdp_latest_snapshot_tag on $repo_location/$target_repo . . ." + $SED -i \ + -e "s/.*<\/policy.apex-pdp.version>/$apex_pdp_latest_snapshot_tag<\/policy.apex-pdp.version>/" \ + -e "s/.*<\/version.policy.apex-pdp>/$apex_pdp_latest_snapshot_tag<\/version.policy.apex-pdp>/" \ + "$repo_location/$target_repo/pom.xml" + result_code=$? + else + echo "updating policy apex-pdp reference to $apex_pdp_latest_released_tag on $repo_location/$target_repo . . ." + $SED -i \ + -e "s/.*<\/policy.apex-pdp.version>/$apex_pdp_latest_released_tag<\/policy.apex-pdp.version>/" \ + -e "s/.*<\/version.policy.apex-pdp>/$apex_pdp_latest_released_tag<\/version.policy.apex-pdp>/" \ + "$repo_location/$target_repo/pom.xml" + result_code=$? + fi + if [[ "$result_code" -eq 0 ]] + then + echo "policy apex-pdp reference updated on $repo_location/$target_repo" + else + echo "policy apex-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" \ + -name '*Docker*' 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/" {} \; + -exec $SED -r -i "s/^(FROM onap\/policy-j[d|r][k|e]-alpine:)[0-9]*.[0-9]*.[0-9]*$/\1$docker_latest_released_tag/" {} \; result_code=$? if [[ "$result_code" -eq 0 ]] then -- cgit 1.2.3-korg