summaryrefslogtreecommitdiffstats
path: root/compose/get-versions.sh
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-07-19 13:50:04 +0100
committeradheli.tavares <adheli.tavares@est.tech>2024-07-19 15:58:32 +0100
commitdaecbb96b9a747a2edaf33a3e9a9784cc71440a8 (patch)
treeb15dfb91125912a7945256a68f69dc532814ad55 /compose/get-versions.sh
parentbb225c8be9e911880995aefa40072e3347bd5004 (diff)
Add CSIT option to run xacml-pdp against postgres database
Issue-ID: POLICY-5087 Change-Id: Icfece3dbb9263e09a4d59edbea8acad5a4ea7ce3 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'compose/get-versions.sh')
-rwxr-xr-xcompose/get-versions.sh220
1 files changed, 117 insertions, 103 deletions
diff --git a/compose/get-versions.sh b/compose/get-versions.sh
index 13dc3653..a51ccef9 100755
--- a/compose/get-versions.sh
+++ b/compose/get-versions.sh
@@ -25,115 +25,129 @@ if [ -z "${WORKSPACE}" ]; then
export WORKSPACE
fi
-GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \
- "${WORKSPACE}"/.gitreview)
-
-echo GERRIT_BRANCH="${GERRIT_BRANCH}"
-
+#default values
export POLICY_MARIADB_VER=10.10.2
echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER}
export POLICY_POSTGRES_VER=11.1
echo POLICY_POSTGRES_VER=${POLICY_POSTGRES_VER}
-function getDockerVersion
-{
- REPO=${1}
- DEFAULT_DOCKER_IMAGE_NAME=${2:-}
- DEFAULT_DOCKER_IMAGE_VERSION=${3:-}
-
- REPO_RELEASE_DATA=$(
- curl -qL --silent \
- "https://github.com/onap/policy-parent/raw/$GERRIT_BRANCH/integration/src/main/resources/release/pf_release_data.csv" |
- grep "^policy/$REPO"
- )
-
- # shellcheck disable=SC2034
- read -r repo \
- latest_released_tag \
- latest_snapshot_tag \
- changed_files \
- docker_images \
- <<< "$(echo "$REPO_RELEASE_DATA" | tr ',' ' ' )"
-
- if [[ -z "$docker_images" ]]
- then
- if [[ -z "$DEFAULT_DOCKER_IMAGE_NAME" ]]
+if [ -n "$LOCAL_IMAGES" ] && [ "$LOCAL_IMAGES" = "true" ]; then
+ echo "Running with local images."
+ export POLICY_DOCKER_VERSION="latest"
+ export POLICY_MODELS_VERSION="latest"
+ export POLICY_API_VERSION="latest"
+ export POLICY_PAP_VERSION="latest"
+ export POLICY_APEX_PDP_VERSION="latest"
+ export POLICY_DROOLS_PDP_VERSION="latest"
+ export POLICY_XACML_PDP_VERSION="latest"
+ export POLICY_DISTRIBUTION_VERSION="latest"
+ export POLICY_CLAMP_VERSION="latest"
+ export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION
+ export POLICY_DROOLS_APPS_VERSION="latest"
+
+else
+ GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \
+ "${WORKSPACE}"/.gitreview)
+
+ echo GERRIT_BRANCH="${GERRIT_BRANCH}"
+
+ function getDockerVersion
+ {
+ REPO=${1}
+ DEFAULT_DOCKER_IMAGE_NAME=${2:-}
+ DEFAULT_DOCKER_IMAGE_VERSION=${3:-}
+
+ REPO_RELEASE_DATA=$(
+ curl -qL --silent \
+ "https://github.com/onap/policy-parent/raw/$GERRIT_BRANCH/integration/src/main/resources/release/pf_release_data.csv" |
+ grep "^policy/$REPO"
+ )
+
+ # shellcheck disable=SC2034
+ read -r repo \
+ latest_released_tag \
+ latest_snapshot_tag \
+ changed_files \
+ docker_images \
+ <<< "$(echo "$REPO_RELEASE_DATA" | tr ',' ' ' )"
+
+ if [[ -z "$docker_images" ]]
then
- echo "repo $REPO does not produce a docker image, execution terminated"
- exit 1
+ if [[ -z "$DEFAULT_DOCKER_IMAGE_NAME" ]]
+ then
+ echo "repo $REPO does not produce a docker image, execution terminated"
+ exit 1
+ else
+ docker_images="$DEFAULT_DOCKER_IMAGE_NAME"
+ fi
+ fi
+
+ # docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}')
+ docker_image_version=$latest_snapshot_tag
+ docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//")
+
+ if \
+ curl -qL --silent \
+ "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" |
+ grep -q "$docker_image_version"
+ then
+ echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
+ return
+ fi
+
+ docker_image_version="$latest_released_tag"
+ if \
+ curl -qL --silent \
+ "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" |
+ grep -q "$docker_image_version"
+ then
+ echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
+ return
+ fi
+
+ docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION"
+ if \
+ curl -qL --silent \
+ "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" |
+ grep -q "$docker_image_version"
+ then
+ echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
+ return
else
- docker_images="$DEFAULT_DOCKER_IMAGE_NAME"
+ echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\""
+ exit 1
fi
- fi
-
- # docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}')
- docker_image_version=$latest_snapshot_tag
- docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//")
-
- if \
- curl -qL --silent \
- "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" |
- grep -q "$docker_image_version"
- then
- echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
- return
- fi
-
- docker_image_version="$latest_released_tag"
- if \
- curl -qL --silent \
- "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" |
- grep -q "$docker_image_version"
- then
- echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
- return
- fi
-
- docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION"
- if \
- curl -qL --silent \
- "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" |
- grep -q "$docker_image_version"
- then
- echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\""
- return
- else
- echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\""
- exit 1
- fi
-}
-
-getDockerVersion docker
-export POLICY_DOCKER_VERSION="$docker_image_version"
-
-getDockerVersion models "'policy-models-simulator'" 3.0.1
-export POLICY_MODELS_VERSION="$docker_image_version"
-
-getDockerVersion api
-export POLICY_API_VERSION="$docker_image_version"
-
-getDockerVersion pap
-export POLICY_PAP_VERSION="$docker_image_version"
-
-getDockerVersion apex-pdp
-export POLICY_APEX_PDP_VERSION="$docker_image_version"
-
-getDockerVersion drools-pdp
-export POLICY_DROOLS_PDP_VERSION="$docker_image_version"
-
-getDockerVersion xacml-pdp
-export POLICY_XACML_PDP_VERSION="$docker_image_version"
-
-getDockerVersion distribution
-export POLICY_DISTRIBUTION_VERSION="$docker_image_version"
-
-getDockerVersion clamp
-export POLICY_CLAMP_VERSION="$docker_image_version"
-export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION
-
-getDockerVersion gui
-export POLICY_GUI_VERSION="$docker_image_version"
-
-getDockerVersion drools-applications
-export POLICY_DROOLS_APPS_VERSION="$docker_image_version"
+ }
+
+ getDockerVersion docker
+ export POLICY_DOCKER_VERSION="$docker_image_version"
+
+ getDockerVersion models "'policy-models-simulator'" 3.0.1
+ export POLICY_MODELS_VERSION="$docker_image_version"
+
+ getDockerVersion api
+ export POLICY_API_VERSION="$docker_image_version"
+
+ getDockerVersion pap
+ export POLICY_PAP_VERSION="$docker_image_version"
+
+ getDockerVersion apex-pdp
+ export POLICY_APEX_PDP_VERSION="$docker_image_version"
+
+ getDockerVersion drools-pdp
+ export POLICY_DROOLS_PDP_VERSION="$docker_image_version"
+
+ getDockerVersion xacml-pdp
+ export POLICY_XACML_PDP_VERSION="$docker_image_version"
+
+ getDockerVersion distribution
+ export POLICY_DISTRIBUTION_VERSION="$docker_image_version"
+
+ getDockerVersion clamp
+ export POLICY_CLAMP_VERSION="$docker_image_version"
+ export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION
+
+ getDockerVersion drools-applications
+ export POLICY_DROOLS_APPS_VERSION="$docker_image_version"
+fi \ No newline at end of file