blob: 4995460473bdae126d3e712b46e6691f6d2bb85c [file] [log] [blame]
rameshiyer2765fc3752023-04-05 13:47:15 +01001#! /bin/bash
2
3# ============LICENSE_START====================================================
FrancescoFioraEst8fadfb92024-04-17 11:42:58 +01004# Copyright (C) 2023-2024 Nordix Foundation. All rights reserved.
rameshiyer2765fc3752023-04-05 13:47:15 +01005# =============================================================================
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# SPDX-License-Identifier: Apache-2.0
19# ============LICENSE_END======================================================
20
21# Fetches the latest snapshot tags of policy components and updates the values.yaml in policy helm chart.
22
23if [ -z "${WORKSPACE}" ]; then
24 WORKSPACE=$(git rev-parse --show-toplevel)
25 export WORKSPACE
26fi
27
28VALUES_YML=${WORKSPACE}/helm/policy/values.yaml
29
FrancescoFioraEst8fadfb92024-04-17 11:42:58 +010030policy_components=(policy-api policy-pap policy-apex-pdp policy-models-simulator policy-pdpd-cl policy-xacml-pdp policy-distribution policy-db-migrator)
rameshiyer2765fc3752023-04-05 13:47:15 +010031
FrancescoFioraEst8fadfb92024-04-17 11:42:58 +010032clamp_components=(policy-clamp-runtime-acm policy-clamp-ac-kserve-ppnt policy-clamp-ac-k8s-ppnt policy-clamp-ac-pf-ppnt policy-clamp-ac-http-ppnt policy-clamp-ac-sim-ppnt policy-clamp-ac-a1pms-ppnt)
rameshiyer2765fc3752023-04-05 13:47:15 +010033
34version_tags=$(source ${WORKSPACE}/compose/get-versions.sh)
35export version_tags
36
37function update_yaml() {
38 local version=$(cut -d ":" -f2 <<< $(echo $version_tags | tr ' ' '\n' | grep "$1:" | tr -d '"'))
39 echo "$2:$version"
40 sed -i -e "s#onap/$2:[^=&]*#onap/$2:$version#g" $VALUES_YML
41}
42
43function update_image_tags() {
44 sub_components=("$@")
45 for sub_component in ${sub_components[@]}
46 do
47 if [[ $1 == 'clamp' ]]
48 then
rameshiyer2718f79b42023-10-11 17:29:06 +010049 component=policy-clamp-ac-sim-ppnt
rameshiyer2765fc3752023-04-05 13:47:15 +010050 elif [[ $1 == 'policy' ]]
51 then
52 component=$sub_component
53 fi
54 update_yaml $component $sub_component
55 done
56}
57
58echo "Update the latest image tags:"
59update_image_tags policy ${policy_components[@]}
60update_image_tags clamp ${clamp_components[@]}