summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2021-12-16 12:56:37 +0000
committerliamfallon <liam.fallon@est.tech>2022-01-06 11:27:22 +0000
commit81c2c515c4c92cb77d7bc31eb2f2771ca2063216 (patch)
treeded78462b4a59aaa2d7503ce414a95a00bac0bf0
parent1daae3e877d5446c7ec5dac4ca5f28ca1637e393 (diff)
Release scripts for repos, images, OOM, refs
bumpSnapshots.sh: Steps the patch version of snapshot images based on the data in the policy release data file. generateCommit.sh: At the suggestion of OOM, the order of the generated messages is changed. releaseRepo.sh: Generates the release yaml file and the commit to release the maven artifacts of a repo releaseRepoImages.sh: Generates the release yaml fole and the commit to release the docker images from a repo updateOomImages.sh: Generates a commit that updats the references to Policy Framework docker images in OOM updateRefs.sh: Updates the parent. common, models., drools-pdp, and Docker base images in Docker files for reselases or snapshots. Issue-ID: POLICY-3835 Change-Id: I0766a779c2217a57a33ed37725f11acdfb07a16d Signed-off-by: liamfallon <liam.fallon@est.tech>
-rwxr-xr-xintegration/src/release_scripts/bumpSnapshots.sh188
-rwxr-xr-xintegration/src/release_scripts/generateCommit.sh8
-rwxr-xr-xintegration/src/release_scripts/getReleaseData.sh4
-rwxr-xr-xintegration/src/release_scripts/mkart.sh3
-rwxr-xr-xintegration/src/release_scripts/mkdock.sh3
-rwxr-xr-xintegration/src/release_scripts/releaseRepo.sh172
-rwxr-xr-xintegration/src/release_scripts/releaseRepoImages.sh174
-rwxr-xr-xintegration/src/release_scripts/updateOomImages.sh174
-rwxr-xr-xintegration/src/release_scripts/updateParentRef.sh4
-rwxr-xr-xintegration/src/release_scripts/updateRefs.sh344
10 files changed, 1069 insertions, 5 deletions
diff --git a/integration/src/release_scripts/bumpSnapshots.sh b/integration/src/release_scripts/bumpSnapshots.sh
new file mode 100755
index 00000000..f8317e2a
--- /dev/null
+++ b/integration/src/release_scripts/bumpSnapshots.sh
@@ -0,0 +1,188 @@
+#!/bin/bash
+
+#
+# ============LICENSE_START================================================
+# ONAP
+# =========================================================================
+# Copyright (C) 2021-2022 Nordix Foundation.
+# =========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END==================================================
+#
+
+set -e
+
+SCRIPT_NAME=`basename $0`
+repo_location="./"
+release_data_file="./pf_release_data.csv"
+
+declare -a pf_repos=(
+ "policy/parent"
+ "policy/docker"
+ "policy/common"
+ "policy/models"
+ "policy/api"
+ "policy/pap"
+ "policy/drools-pdp"
+ "policy/apex-pdp"
+ "policy/xacml-pdp"
+ "policy/distribution"
+ "policy/gui"
+ "policy/clamp"
+ "policy/drools-applications"
+)
+
+usage()
+{
+ echo ""
+ echo "$SCRIPT_NAME - generate commits to bump the snapshot version and update references to snapshot references"
+ echo " on any repos that need to be bumped or updated"
+ echo ""
+ echo " usage: $SCRIPT_NAME [-options]"
+ echo ""
+ echo " options"
+ echo " -h - this help message"
+ echo " -d data_file - the policy release data file to use, defaults to '$release_data_file'"
+ echo " -l location - the location of the policy framework repos on the file system,"
+ echo " defaults to '$repo_location'"
+ echo " -i issue-id - issue ID in the format POLICY-nnnn"
+ echo ""
+ echo " examples:"
+ echo " $SCRIPT_NAME -l /home/user/onap -d /home/user/data/pf_release_data.csv -i POLICY-1234"
+ echo " bump snapshots on the repos at location '/home/user/onap' using the release data"
+ echo " in the file '/home/user/data/pf_release_data.csv'"
+ exit 255;
+}
+
+while getopts "hd:l:i:" opt
+do
+ case $opt in
+ h)
+ usage
+ ;;
+ d)
+ release_data_file=$OPTARG
+ ;;
+ l)
+ repo_location=$OPTARG
+ ;;
+ i)
+ issue_id=$OPTARG
+ ;;
+ \?)
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+if [ $OPTIND -eq 1 ]
+then
+ echo "no arguments were specified"
+ usage
+fi
+
+if [[ -z "$repo_location" ]]
+then
+ echo "policy repo location not specified on -l flag"
+ exit 1
+fi
+
+if ! [ -d "$repo_location" ]
+then
+ echo "policy repo location '$repo_location' not found"
+ exit 1
+fi
+
+if [[ -z "$release_data_file" ]]
+then
+ echo "policy release data file not specified on -d flag"
+ exit 1
+fi
+
+if ! [ -f "$release_data_file" ]
+then
+ echo "policy release data file '$release_data_file' not found"
+ exit 1
+fi
+
+if [ -z "$issue_id" ]
+then
+ echo "issue_id not specified on -i flag"
+ exit 1
+fi
+
+if ! echo "$issue_id" | grep -Eq '^POLICY-[0-9]*$'
+then
+ echo "issue ID is invalid, it should be of form 'POLICY-nnnn'"
+ exit 1
+fi
+
+for specified_repo in "${pf_repos[@]}"
+do
+ read repo \
+ latest_released_tag \
+ latest_snapshot_tag \
+ changed_files docker_images \
+ <<< $( grep $specified_repo $release_data_file | tr ',' ' ' )
+
+ if [ ! "$repo" = "$specified_repo" ]
+ then
+ echo "repo '$specified_repo' not found in file 'pf_release_data.csv'"
+ continue
+ fi
+
+ next_release_version=${latest_snapshot_tag%-*}
+
+ 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))
+
+ 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 \
+ 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
+ fi
+
+ updateRefs.sh -pcmos -d $release_data_file -l $repo_location -r $repo
+ git -C $repo_location/$specified_repo status | grep '^[ \t]*modified:[ \t]*pom.xml' > /dev/null 2>&1
+ references_updated=$?
+
+ if [ "$latest_released_tag" != "$next_release_version" ] && [ $references_updated -eq 0 ]
+ then
+ continue
+ fi
+
+ echo "generating commit to update snapshot version and/or references of repo $repo . . ."
+
+ generateCommit.sh \
+ -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"
+
+ echo "commit to update snapshot version and/or references of repo $repo generated"
+done
+
diff --git a/integration/src/release_scripts/generateCommit.sh b/integration/src/release_scripts/generateCommit.sh
index 32775927..8c21c308 100755
--- a/integration/src/release_scripts/generateCommit.sh
+++ b/integration/src/release_scripts/generateCommit.sh
@@ -4,7 +4,7 @@
# ============LICENSE_START================================================
# ONAP
# =========================================================================
-# Copyright (C) 2021 Nordix Foundation.
+# Copyright (C) 2021-2022 Nordix Foundation.
# =========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,6 +20,8 @@
# ============LICENSE_END==================================================
#
+set -e
+
SCRIPT_NAME=`basename $0`
repo_location="./"
@@ -137,10 +139,10 @@ then
commit_msg_temp_file=$(mktemp)
echo "$commit_header" > $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 "$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 .
diff --git a/integration/src/release_scripts/getReleaseData.sh b/integration/src/release_scripts/getReleaseData.sh
index 19a41ea8..6eefdd14 100755
--- a/integration/src/release_scripts/getReleaseData.sh
+++ b/integration/src/release_scripts/getReleaseData.sh
@@ -4,7 +4,7 @@
# ============LICENSE_START================================================
# ONAP
# =========================================================================
-# Copyright (C) 2021 Nordix Foundation.
+# Copyright (C) 2021-2022 Nordix Foundation.
# =========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,6 +20,8 @@
# ============LICENSE_END==================================================
#
+set -e
+
SCRIPT_NAME=`basename $0`
repo_location="./"
release_data_file="./pf_release_data.csv"
diff --git a/integration/src/release_scripts/mkart.sh b/integration/src/release_scripts/mkart.sh
index ed278527..48a368ec 100755
--- a/integration/src/release_scripts/mkart.sh
+++ b/integration/src/release_scripts/mkart.sh
@@ -5,6 +5,7 @@
# ONAP
# =========================================================================
# Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 2022 Nordix Foundation.
# =========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -35,6 +36,8 @@
# can get through the firewall.
#
+set -e
+
has_docker_images=false
if [ "$1" == "-d" ]
diff --git a/integration/src/release_scripts/mkdock.sh b/integration/src/release_scripts/mkdock.sh
index cd34fd1a..dfbee9f8 100755
--- a/integration/src/release_scripts/mkdock.sh
+++ b/integration/src/release_scripts/mkdock.sh
@@ -5,6 +5,7 @@
# ONAP
# =========================================================================
# Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+# Modifications Copyright (C) 2022 Nordix Foundation.
# =========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -36,6 +37,8 @@
# can get through the firewall.
#
+set -e
+
if [ $# -lt 1 -o "$1" = "-?" ]
then
echo "arg(s): docker-container-name1 docker-container-name2 ..." >&2
diff --git a/integration/src/release_scripts/releaseRepo.sh b/integration/src/release_scripts/releaseRepo.sh
new file mode 100755
index 00000000..c2aa95a4
--- /dev/null
+++ b/integration/src/release_scripts/releaseRepo.sh
@@ -0,0 +1,172 @@
+#!/bin/bash
+
+#
+# ============LICENSE_START================================================
+# ONAP
+# =========================================================================
+# Copyright (C) 2021-2022 Nordix Foundation.
+# =========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END==================================================
+#
+
+set -e
+
+SCRIPT_NAME=`basename $0`
+repo_location="./"
+release_data_file="./pf_release_data.csv"
+
+usage()
+{
+ echo ""
+ echo "$SCRIPT_NAME - release the specified repository by generating the release yaml file and the release commit"
+ echo ""
+ echo " usage: $SCRIPT_NAME [-options]"
+ echo ""
+ echo " options"
+ echo " -h - this help message"
+ echo " -d data_file - the policy release data file to use, defaults to '$release_data_file'"
+ echo " -l location - the location of the policy framework repos on the file system,"
+ echo " defaults to '$repo_location'"
+ echo " -r repo - the policy repo to release"
+ echo " -i issue-id - issue ID in the format POLICY-nnnn"
+ echo ""
+ echo " examples:"
+ echo " $SCRIPT_NAME -l /home/user/onap -d /home/user/data/pf_release_data.csv -r policy/common -i POLICY-1234"
+ echo " release the 'policy/common' repo at location '/home/user/onap' using the release data"
+ echo " in the file '/home/user/data/pf_release_data.csv'"
+ exit 255;
+}
+
+while getopts "hd:l:r:i:" opt
+do
+ case $opt in
+ h)
+ usage
+ ;;
+ d)
+ release_data_file=$OPTARG
+ ;;
+ l)
+ repo_location=$OPTARG
+ ;;
+ r)
+ specified_repo=$OPTARG
+ ;;
+ i)
+ issue_id=$OPTARG
+ ;;
+ \?)
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+if [ $OPTIND -eq 1 ]
+then
+ echo "no arguments were specified"
+ usage
+fi
+
+if [[ -z "$repo_location" ]]
+then
+ echo "policy repo location not specified on -l flag"
+ exit 1
+fi
+
+if ! [ -d "$repo_location" ]
+then
+ echo "policy repo location '$repo_location' not found"
+ exit 1
+fi
+
+if [[ -z "$release_data_file" ]]
+then
+ echo "policy release data file not specified on -d flag"
+ exit 1
+fi
+
+if ! [ -f "$release_data_file" ]
+then
+ echo "policy release data file '$release_data_file' not found"
+ exit 1
+fi
+
+if [ -z "$specified_repo" ]
+then
+ echo "repo not specified on -r flag"
+ exit 1
+fi
+
+if [ -z "$issue_id" ]
+then
+ echo "issue_id not specified on -i flag"
+ exit 1
+fi
+
+if ! echo "$issue_id" | grep -Eq '^POLICY-[0-9]*$'
+then
+ echo "issue ID is invalid, it should be of form 'POLICY-nnnn'"
+ exit 1
+fi
+
+read repo \
+ latest_released_tag \
+ latest_snapshot_tag \
+ changed_files docker_images \
+ <<< $( grep $specified_repo $release_data_file | tr ',' ' ' )
+
+if [ ! "$repo" = "$specified_repo" ]
+then
+ echo "repo '$specified_repo' not found in file 'pf_release_data.csv'"
+ exit 1
+fi
+
+next_release_version=${latest_snapshot_tag%-*}
+
+while true
+do
+ read -p "have you run 'stage_release' on the '$repo' repo? " yes_no
+ case $yes_no in
+ [Yy]* ) break
+ ;;
+
+ [Nn]* ) exit
+ ;;
+
+ * ) echo "Please answer 'yes' or 'no'"
+ ;;
+ esac
+done
+
+saved_current_dir=`pwd`
+cd $repo_location/$repo
+if [ "$docker_images" != "" ]
+then
+ mkart.sh -d
+else
+ mkart.sh
+fi
+cd $saved_current_dir
+
+echo "generating commit for $repo release: $latest_released_tag-->$next_release_version . . ."
+
+generateCommit.sh \
+ -l $repo_location \
+ -r $repo \
+ -i $issue_id \
+ -e "Release $repo: $next_release_version" \
+ -m "This commit releases repo $repo."
+
+echo "commit for $repo release: $latest_released_tag-->$next_release_version generated"
diff --git a/integration/src/release_scripts/releaseRepoImages.sh b/integration/src/release_scripts/releaseRepoImages.sh
new file mode 100755
index 00000000..8dc59543
--- /dev/null
+++ b/integration/src/release_scripts/releaseRepoImages.sh
@@ -0,0 +1,174 @@
+#!/bin/bash
+
+#
+# ============LICENSE_START================================================
+# ONAP
+# =========================================================================
+# Copyright (C) 2021-2022 Nordix Foundation.
+# =========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END==================================================
+#
+
+set -e
+
+SCRIPT_NAME=`basename $0`
+repo_location="./"
+release_data_file="./pf_release_data.csv"
+
+usage()
+{
+ echo ""
+ echo "$SCRIPT_NAME - release the specified repository by generating the release yaml file and the release commit"
+ echo ""
+ echo " usage: $SCRIPT_NAME [-options]"
+ echo ""
+ echo " options"
+ echo " -h - this help message"
+ echo " -d data_file - the policy release data file to use, defaults to '$release_data_file'"
+ echo " -l location - the location of the policy framework repos on the file system,"
+ echo " defaults to '$repo_location'"
+ echo " -r repo - the policy repo to release"
+ echo " -i issue-id - issue ID in the format POLICY-nnnn"
+ echo ""
+ echo " examples:"
+ echo " $SCRIPT_NAME -l /home/user/onap -d /home/user/data/pf_release_data.csv -r policy/common -i POLICY-1234"
+ echo " release the 'policy/common' repo at location '/home/user/onap' using the release data"
+ echo " in the file '/home/user/data/pf_release_data.csv'"
+ exit 255;
+}
+
+while getopts "hd:l:r:i:" opt
+do
+ case $opt in
+ h)
+ usage
+ ;;
+ d)
+ release_data_file=$OPTARG
+ ;;
+ l)
+ repo_location=$OPTARG
+ ;;
+ r)
+ specified_repo=$OPTARG
+ ;;
+ i)
+ issue_id=$OPTARG
+ ;;
+ \?)
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+if [ $OPTIND -eq 1 ]
+then
+ echo "no arguments were specified"
+ usage
+fi
+
+if [[ -z "$repo_location" ]]
+then
+ echo "policy repo location not specified on -l flag"
+ exit 1
+fi
+
+if ! [ -d "$repo_location" ]
+then
+ echo "policy repo location '$repo_location' not found"
+ exit 1
+fi
+
+if [[ -z "$release_data_file" ]]
+then
+ echo "policy release data file not specified on -d flag"
+ exit 1
+fi
+
+if ! [ -f "$release_data_file" ]
+then
+ echo "policy release data file '$release_data_file' not found"
+ exit 1
+fi
+
+if [ -z "$specified_repo" ]
+then
+ echo "repo not specified on -r flag"
+ exit 1
+fi
+
+if [ -z "$issue_id" ]
+then
+ echo "issue_id not specified on -i flag"
+ exit 1
+fi
+
+if ! echo "$issue_id" | grep -Eq '^POLICY-[0-9]*$'
+then
+ echo "issue ID is invalid, it should be of form 'POLICY-nnnn'"
+ exit 1
+fi
+
+read repo \
+ latest_released_tag \
+ latest_snapshot_tag \
+ changed_files \
+ docker_images \
+ <<< $( grep $specified_repo $release_data_file | tr ',' ' ' )
+
+if [ ! "$repo" = "$specified_repo" ]
+then
+ echo "repo '$specified_repo' not found in file 'pf_release_data.csv'"
+ exit 1
+fi
+
+next_release_version=${latest_snapshot_tag%-*}
+
+while true
+do
+ read -p "have you run 'stage_release' on the '$repo' repo? " yes_no
+ case $yes_no in
+ [Yy]* ) break
+ ;;
+
+ [Nn]* ) exit
+ ;;
+
+ * ) echo "Please answer 'yes' or 'no'"
+ ;;
+ esac
+done
+
+if [ "$docker_images" != "" ]
+then
+ saved_current_dir=`pwd`
+ cd $repo_location/$repo
+ mkdock.sh `echo "$docker_images" | tr ':' " "`
+ cd $saved_current_dir
+else
+ echo "repo '$repo' does not have any docker images"
+ exit 1
+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 \
+ -e "Release docker images for $repo: $next_release_version" \
+ -m "This commit releases docker images for repo $repo."
+
+echo "commit for $repo docker image release: $latest_released_tag-->$next_release_version generated"
diff --git a/integration/src/release_scripts/updateOomImages.sh b/integration/src/release_scripts/updateOomImages.sh
new file mode 100755
index 00000000..df6f6781
--- /dev/null
+++ b/integration/src/release_scripts/updateOomImages.sh
@@ -0,0 +1,174 @@
+#!/bin/bash
+
+#
+# ============LICENSE_START================================================
+# ONAP
+# =========================================================================
+# Copyright (C) 2021-2022 Nordix Foundation.
+# =========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END==================================================
+#
+
+set -e
+
+SCRIPT_NAME=`basename $0`
+repo_location="./"
+release_data_file="./pf_release_data.csv"
+
+declare -a pf_repos=(
+ "policy/parent"
+ "policy/docker"
+ "policy/common"
+ "policy/models"
+ "policy/api"
+ "policy/pap"
+ "policy/drools-pdp"
+ "policy/apex-pdp"
+ "policy/xacml-pdp"
+ "policy/distribution"
+ "policy/gui"
+ "policy/clamp"
+ "policy/drools-applications"
+)
+
+usage()
+{
+ echo ""
+ echo "$SCRIPT_NAME - generate an OOM commit to update the versions of Policy Framework images in values.yaml files"
+ echo ""
+ echo " usage: $SCRIPT_NAME [-options]"
+ echo ""
+ echo " options"
+ echo " -h - this help message"
+ echo " -d data_file - the policy release data file to use, defaults to '$release_data_file'"
+ echo " -l location - the location of the OOM repo on the file system,"
+ echo " defaults to '$repo_location'"
+ echo " -i issue-id - issue ID in the format POLICY-nnnn"
+ echo ""
+ echo " examples:"
+ echo " $SCRIPT_NAME -l /home/user/onap -d /home/user/data/pf_release_data.csv -i POLICY-1234"
+ echo " update the version of policy framework images at location '/home/user/onap/oom' using the release data"
+ echo " in the file '/home/user/data/pf_release_data.csv'"
+ exit 255;
+}
+
+while getopts "hd:l:i:" opt
+do
+ case $opt in
+ h)
+ usage
+ ;;
+ d)
+ release_data_file=$OPTARG
+ ;;
+ l)
+ repo_location=$OPTARG
+ ;;
+ i)
+ issue_id=$OPTARG
+ ;;
+ \?)
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+if [ $OPTIND -eq 1 ]
+then
+ echo "no arguments were specified"
+ usage
+fi
+
+if [[ -z "$repo_location" ]]
+then
+ echo "OOM repo location not specified on -l flag"
+ exit 1
+fi
+
+if ! [ -d "$repo_location" ]
+then
+ echo "OOM repo location '$repo_location' not found"
+ exit 1
+fi
+
+if [[ -z "$release_data_file" ]]
+then
+ echo "policy release data file not specified on -d flag"
+ exit 1
+fi
+
+if ! [ -f "$release_data_file" ]
+then
+ echo "policy release data file '$release_data_file' not found"
+ exit 1
+fi
+
+if [ -z "$issue_id" ]
+then
+ echo "issue_id not specified on -i flag"
+ exit 1
+fi
+
+if ! echo "$issue_id" | grep -Eq '^POLICY-[0-9]*$'
+then
+ echo "issue ID is invalid, it should be of form 'POLICY-nnnn'"
+ exit 1
+fi
+
+for specified_repo in "${pf_repos[@]}"
+do
+ read repo \
+ latest_released_tag \
+ latest_snapshot_tag \
+ changed_files docker_images \
+ <<< $( grep $specified_repo $release_data_file | tr ',' ' ' )
+
+ if [ ! "$repo" = "$specified_repo" ]
+ then
+ echo "repo '$specified_repo' not found in file 'pf_release_data.csv'"
+ continue
+ fi
+
+ if [ "$docker_images" = "" ]
+ then
+ continue
+ fi
+
+ 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 \
+ -name values.yaml \
+ -exec \
+ sed -i '' \
+ "s/^image:[ |\t]*onap\/$docker_image:[0-9]*\.[0-9]*\.[0-9]*$/image: onap\/$new_image/" {} \;
+ echo "OOM image $docker_image:$latest_released_tag updated"
+ done
+done
+
+
+echo "generating OOM commit to update policy framework docker image versions . . ."
+
+generateCommit.sh \
+ -l $repo_location \
+ -r oom \
+ -i $issue_id \
+ -e "[POLICY] Update docker images to latest versions" \
+ -m "The image versions in policy values.yaml files have been updated"
+
+echo "OOM commit to update policy framework docker image versions generated"
+
diff --git a/integration/src/release_scripts/updateParentRef.sh b/integration/src/release_scripts/updateParentRef.sh
index 831d6c39..1978e33d 100755
--- a/integration/src/release_scripts/updateParentRef.sh
+++ b/integration/src/release_scripts/updateParentRef.sh
@@ -4,7 +4,7 @@
# ============LICENSE_START================================================
# ONAP
# =========================================================================
-# Copyright (C) 2021 Nordix Foundation.
+# Copyright (C) 2021-2022 Nordix Foundation.
# =========================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,6 +20,8 @@
# ============LICENSE_END==================================================
#
+set -e
+
SCRIPT_NAME=`basename $0`
usage()
diff --git a/integration/src/release_scripts/updateRefs.sh b/integration/src/release_scripts/updateRefs.sh
new file mode 100755
index 00000000..90b6750a
--- /dev/null
+++ b/integration/src/release_scripts/updateRefs.sh
@@ -0,0 +1,344 @@
+#!/bin/bash
+
+#
+# ============LICENSE_START================================================
+# ONAP
+# =========================================================================
+# Copyright (C) 2021-2022 Nordix Foundation.
+# =========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END==================================================
+#
+
+set -e
+
+SCRIPT_NAME=`basename $0`
+repo_location="./"
+release_data_file="./pf_release_data.csv"
+
+usage()
+{
+ echo ""
+ echo "$SCRIPT_NAME - updates the inter-repo references in Policy Framework POM files"
+ echo ""
+ echo " usage: $SCRIPT_NAME [-options]"
+ echo ""
+ echo " options"
+ echo " -h - this help message"
+ echo " -d data_file - the policy release data file to use, generated by the 'getReleaseData.sh' script,"
+ echo " defaults to '$release_data_file'"
+ echo " -l location - the location of the policy framework repos on the file system,"
+ echo " defaults to '$repo_location'"
+ echo " -r repo - the policy repo to update"
+ echo " -p - update policy/parent references"
+ echo " -c - update policy/common references"
+ echo " -m - update policy/model references"
+ echo " -o - update policy/drools-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"
+ echo ""
+ echo " examples:"
+ echo " $SCRIPT_NAME -pcm -r policy/pap"
+ echo " update the parent, common, and models references of policy/pap"
+ echo " to the current released version"
+ echo ""
+ echo " $SCRIPT_NAME -c -m -s -r policy/api"
+ echo " update the common and models references of policy/api"
+ echo " to the current snapshot version"
+ exit 255;
+}
+
+update_parent=false
+update_common=false
+update_models=false
+update_drools_pdp=false
+update_snapshot=false
+update_docker=false
+
+while getopts "hd:l:r:pcmoks" opt
+do
+ case $opt in
+ h)
+ usage
+ ;;
+ d)
+ release_data_file=$OPTARG
+ ;;
+ l)
+ repo_location=$OPTARG
+ ;;
+ r)
+ specified_repo=$OPTARG
+ ;;
+ p)
+ update_parent=true
+ ;;
+ c)
+ update_common=true
+ ;;
+ m)
+ update_models=true
+ ;;
+ o)
+ update_drools_pdp=true
+ ;;
+ k)
+ update_docker=true
+ ;;
+ s)
+ update_snapshot=true
+ ;;
+ \?)
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+if [ $OPTIND -eq 1 ]
+then
+ echo "no arguments were specified"
+ usage
+fi
+
+if [[ -z "$repo_location" ]]
+then
+ echo "policy repo location not specified on -l flag"
+ exit 1
+fi
+
+if ! [ -d "$repo_location" ]
+then
+ echo "policy repo location '$repo_location' not found"
+ exit 1
+fi
+
+if [[ -z "$release_data_file" ]]
+then
+ echo "policy release data file not specified on -d flag"
+ exit 1
+fi
+
+if ! [ -f "$release_data_file" ]
+then
+ echo "policy release data file '$release_data_file' not found"
+ exit 1
+fi
+
+if [ -z "$specified_repo" ]
+then
+ echo "repo not specified on -r flag"
+ exit 1
+fi
+
+read parent_repo \
+ parent_latest_released_tag \
+ parent_latest_snapshot_tag \
+ parent_changed_files \
+ parent_docker_images \
+ <<< $( grep policy/parent $release_data_file | tr ',' ' ' )
+
+read common_repo \
+ common_latest_released_tag \
+ common_latest_snapshot_tag \
+ common_changed_files \
+ common_docker_images \
+ <<< $( grep policy/common $release_data_file | tr ',' ' ' )
+
+read docker_repo \
+ docker_latest_released_tag \
+ docker_latest_snapshot_tag \
+ docker_changed_files \
+ docker_docker_images \
+ <<< $( grep policy/docker $release_data_file | tr ',' ' ' )
+
+read models_repo \
+ models_latest_released_tag \
+ models_latest_snapshot_tag \
+ models_changed_files \
+ models_docker_images \
+ <<< $( grep policy/models $release_data_file | tr ',' ' ' )
+
+read 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 ',' ' ' )
+
+read target_repo \
+ target_latest_released_tag \
+ target_latest_snapshot_tag \
+ target_changed_files \
+ target_docker_images \
+ <<< $( grep $specified_repo $release_data_file | tr ',' ' ' )
+
+if [ -z "$target_repo" ]
+then
+ echo "specified repo '$specified_repo' not found in policy release data file '$release_data_file'"
+ exit 1
+fi
+
+if [ ! "$specified_repo" = "$target_repo" ]
+then
+ echo "specified repo '$specified_repo' does not match target repo '$target_repo'"
+ exit 1
+fi
+
+if [ "$update_parent" = true ]
+then
+ if [ "$specified_repo" = "policy/parent" ]
+ then
+ if [ "$update_snapshot" = true ]
+ then
+ echo updating policy parent reference to $parent_latest_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
+ result_code=$?
+ else
+ next_release_version=${parent_latest_snapshot_tag%-*}
+
+ 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
+ result_code=$?
+ result_code=$?
+ fi
+ else
+ if [ "$update_snapshot" = true ]
+ then
+ echo updating policy parent reference to $parent_latest_snapshot_tag on $repo_location/$target_repo . . .
+ updateParentRef.sh \
+ -f $repo_location/$target_repo/pom.xml \
+ -g org.onap.policy.parent \
+ -a integration \
+ -v $parent_latest_snapshot_tag
+ result_code=$?
+ else
+ echo updating policy parent reference to $parent_latest_released_tag on $repo_location/$target_repo . . .
+ updateParentRef.sh \
+ -f $repo_location/$target_repo/pom.xml \
+ -g org.onap.policy.parent \
+ -a integration \
+ -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
+ else
+ echo policy parent reference update failed on $repo_location/$target_repo
+ exit 1
+ fi
+fi
+
+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 . . .
+ 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
+ result_code=$?
+ else
+ 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
+ result_code=$?
+ fi
+ if [[ "$result_code" -eq 0 ]]
+ then
+ echo policy common reference updated on $repo_location/$target_repo
+ else
+ echo policy common reference update failed on $repo_location/$target_repo
+ exit 1
+ fi
+fi
+
+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 . . .
+ 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
+ result_code=$?
+ else
+ 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
+ result_code=$?
+ fi
+ if [[ "$result_code" -eq 0 ]]
+ then
+ echo policy models reference updated on $repo_location/$target_repo
+ else
+ echo policy models reference update failed on $repo_location/$target_repo
+ exit 1
+ fi
+fi
+
+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 . . .
+ 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
+ result_code=$?
+ else
+ 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
+ result_code=$?
+ fi
+ if [[ "$result_code" -eq 0 ]]
+ then
+ echo policy drools-pdp reference updated on $repo_location/$target_repo
+ else
+ 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 \
+ -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
+ else
+ echo docker base images update failed on $repo_location/$target_repo
+ exit 1
+ fi
+fi