summaryrefslogtreecommitdiffstats
path: root/deliveries/build_portalapps_dockers.sh
diff options
context:
space:
mode:
Diffstat (limited to 'deliveries/build_portalapps_dockers.sh')
-rwxr-xr-xdeliveries/build_portalapps_dockers.sh130
1 files changed, 78 insertions, 52 deletions
diff --git a/deliveries/build_portalapps_dockers.sh b/deliveries/build_portalapps_dockers.sh
index 4d4aa833..d4f8968e 100755
--- a/deliveries/build_portalapps_dockers.sh
+++ b/deliveries/build_portalapps_dockers.sh
@@ -7,89 +7,86 @@
# Stop on error; show output
set -e -x
-# This reuses the docker-compose file
+# This reuses the docker-compose environment file
echo "Set image tag name variables"
source $(dirname $0)/.env
-# Work standalone AND in the ONAP Jenkins.
+# Check for Jenkins build number
+if [ -n "$BUILD_NUMBER" ]; then
+ echo "Using Jenkins build number $BUILD_NUMBER"
+else
+ # This indicates a non-Jenkins build
+ export BUILD_NUMBER="999"
+fi
+
+# Must work when called by ONAP Jenkins AND local builds.
# Pick up Jenkins settings for this script.
# Use -B for batch operation to skip download progress output
if [ -n "$MVN" ]; then
- export MVN="${MVN} -B -gs ${GLOBAL_SETTINGS_FILE} -s ${SETTINGS_FILE}"
+ export MVN="${MVN} -B -gs ${GLOBAL_SETTINGS_FILE} -s ${SETTINGS_FILE} -Dbuild.number=$BUILD_NUMBER"
else
# Force refresh of snapshots
- MVN="mvn -B -U"
+ MVN="mvn -B -U -Dbuild.number=$BUILD_NUMBER"
fi
# This expects to start in the deliveries folder; make sure
-PORTAL_DOCKERFILE=Dockerfile.portalapps
+PORTAL_DOCKERFILE=Dockerfile.portal
if [ ! -f $PORTAL_DOCKERFILE ] ; then
echo "Failed to find file ${PORTAL_DOCKERFILE}; must start in deliveries folder; exiting"
exit 1
fi
+SDK_DOCKERFILE=Dockerfile.sdk
# Store directory names as variables
-# This is the Docker Project area.
-DELIV="$(pwd)"
+# This is the deliveries area.
+DELIVDIR="$(pwd)"
# parent directory, for finding source projects
cd ..
-BASE="$(pwd)"
-cd $DELIV
+BASEDIR="$(pwd)"
+cd $DELIVDIR
# Relative path of temp directory
BUILD_REL="build"
# Absolute path of temp directory
-BUILD_ABS=$DELIV/$BUILD_REL
-rm -fr $BUILD_REL
-mkdir $BUILD_REL
+BUILD_ABS=$DELIVDIR/$BUILD_REL
-# Copy DDL/DML to required directories
+# Build Java projects.
+# (use env var toskip when debugging Docker build problems)
+if [ "$SKIP_JAVA_BUILD" = "please" ]; then
-# RELATIVE PATHS to local directories with database scripts
-# bcos Docker looks within this build area only
-SCR_BASE=$BUILD_REL/scripts
-PORTAL_SCRIPT_DIR=$SCR_BASE/ecomp-portal-DB-os
-SDK_SCRIPT_DIR=$SCR_BASE/epsdk-app-os
-mkdir -p ${PORTAL_SCRIPT_DIR} ${SDK_SCRIPT_DIR}
+ echo "SKIPPING JAVA BUILD!"
-# copy over DB scripts for the dockerfiles
-# Portal
-cp $BASE/ecomp-portal-DB-common/*.sql ${PORTAL_SCRIPT_DIR}
-cp $BASE/ecomp-portal-DB-os/*.sql ${PORTAL_SCRIPT_DIR}
-# SDK app
-cp $BASE/sdk/ecomp-sdk/epsdk-app-common/db-scripts/*.sql ${SDK_SCRIPT_DIR}
-cp $BASE/sdk/ecomp-sdk/epsdk-app-os/db-scripts/*.sql ${SDK_SCRIPT_DIR}
+else
+ echo "Starting Java build."
-# build database docker
-DB_DOCKER_CMD="
- docker build -t ${DB_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS}
- --build-arg PORTAL_SCRIPT_DIR=${PORTAL_SCRIPT_DIR}
- --build-arg SDK_SCRIPT_DIR=${SDK_SCRIPT_DIR}
- -f Dockerfile.mariadb .
-"
-echo "Build mariadb docker image"
-$DB_DOCKER_CMD
+ # Clean out and recreate
+ rm -fr $BUILD_REL
+ mkdir $BUILD_REL
-echo "Build all jar and war files in Portal"
-cd $BASE
-${MVN} clean install
+ echo "Build jar and war files"
+ cd $BASEDIR
+ ${MVN} clean install
+
+ echo "Build Portal-SDK app"
+ cd $BASEDIR/sdk/ecomp-sdk/epsdk-app-os
+ ${MVN} clean package
+
+ echo "Java build complete."
+fi
echo "Copy Portal app BE"
-cd $BASE/ecomp-portal-BE-os
-cp target/ecompportal-be-os.war $BUILD_ABS
+cp $BASEDIR/ecomp-portal-BE-os/target/portal-be-os.war $BUILD_ABS
echo "Copy Portal app FE"
-cd $BASE/ecomp-portal-FE-os/
-cp -r dist/public $BUILD_ABS
+cp -r $BASEDIR/ecomp-portal-FE-os/dist/public $BUILD_ABS
echo "Copy Portal widget-ms"
-cd $BASE/ecomp-portal-widget-ms
-cp widget-ms/target/widget-ms.jar $BUILD_ABS
+cp $BASEDIR/ecomp-portal-widget-ms/widget-ms/target/widget-ms.jar $BUILD_ABS
+
+echo "Copy Portal-SDK app build results"
+cp $BASEDIR/sdk/ecomp-sdk/epsdk-app-os/target/epsdk-app-os.war $BUILD_ABS
-echo "Build and copy Portal-SDK app"
-cd $BASE/sdk/ecomp-sdk/epsdk-app-os
-${MVN} clean package
-cp target/epsdk-app-os.war $BUILD_ABS
+# Build Docker images
PROXY_ARGS=""
if [ $HTTP_PROXY ]; then
@@ -99,18 +96,47 @@ if [ $HTTPS_PROXY ]; then
PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
fi
+# must work in delivery directory
+cd $DELIVDIR
+
+# Copy DDL/DML to required directories
+# RELATIVE PATHS to local directories with database scripts
+# bcos Docker looks within this build area only
+DB_SCRIPT_DIR=$BUILD_REL/db-scripts
+mkdir -p ${DELIVDIR}/${DB_SCRIPT_DIR}
+# Portal
+cp $BASEDIR/ecomp-portal-DB-common/*.sql ${DB_SCRIPT_DIR}
+cp $BASEDIR/ecomp-portal-DB-os/*.sql ${DB_SCRIPT_DIR}
+# SDK app
+cp $BASEDIR/sdk/ecomp-sdk/epsdk-app-common/db-scripts/*.sql ${DB_SCRIPT_DIR}
+cp $BASEDIR/sdk/ecomp-sdk/epsdk-app-os/db-scripts/*.sql ${DB_SCRIPT_DIR}
+
+echo "Build mariadb docker image"
+DB_DOCKER_CMD="
+ docker build -t ${DB_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS}
+ --build-arg DB_SCRIPT_DIR=${DB_SCRIPT_DIR}
+ -f Dockerfile.mariadb .
+"
+$DB_DOCKER_CMD
+
echo "Build portal docker image"
-cd $DELIV
PORTAL_DOCKER_CMD="
docker build -t ${EP_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS}
--build-arg FE_DIR=$BUILD_REL/public
- --build-arg PORTAL_WAR=$BUILD_REL/ecompportal-be-os.war
- --build-arg SDK_WAR=$BUILD_REL/epsdk-app-os.war
+ --build-arg PORTAL_WAR=$BUILD_REL/portal-be-os.war
-f $PORTAL_DOCKERFILE .
"
$PORTAL_DOCKER_CMD
-echo "Bbuild widget-ms docker image"
+echo "Build sdk demo app docker image"
+SDK_DOCKER_CMD="
+ docker build -t ${SDK_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS}
+ --build-arg SDK_WAR=$BUILD_REL/epsdk-app-os.war
+ -f $SDK_DOCKERFILE .
+"
+$SDK_DOCKER_CMD
+
+echo "Build widget-ms docker image"
WMS_DOCKER_CMD="
docker build -t ${WMS_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS}
--build-arg WMS_JAR=$BUILD_REL/widget-ms.jar