blob: 2c11f0e10cc3b449197bc025fecb9d461dd184cb [file] [log] [blame]
liamfallone84250c2022-06-17 11:11:55 +01001#! /bin/bash
2
Taka Cho6d188af2021-01-11 16:48:33 -05003# ============LICENSE_START====================================================
4# Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
adheli.tavares43a40e12023-07-18 12:04:20 +01005# Modification Copyright 2021-2023 Nordix Foundation.
a.sreekumard00369a2021-10-19 12:38:04 +01006# Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
Taka Cho6d188af2021-01-11 16:48:33 -05007# =============================================================================
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.tavares1f339f82023-02-17 15:14:07 +000023if [ -z "${WORKSPACE}" ]; then
24 WORKSPACE=$(git rev-parse --show-toplevel)
25 export WORKSPACE
liamfallone84250c2022-06-17 11:11:55 +010026fi
Taka Cho6d188af2021-01-11 16:48:33 -050027
adheli.tavares1f339f82023-02-17 15:14:07 +000028GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \
29 "${WORKSPACE}"/.gitreview)
30
31echo GERRIT_BRANCH="${GERRIT_BRANCH}"
32
liamfallon0a85ebf2022-12-18 02:24:07 +000033export POLICY_MARIADB_VER=10.10.2
Taka Cho6d188af2021-01-11 16:48:33 -050034echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER}
35
waynedunican74501192022-03-16 08:10:54 +000036export POLICY_POSTGRES_VER=11.1
37echo POLICY_POSTGRES_VER=${POLICY_POSTGRES_VER}
38
liamfallonf66c6832022-06-28 15:55:29 +010039function getDockerVersion
Jim Hahncfc44f02021-04-08 15:28:15 -040040{
adheli.tavares1f339f82023-02-17 15:14:07 +000041 REPO=${1}
42 DEFAULT_DOCKER_IMAGE_NAME=${2:-}
43 DEFAULT_DOCKER_IMAGE_VERSION=${3:-}
liamfallonf66c6832022-06-28 15:55:29 +010044
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
adheli.tavares083ccca2023-08-31 09:39:06 +010070 # docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}')
71 docker_image_version=$latest_snapshot_tag
liamfallonf66c6832022-06-28 15:55:29 +010072 docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//")
73
74 if \
75 curl -qL --silent \
76 "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" |
77 grep -q "$docker_image_version"
78 then
79 echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
80 return
81 fi
82
83 docker_image_version="$latest_released_tag"
84 if \
85 curl -qL --silent \
86 "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" |
87 grep -q "$docker_image_version"
88 then
89 echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
90 return
91 fi
92
93 docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION"
94 if \
95 curl -qL --silent \
96 "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" |
97 grep -q "$docker_image_version"
98 then
99 echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
100 return
101 else
102 echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\""
103 exit 1
104 fi
Jim Hahncfc44f02021-04-08 15:28:15 -0400105}
106
liamfallonf66c6832022-06-28 15:55:29 +0100107getDockerVersion docker
108export POLICY_DOCKER_VERSION="$docker_image_version"
Taka Cho6d188af2021-01-11 16:48:33 -0500109
adheli.tavares43a40e12023-07-18 12:04:20 +0100110getDockerVersion models "'policy-models-simulator'" 3.0.1
liamfallonf66c6832022-06-28 15:55:29 +0100111export POLICY_MODELS_VERSION="$docker_image_version"
Taka Cho6d188af2021-01-11 16:48:33 -0500112
liamfallonf66c6832022-06-28 15:55:29 +0100113getDockerVersion api
114export POLICY_API_VERSION="$docker_image_version"
Taka Cho6d188af2021-01-11 16:48:33 -0500115
liamfallonf66c6832022-06-28 15:55:29 +0100116getDockerVersion pap
117export POLICY_PAP_VERSION="$docker_image_version"
Taka Cho6d188af2021-01-11 16:48:33 -0500118
liamfallonf66c6832022-06-28 15:55:29 +0100119getDockerVersion apex-pdp
120export POLICY_APEX_PDP_VERSION="$docker_image_version"
Taka Cho6d188af2021-01-11 16:48:33 -0500121
liamfallonf66c6832022-06-28 15:55:29 +0100122getDockerVersion drools-pdp
123export POLICY_DROOLS_PDP_VERSION="$docker_image_version"
Taka Cho6d188af2021-01-11 16:48:33 -0500124
liamfallonf66c6832022-06-28 15:55:29 +0100125getDockerVersion xacml-pdp
126export POLICY_XACML_PDP_VERSION="$docker_image_version"
Taka Cho6d188af2021-01-11 16:48:33 -0500127
liamfallonf66c6832022-06-28 15:55:29 +0100128getDockerVersion distribution
129export POLICY_DISTRIBUTION_VERSION="$docker_image_version"
Sirisha_Manchikanti4d0a1d72021-06-08 09:28:21 +0100130
liamfallonf66c6832022-06-28 15:55:29 +0100131getDockerVersion clamp
132export POLICY_CLAMP_VERSION="$docker_image_version"
ktimoney88a991b2021-08-09 17:23:35 +0100133
liamfallonf66c6832022-06-28 15:55:29 +0100134getDockerVersion gui
135export POLICY_GUI_VERSION="$docker_image_version"
saul.gill26424502022-03-15 11:56:01 +0000136
liamfallonf66c6832022-06-28 15:55:29 +0100137getDockerVersion drools-applications
138export POLICY_DROOLS_APPS_VERSION="$docker_image_version"