liamfallon | e84250c | 2022-06-17 11:11:55 +0100 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 3 | # ============LICENSE_START==================================================== |
| 4 | # Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. |
adheli.tavares | 7abe36c | 2022-02-02 14:53:10 +0000 | [diff] [blame] | 5 | # Modification Copyright 2021-2022 Nordix Foundation. |
a.sreekumar | d00369a | 2021-10-19 12:38:04 +0100 | [diff] [blame] | 6 | # Modifications Copyright (C) 2021 Bell Canada. All rights reserved. |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 7 | # ============================================================================= |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | # you may not use this file except in compliance with the License. |
| 10 | # You may obtain a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | # See the License for the specific language governing permissions and |
| 18 | # limitations under the License. |
| 19 | # |
| 20 | # SPDX-License-Identifier: Apache-2.0 |
| 21 | # ============LICENSE_END====================================================== |
| 22 | |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame^] | 23 | if [ -z "${WORKSPACE}" ]; then |
| 24 | WORKSPACE=$(git rev-parse --show-toplevel) |
| 25 | export WORKSPACE |
liamfallon | e84250c | 2022-06-17 11:11:55 +0100 | [diff] [blame] | 26 | fi |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 27 | |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame^] | 28 | GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ |
| 29 | "${WORKSPACE}"/.gitreview) |
| 30 | |
| 31 | echo GERRIT_BRANCH="${GERRIT_BRANCH}" |
| 32 | |
liamfallon | 0a85ebf | 2022-12-18 02:24:07 +0000 | [diff] [blame] | 33 | export POLICY_MARIADB_VER=10.10.2 |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 34 | echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER} |
| 35 | |
waynedunican | 7450119 | 2022-03-16 08:10:54 +0000 | [diff] [blame] | 36 | export POLICY_POSTGRES_VER=11.1 |
| 37 | echo POLICY_POSTGRES_VER=${POLICY_POSTGRES_VER} |
| 38 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 39 | function getDockerVersion |
Jim Hahn | cfc44f0 | 2021-04-08 15:28:15 -0400 | [diff] [blame] | 40 | { |
adheli.tavares | 1f339f8 | 2023-02-17 15:14:07 +0000 | [diff] [blame^] | 41 | REPO=${1} |
| 42 | DEFAULT_DOCKER_IMAGE_NAME=${2:-} |
| 43 | DEFAULT_DOCKER_IMAGE_VERSION=${3:-} |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 44 | |
| 45 | REPO_RELEASE_DATA=$( |
| 46 | curl -qL --silent \ |
| 47 | "https://github.com/onap/policy-parent/raw/$GERRIT_BRANCH/integration/src/main/resources/release/pf_release_data.csv" | |
| 48 | grep "^policy/$REPO" |
| 49 | ) |
| 50 | |
| 51 | # shellcheck disable=SC2034 |
| 52 | read -r repo \ |
| 53 | latest_released_tag \ |
| 54 | latest_snapshot_tag \ |
| 55 | changed_files \ |
| 56 | docker_images \ |
| 57 | <<< "$(echo "$REPO_RELEASE_DATA" | tr ',' ' ' )" |
| 58 | |
| 59 | if [[ -z "$docker_images" ]] |
| 60 | then |
| 61 | if [[ -z "$DEFAULT_DOCKER_IMAGE_NAME" ]] |
| 62 | then |
| 63 | echo "repo $REPO does not produce a docker image, execution terminated" |
| 64 | exit 1 |
| 65 | else |
| 66 | docker_images="$DEFAULT_DOCKER_IMAGE_NAME" |
| 67 | fi |
| 68 | fi |
| 69 | |
| 70 | docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}') |
| 71 | docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//") |
| 72 | |
| 73 | if \ |
| 74 | curl -qL --silent \ |
| 75 | "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" | |
| 76 | grep -q "$docker_image_version" |
| 77 | then |
| 78 | echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" |
| 79 | return |
| 80 | fi |
| 81 | |
| 82 | docker_image_version="$latest_released_tag" |
| 83 | if \ |
| 84 | curl -qL --silent \ |
| 85 | "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | |
| 86 | grep -q "$docker_image_version" |
| 87 | then |
| 88 | echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" |
| 89 | return |
| 90 | fi |
| 91 | |
| 92 | docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION" |
| 93 | if \ |
| 94 | curl -qL --silent \ |
| 95 | "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | |
| 96 | grep -q "$docker_image_version" |
| 97 | then |
| 98 | echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" |
| 99 | return |
| 100 | else |
| 101 | echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\"" |
| 102 | exit 1 |
| 103 | fi |
Jim Hahn | cfc44f0 | 2021-04-08 15:28:15 -0400 | [diff] [blame] | 104 | } |
| 105 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 106 | getDockerVersion docker |
| 107 | export POLICY_DOCKER_VERSION="$docker_image_version" |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 108 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 109 | getDockerVersion models "'policy-models-simulator'" 2.6.4 |
| 110 | export POLICY_MODELS_VERSION="$docker_image_version" |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 111 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 112 | getDockerVersion api |
| 113 | export POLICY_API_VERSION="$docker_image_version" |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 114 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 115 | getDockerVersion pap |
| 116 | export POLICY_PAP_VERSION="$docker_image_version" |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 117 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 118 | getDockerVersion apex-pdp |
| 119 | export POLICY_APEX_PDP_VERSION="$docker_image_version" |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 120 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 121 | getDockerVersion drools-pdp |
| 122 | export POLICY_DROOLS_PDP_VERSION="$docker_image_version" |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 123 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 124 | getDockerVersion xacml-pdp |
| 125 | export POLICY_XACML_PDP_VERSION="$docker_image_version" |
Taka Cho | 6d188af | 2021-01-11 16:48:33 -0500 | [diff] [blame] | 126 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 127 | getDockerVersion distribution |
| 128 | export POLICY_DISTRIBUTION_VERSION="$docker_image_version" |
Sirisha_Manchikanti | 4d0a1d7 | 2021-06-08 09:28:21 +0100 | [diff] [blame] | 129 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 130 | getDockerVersion clamp |
| 131 | export POLICY_CLAMP_VERSION="$docker_image_version" |
ktimoney | 88a991b | 2021-08-09 17:23:35 +0100 | [diff] [blame] | 132 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 133 | getDockerVersion gui |
| 134 | export POLICY_GUI_VERSION="$docker_image_version" |
saul.gill | 2642450 | 2022-03-15 11:56:01 +0000 | [diff] [blame] | 135 | |
liamfallon | f66c683 | 2022-06-28 15:55:29 +0100 | [diff] [blame] | 136 | getDockerVersion drools-applications |
| 137 | export POLICY_DROOLS_APPS_VERSION="$docker_image_version" |