Remove maven during building docker images 41/34941/1
authorDenes Nemeth <denes.nemeth@nokia.com>
Fri, 9 Mar 2018 10:38:58 +0000 (11:38 +0100)
committerDenes Nemeth <denes.nemeth@nokia.com>
Fri, 9 Mar 2018 10:57:15 +0000 (11:57 +0100)
Change-Id: Ic26230d8a5479704aa80f1b35e5cd36d556e7054
Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com>
Issue-ID: VFC-728

13 files changed:
nokiav2/deployment/pom.xml
nokiav2/deployment/src/main/resources/Dockerfile
nokiav2/deployment/src/main/resources/build_image.sh
nokiav2/deployment/src/main/resources/test_xmlstarlet.sh [new file with mode: 0755]
nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/maven-metadata.xml [deleted file]
nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/maven-metadata.xml.md5 [deleted file]
nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/maven-metadata.xml.sha1 [deleted file]
nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/vfc-nfvo-driver-vnfm-svnfm-1.1.0-20180308.094402-1.pom [deleted file]
nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/vfc-nfvo-driver-vnfm-svnfm-1.1.0-20180308.094402-1.pom.md5 [deleted file]
nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/vfc-nfvo-driver-vnfm-svnfm-1.1.0-20180308.094402-1.pom.sha1 [deleted file]
nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/maven-metadata.xml [deleted file]
nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/maven-metadata.xml.md5 [deleted file]
nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/maven-metadata.xml.sha1 [deleted file]

index c58bc0e..ff9bc50 100644 (file)
     <artifactId>vfc-nfvo-driver-vnfm-svnfm-nokiav2</artifactId>
     <version>1.1.0-SNAPSHOT</version>
   </parent>
-  <repositories>
-    <repository>
-      <id>project.local</id>
-      <name>project</name>
-      <url>file:${project.basedir}/src/repo</url>
-    </repository>
-  </repositories>
   <build>
     <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>3.0.2</version>
-        <executions>
-          <execution>
-            <id>copy</id>
-            <phase>install</phase>
-            <goals>
-              <goal>copy</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <excludeTypes>pom</excludeTypes>
-          <artifactItems>
-            <artifactItem>
-              <artifactId>driverwar</artifactId>
-              <version>1.1.0-SNAPSHOT</version>
-              <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2</groupId>
-              <type>war</type>
-              <overWrite>true</overWrite>
-              <outputDirectory>${project.basedir}/src/main/resources</outputDirectory>
-              <destFileName>driver.war</destFileName>
-            </artifactItem>
-          </artifactItems>
-        </configuration>
-      </plugin>
-      <plugin>
-        <artifactId>maven-assembly-plugin</artifactId>
-        <version>3.1.0</version>
-        <configuration>
-          <descriptors>
-            <descriptor>src/assembly/assembly.xml</descriptor>
-          </descriptors>
-        </configuration>
-        <executions>
-          <execution>
-            <id>create-archive</id>
-            <phase>package</phase>
-            <goals>
-              <goal>single</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
+      <!-- fail the bulid if xmlstarlet is not present in Jenkins env -->
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>exec-maven-plugin</artifactId>
         <version>1.6.0</version>
         <configuration>
-          <executable>${project.basedir}/src/main/resources/build_image.sh</executable>
+          <executable>${project.basedir}/src/main/resources/test_xmlstarlet.sh</executable>
           <workingDirectory>${project.build.directory}</workingDirectory>
         </configuration>
         <executions>
           <execution>
-            <phase>package</phase>
+            <phase>compile</phase>
             <goals>
               <goal>exec</goal>
             </goals>
index e42f7b9..2ad7209 100755 (executable)
@@ -1,17 +1,16 @@
 FROM centos:7
 WORKDIR /service
+ARG VERSION
 COPY docker-entrypoint.sh .
 COPY LICENSE ./ONAP_LICENSE
 COPY application.properties .
