aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2018-04-30 17:24:44 -0500
committerJorge Hernandez <jh1730@att.com>2018-04-30 20:29:33 -0500
commit3ad277569c8966442d8b56c4ca6ccc4efd40acd7 (patch)
tree3a8ed54e8c88443bbdaa401ab1392c8bb11d07aa
parent43d1d7f7769f88236364c982e13d76cc6cbc26db (diff)
Make custom preinstallation available in image
This script could be used by OOM installation to trigger the installation of a drools application or other purposes (ie. control loop) Change-Id: Iafdb413ee85aa341351481584e8c967cc1a3c112 Issue-ID: POLICY-566 Signed-off-by: Jorge Hernandez <jh1730@att.com>
-rw-r--r--docker_build.sh9
-rw-r--r--docker_merge.sh8
-rw-r--r--docker_verify.sh8
-rw-r--r--packages/docker/src/main/docker/Dockerfile2
-rw-r--r--packages/docker/src/main/docker/do-start.sh20
5 files changed, 25 insertions, 22 deletions
diff --git a/docker_build.sh b/docker_build.sh
index 6f00f7e8..6f680584 100644
--- a/docker_build.sh
+++ b/docker_build.sh
@@ -19,14 +19,15 @@ DOCKER_REPOSITORY=nexus3.onap.org:10003
MVN_VERSION=$(cat packages/docker/target/version)
MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . packages/docker/target/version)
TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
-PROXY_ARGS=""
+BUILD_ARGS="--build-arg BUILD_VERSION=${MVN_VERSION}"
IMAGE=policy-drools
if [ $HTTP_PROXY ]; then
- PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}"
+ BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
fi
+
if [ $HTTPS_PROXY ]; then
- PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
+ BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
fi
echo $DOCKER_REPOSITORY
@@ -76,7 +77,7 @@ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-STAGING-${
echo $TAGS
-docker build --quiet ${PROXY_ARGS} $TAGS packages/docker/target/$IMAGE
+docker build --quiet ${BUILD_ARGS} $TAGS packages/docker/target/$IMAGE
if [ $? -ne 0 ]
then
diff --git a/docker_merge.sh b/docker_merge.sh
index 804ea854..20fa184c 100644
--- a/docker_merge.sh
+++ b/docker_merge.sh
@@ -19,14 +19,14 @@ DOCKER_REPOSITORY=nexus3.onap.org:10003
MVN_VERSION=$(cat packages/docker/target/version)
MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . packages/docker/target/version)
TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
-PROXY_ARGS=""
+BUILD_ARGS="--build-arg BUILD_VERSION=${MVN_VERSION}"
IMAGE=policy-drools
if [ $HTTP_PROXY ]; then
- PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}"
+ BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
fi
if [ $HTTPS_PROXY ]; then
- PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
+ BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
fi
echo $DOCKER_REPOSITORY
@@ -72,7 +72,7 @@ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAM
echo $TAGS
-docker build --quiet ${PROXY_ARGS} $TAGS packages/docker/target/$IMAGE
+docker build --quiet ${BUILD_ARGS} $TAGS packages/docker/target/$IMAGE
if [ $? -ne 0 ]
then
diff --git a/docker_verify.sh b/docker_verify.sh
index 009fce44..6a4d0242 100644
--- a/docker_verify.sh
+++ b/docker_verify.sh
@@ -22,14 +22,14 @@ DOCKER_REPOSITORY=nexus3.onap.org:10003
MVN_VERSION=$(cat packages/docker/target/version)
MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . packages/docker/target/version)
TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
-PROXY_ARGS=""
+BUILD_ARGS="--build-arg BUILD_VERSION=${MVN_VERSION}"
IMAGE=policy-drools
if [ $HTTP_PROXY ]; then
- PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}"
+ BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
fi
if [ $HTTPS_PROXY ]; then
- PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
+ BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
fi
echo $DOCKER_REPOSITORY
@@ -75,7 +75,7 @@ TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/${IMAGE}:${MVN_VERSION}-${TIMESTAM
echo $TAGS
-docker build --quiet ${PROXY_ARGS} $TAGS packages/docker/target/$IMAGE
+docker build --quiet ${BUILD_ARGS} $TAGS packages/docker/target/$IMAGE
if [ $? -ne 0 ]
then
diff --git a/packages/docker/src/main/docker/Dockerfile b/packages/docker/src/main/docker/Dockerfile
index b06edf1b..f04b0cf5 100644
--- a/packages/docker/src/main/docker/Dockerfile
+++ b/packages/docker/src/main/docker/Dockerfile
@@ -2,12 +2,14 @@ FROM ubuntu:14.04
ARG HTTP_PROXY=${HTTP_PROXY}
ARG HTTPS_PROXY=${HTTPS_PROXY}
+ARG BUILD_VERSION=${BUILD_VERSION}
ARG POLICY_HOME=/opt/app/policy
ARG POLICY_LOGS=/var/log/onap/policy/pdpd
ARG POLICY_INSTALL=/tmp/policy-install
ENV http_proxy $HTTP_PROXY
ENV https_proxy $HTTPS_PROXY
+ENV BUILD_VERSION ${BUILD_VERSION}
ENV POLICY_INSTALL ${POLICY_INSTALL}
ENV POLICY_HOME ${POLICY_HOME}
ENV POLICY_LOGS ${POLICY_LOGS}
diff --git a/packages/docker/src/main/docker/do-start.sh b/packages/docker/src/main/docker/do-start.sh
index dfb65e52..fa4cd6ab 100644
--- a/packages/docker/src/main/docker/do-start.sh
+++ b/packages/docker/src/main/docker/do-start.sh
@@ -32,9 +32,10 @@ else
cp config/*.conf .
fi
- # wait for nexus up before installing, since installation
- # needs to deploy some artifacts to the repo
- ./wait-for-port.sh nexus 8081
+ if [[ -f config/drools-preinstall.sh ]] ; then
+ echo "found preinstallation script"
+ bash config/drools-preinstall.sh
+ fi
# remove broken symbolic links if any in data directory
if [[ -d ${POLICY_HOME}/config ]]; then
@@ -43,12 +44,11 @@ else
fi
apps=$(ls config/apps*.zip 2> /dev/null)
-
- echo "Applications found: ${apps}"
-
- if [[ -n ${apps} ]]; then
- unzip -o ${apps}
- fi
+ for app in $apps
+ do
+ echo "Application found: ${app}"
+ unzip -o ${app}
+ done
echo "docker install at ${PWD}"
@@ -61,7 +61,7 @@ else
cp config/policy-keystore ${POLICY_HOME}/etc/ssl
fi
- if [[ -x config/drools-tweaks.sh ]] ; then
+ if [[ -f config/drools-tweaks.sh ]] ; then
echo "Executing tweaks"
# file may not be executable; running it as an
# argument to bash avoids needing execute perms.