summaryrefslogtreecommitdiffstats
path: root/controlloop/packages/docker-controlloop/src/main/resources/pdpd-cl-entrypoint.sh
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2020-02-16 19:49:42 -0600
committerjhh <jorge.hernandez-herrero@att.com>2020-02-17 11:49:35 -0600
commit927533c112b7bb50c7f19fe9a6286669ba572179 (patch)
treecffb513598a86be571e4326b475187abae917afd /controlloop/packages/docker-controlloop/src/main/resources/pdpd-cl-entrypoint.sh
parentbd3b962acb4ec6f8ae4c02c9364281295239fbd1 (diff)
Inherit from PDP-D (native policies) base image
Depends on https://gerrit.onap.org/r/#/c/policy/docker/+/101758/ for package cleanup and the native Dockerfile refactoring from https://gerrit.onap.org/r/#/c/policy/drools-pdp/+/101802/. Issue-ID: POLICY-2181 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I6cf2b945157a91abd9985bcff1e70ae6a30ae15d Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'controlloop/packages/docker-controlloop/src/main/resources/pdpd-cl-entrypoint.sh')
-rw-r--r--controlloop/packages/docker-controlloop/src/main/resources/pdpd-cl-entrypoint.sh73
1 files changed, 73 insertions, 0 deletions
diff --git a/controlloop/packages/docker-controlloop/src/main/resources/pdpd-cl-entrypoint.sh b/controlloop/packages/docker-controlloop/src/main/resources/pdpd-cl-entrypoint.sh
new file mode 100644
index 000000000..9b9218757
--- /dev/null
+++ b/controlloop/packages/docker-controlloop/src/main/resources/pdpd-cl-entrypoint.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+# ########################################################################
+# Copyright 2019-2020 AT&T Intellectual Property. All rights reserved
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ########################################################################
+
+function nexus {
+ if [[ ${DEBUG} == y ]]; then
+ echo "-- ${FUNCNAME[0]} --"
+ set -x
+ fi
+
+ if [[ -z ${RELEASE_REPOSITORY_URL} ]]; then
+ return 0
+ fi
+
+ # amsterdam legacy
+
+ echo
+ echo "checking if there are amsterdam policies already deployed .."
+ echo
+
+ local amsterdamVersion=$(curl --silent --connect-timeout 20 -X GET \
+ "http://nexus:8081/nexus/service/local/artifact/maven/resolve?r=releases&g=org.onap.policy-engine.drools.amsterdam&a=policy-amsterdam-rules&v=RELEASE" \
+ | grep -Po "(?<=<version>).*(?=</version>)")
+
+ if [[ -z ${amsterdamVersion} ]]; then
+ echo "no amsterdam policies have been found .."
+ exit 0
+ fi
+
+ echo
+ echo "The latest deployed amsterdam artifact in nexus has version ${amsterdamVersion}"
+ echo
+
+ sed -i.INSTALL \
+ -e "s/^rules.artifactId=.*/rules.artifactId=policy-amsterdam-rules/g" \
+ -e "s/^rules.groupId=.*/rules.groupId=org.onap.policy-engine.drools.amsterdam/g" \
+ -e "s/^rules.version=.*/rules.version=${amsterdamVersion}/g" "${POLICY_HOME}"/config/amsterdam-controller.properties
+
+ echo
+ echo "amsterdam controller will be started brained with maven coordinates:"
+ echo
+
+ grep "^rules" "${POLICY_HOME}"/config/amsterdam-controller.properties
+ echo
+ echo
+}
+
+if [[ ${DEBUG} == y ]]; then
+ echo "-- $0 $* --"
+ set -x
+fi
+
+operation="${1}"
+case "${operation}" in
+ nexus) nexus
+ ;;
+ *) ${POLICY_HOME}/bin/pdpd-entrypoint.sh "$@"
+ ;;
+esac