-COPY driver.war .
-
 RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
 RUN sed -i 's|#baseurl=http://mirror.centos.org/centos|baseurl=http://mirrors.ocf.berkeley.edu/centos|' /etc/yum.repos.d/*.repo
 RUN yum -y update
-RUN yum -y install java-1.8.0-openjdk-headless
+RUN yum -y install java-1.8.0-openjdk-headless wget
 # Debugging tools withing the container
-RUN yum -y install mc vim tcpdump wget net-tools nc strace telnet unzip
-#RUN sed -i 's|#networkaddress.cache.ttl=-1|networkaddress.cache.ttl=10|' /usr/lib/jvm/jre/lib/security/java.security
+RUN yum -y install mc vim tcpdump net-tools nc strace telnet unzip xmlstarlet
+RUN wget -q -O driver.war "https://nexus.onap.org/service/local/artifact/maven/redirect?r=staging&g=org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2&a=driverwar&v=${VERSION}&e=war"
 ENV JAVA_HOME /usr/lib/jvm/jre
 RUN yum clean all
 EXPOSE 8089
index 24706f8..358048d 100755 (executable)
 
 if [ "a$1" != "abuildDocker" ] ; then
   echo "Skipping building Docker image"
+  echo "If you would like to build the docker image by script execute $0 buildDocker" 
+  echo "If you would like to build and push the docker image by script execute $0 buildDocker pushImage" 
   echo "If you would like to build the docker image by maven execute mvn package -Dexec.args=\"buildDocker\"" 
+  echo "If you would like to push the docker image by maven execute mvn package -Dexec.args=\"buildDocker pushImage\""
   exit
 fi 
 
 DIRNAME=`dirname $0`
 DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd`
-echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
+echo "----- Build directory ${DOCKER_BUILD_DIR}"
 cd ${DOCKER_BUILD_DIR}
 
-BUILD_ARGS="--no-cache --squash"
-ORG="onap"
-VERSION="1.1.0"
+VERSION=`xmlstarlet sel -t -v "/_:project/_:version" ../../../pom.xml | sed 's/-SNAPSHOT//g'`
+echo "------ Detected version: $VERSION"
+
 PROJECT="vfc"
 IMAGE="nfvo/svnfm/nokiav2"
 DOCKER_REPOSITORY="nexus3.onap.org:10003"
+ORG="onap"
+BUILD_ARGS="--no-cache --squash"
 IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
 TIMESTAMP=$(date +"%Y%m%dT%H%M%S")
 
 if [ $HTTP_PROXY ]; then
+    echo "----- Using HTTP proxy ${HTTP_PROXY}"
     BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
 fi
+
 if [ $HTTPS_PROXY ]; then
+    echo "----- Using HTTPS proxy ${HTTPS_PROXY}"
     BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
 fi
 
 function build_image {
     echo "Start build docker image: ${IMAGE_NAME}"
-    docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:latest .
+    echo "docker build --build-arg VERSION=${VERSION} ${BUILD_ARGS} -t ${IMAGE_NAME}:latest ."
+    docker build --build-arg VERSION=${VERSION} ${BUILD_ARGS} -t ${IMAGE_NAME}:latest .
 }
 
 function push_image_tag {
diff --git a/nokiav2/deployment/src/main/resources/test_xmlstarlet.sh b/nokiav2/deployment/src/main/resources/test_xmlstarlet.sh
new file mode 100755 (executable)
index 0000000..f5ee03d
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+DIRNAME=`dirname $0`
+BUILD_DIR=`cd $DIRNAME/; pwd`
+
+#If xmlstarlet is not present build will fail
+xmlstarlet ed ${BUILD_DIR}/../../../pom.xml
diff --git a/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/maven-metadata.xml b/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/maven-metadata.xml
deleted file mode 100644 (file)
index d0c75b9..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata modelVersion="1.1.0">
-  <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId>
-  <artifactId>vfc-nfvo-driver-vnfm-svnfm</artifactId>
-  <version>1.1.0-SNAPSHOT</version>
-  <versioning>
-    <snapshot>
-      <timestamp>20180308.094402</timestamp>
-      <buildNumber>1</buildNumber>
-    </snapshot>
-    <lastUpdated>20180308094402</lastUpdated>
-    <snapshotVersions>
-      <snapshotVersion>
-        <extension>pom</extension>
-        <value>1.1.0-20180308.094402-1</value>
-        <updated>20180308094402</updated>
-      </snapshotVersion>
-    </snapshotVersions>
-  </versioning>
-</metadata>
diff --git a/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/maven-metadata.xml.md5 b/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/maven-metadata.xml.md5
deleted file mode 100644 (file)
index 472b3e8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-60b7495445e0beefa15d6d99e1a6e414
\ No newline at end of file
diff --git a/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/maven-metadata.xml.sha1 b/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/maven-metadata.xml.sha1
deleted file mode 100644 (file)
index ed4fb1f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-a459cd0bb4960a3484035c0d3c8f877f467be5a5
\ No newline at end of file
diff --git a/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/vfc-nfvo-driver-vnfm-svnfm-1.1.0-20180308.094402-1.pom b/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/vfc-nfvo-driver-vnfm-svnfm-1.1.0-20180308.094402-1.pom
deleted file mode 100644 (file)
index ffe5bc6..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!--
-    Copyright 2017 ZTE Corporation.
-
-    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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <groupId>org.onap.oparent</groupId>
-        <artifactId>oparent</artifactId>
-        <version>0.1.1</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId>
-    <artifactId>vfc-nfvo-driver-vnfm-svnfm</artifactId>
-    <version>1.1.0-SNAPSHOT</version>
-    <packaging>pom</packaging>
-    <name>vfc-nfvo-driver-vnfm-svnfm</name>
-    <description>vfc-nfvo-driver-vnfm-svnfm</description>
-    <modules>
-        <module>zte</module>
-        <module>huawei</module>
-        <module>nokia</module>
-        <module>nokiav2</module>
-    </modules>
-</project>
diff --git a/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/vfc-nfvo-driver-vnfm-svnfm-1.1.0-20180308.094402-1.pom.md5 b/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/vfc-nfvo-driver-vnfm-svnfm-1.1.0-20180308.094402-1.pom.md5
deleted file mode 100644 (file)
index 48473a2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-e8f2e2ef2633830bbe80a3b78391e1b2
\ No newline at end of file
diff --git a/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/vfc-nfvo-driver-vnfm-svnfm-1.1.0-20180308.094402-1.pom.sha1 b/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/1.1.0-SNAPSHOT/vfc-nfvo-driver-vnfm-svnfm-1.1.0-20180308.094402-1.pom.sha1
deleted file mode 100644 (file)
index f4fe376..0000000
+++ /dev/null
@@ -1 +0,0 @@
-8f3224dcebfb83ec7dfd637f013728d55e701f5c
\ No newline at end of file
diff --git a/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/maven-metadata.xml b/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/maven-metadata.xml
deleted file mode 100644 (file)
index 5bd2a7c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<metadata>
-  <groupId>org.onap.vfc.nfvo.driver.vnfm.svnfm</groupId>
-  <artifactId>vfc-nfvo-driver-vnfm-svnfm</artifactId>
-  <versioning>
-    <versions>
-      <version>1.1.0-SNAPSHOT</version>
-    </versions>
-    <lastUpdated>20180308094402</lastUpdated>
-  </versioning>
-</metadata>
diff --git a/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/maven-metadata.xml.md5 b/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/maven-metadata.xml.md5
deleted file mode 100644 (file)
index 6fe29e4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-33379de33c0323f40765da74d9c89c23
\ No newline at end of file
diff --git a/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/maven-metadata.xml.sha1 b/nokiav2/deployment/src/repo/org/onap/vfc/nfvo/driver/vnfm/svnfm/vfc-nfvo-driver-vnfm-svnfm/maven-metadata.xml.sha1
deleted file mode 100644 (file)
index 6a3c1f7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-170dc16b9adbbbac54cc418990ae9ac03ee7ce9e
\ No newline at end of file