[POLICY-54] Add proxy for docker builds and fixes 07/5607/3
authorShashank Kumar Shankar <shashank.kumar.shankar@intel.com>
Thu, 29 Jun 2017 19:52:59 +0000 (12:52 -0700)
committerShashank Kumar Shankar <shashank.kumar.shankar@intel.com>
Thu, 29 Jun 2017 21:53:53 +0000 (21:53 +0000)
This patch helps to build Policy docker images behind a proxy and
fixes the following correction in patch
https://gerrit.onap.org/r/#/c/5585/ :

1. $HTTP_PROXY and $HTTPS_PROXY environment variables
   gets reset with HTTP_PROXY="" and HTTP_PROXY="" overriding it.

2. When both $HTTP_PROXY and $HTTPS_PROXY are set, a space is needed
   when they are appended for providing correct arguments to docker
   build command.

Change-Id: I1d0f2003c77444e372b754d42f20d2e428e70a95
Signed-off-by: Shashank Kumar Shankar <shashank.kumar.shankar@intel.com>
docker_build.sh
docker_merge.sh
docker_verify.sh

index 746f710..4a8c416 100755 (executable)
@@ -5,15 +5,13 @@ DOCKER_REPOSITORY=nexus3.onap.org:10003
 MVN_VERSION=$(cat target/version)
 MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . target/version)
 TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
-HTTP_PROXY=""
-HTTPS_PROXY=""
 PROXY_ARGS=""
 
 if [ $HTTP_PROXY ]; then
     PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}"
 fi
 if [ $HTTPS_PROXY ]; then
-    PROXY_ARGS+="--build-arg HTTPS_PROXY=${HTTPS_PROXY}"
+    PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
 fi
 
 echo $DOCKER_REPOSITORY
index bbc0ca9..83fd239 100755 (executable)
@@ -5,6 +5,14 @@ DOCKER_REPOSITORY=nexus3.onap.org:10003
 MVN_VERSION=$(cat target/version)
 MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . target/version)
 TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
+PROXY_ARGS=""
+
+if [ $HTTP_PROXY ]; then
+    PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}"
+fi
+if [ $HTTPS_PROXY ]; then
+    PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
+fi
 
 echo $DOCKER_REPOSITORY
 echo $MVN_VERSION
@@ -55,7 +63,7 @@ for image in policy-os policy-nexus policy-db policy-base policy-drools policy-p
 
     echo $TAGS
 
-    docker build --quiet $TAGS target/$image
+    docker build --quiet ${PROXY_ARGS} $TAGS target/$image
 
     if [ $? -ne 0 ]
     then
index cdb42e9..17eff0a 100755 (executable)
@@ -8,6 +8,14 @@ DOCKER_REPOSITORY=nexus3.onap.org:10003
 MVN_VERSION=$(cat target/version)
 MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . target/version)
 TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
+PROXY_ARGS=""
+
+if [ $HTTP_PROXY ]; then
+    PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}"
+fi
+if [ $HTTPS_PROXY ]; then
+    PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
+fi
 
 echo $DOCKER_REPOSITORY
 echo $MVN_VERSION
@@ -58,7 +66,7 @@ for image in policy-os policy-nexus policy-db policy-base policy-drools policy-p
 
     echo $TAGS
 
-    docker build --quiet $TAGS target/$image
+    docker build --quiet ${PROXY_ARGS} $TAGS target/$image
 
     if [ $? -ne 0 ]
     then