rameshiyer27 | 65fc375 | 2023-04-05 13:47:15 +0100 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | |
| 3 | # ============LICENSE_START==================================================== |
FrancescoFioraEst | 8fadfb9 | 2024-04-17 11:42:58 +0100 | [diff] [blame] | 4 | # Copyright (C) 2023-2024 Nordix Foundation. All rights reserved. |
rameshiyer27 | 65fc375 | 2023-04-05 13:47:15 +0100 | [diff] [blame] | 5 | # ============================================================================= |
| 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 | |
| 23 | if [ -z "${WORKSPACE}" ]; then |
| 24 | WORKSPACE=$(git rev-parse --show-toplevel) |
| 25 | export WORKSPACE |
| 26 | fi |
| 27 | |
| 28 | VALUES_YML=${WORKSPACE}/helm/policy/values.yaml |
| 29 | |
FrancescoFioraEst | 8fadfb9 | 2024-04-17 11:42:58 +0100 | [diff] [blame] | 30 | policy_components=(policy-api policy-pap policy-apex-pdp policy-models-simulator policy-pdpd-cl policy-xacml-pdp policy-distribution policy-db-migrator) |
rameshiyer27 | 65fc375 | 2023-04-05 13:47:15 +0100 | [diff] [blame] | 31 | |
FrancescoFioraEst | 8fadfb9 | 2024-04-17 11:42:58 +0100 | [diff] [blame] | 32 | clamp_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) |
rameshiyer27 | 65fc375 | 2023-04-05 13:47:15 +0100 | [diff] [blame] | 33 | |
| 34 | version_tags=$(source ${WORKSPACE}/compose/get-versions.sh) |
| 35 | export version_tags |
| 36 | |
| 37 | function 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 | |
| 43 | function update_image_tags() { |
| 44 | sub_components=("$@") |
| 45 | for sub_component in ${sub_components[@]} |
| 46 | do |
| 47 | if [[ $1 == 'clamp' ]] |
| 48 | then |
rameshiyer27 | 18f79b4 | 2023-10-11 17:29:06 +0100 | [diff] [blame] | 49 | component=policy-clamp-ac-sim-ppnt |
rameshiyer27 | 65fc375 | 2023-04-05 13:47:15 +0100 | [diff] [blame] | 50 | elif [[ $1 == 'policy' ]] |
| 51 | then |
| 52 | component=$sub_component |
| 53 | fi |
| 54 | update_yaml $component $sub_component |
| 55 | done |
| 56 | } |
| 57 | |
| 58 | echo "Update the latest image tags:" |
| 59 | update_image_tags policy ${policy_components[@]} |
| 60 | update_image_tags clamp ${clamp_components[@]} |