update release scripts for gui apex dependency 00/128100/1
authorliamfallon <liam.fallon@est.tech>
Wed, 16 Mar 2022 14:27:21 +0000 (14:27 +0000)
committerliamfallon <liam.fallon@est.tech>
Wed, 16 Mar 2022 14:27:25 +0000 (14:27 +0000)
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 <liam.fallon@est.tech>
integration/src/release_scripts/bumpSnapshots.sh
integration/src/release_scripts/generateCommit.sh
integration/src/release_scripts/releasePhase.sh
integration/src/release_scripts/updateRefs.sh

index d7d22df..c67e81f 100755 (executable)
@@ -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
index 29e600a..a62cf49 100755 (executable)
@@ -20,8 +20,6 @@
 # ============LICENSE_END==================================================
 #
 
-set -e
-
 SCRIPT_NAME=$(basename "$0")
 repo_location="./"
 
index b3f7e0a..920998d 100755 (executable)
@@ -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
index 01ea31a..0f253f9 100755 (executable)
@@ -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>.*<\/policy.apex-pdp.version>/<policy.apex-pdp.version>$apex_pdp_latest_snapshot_tag<\/policy.apex-pdp.version>/" \
+            -e "s/<version.policy.apex-pdp>.*<\/version.policy.apex-pdp>/<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>.*<\/policy.apex-pdp.version>/<policy.apex-pdp.version>$apex_pdp_latest_released_tag<\/policy.apex-pdp.version>/" \
+            -e "s/<version.policy.apex-pdp>.*<\/version.policy.apex-pdp>/<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