aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimoney, Dan (dt5972) <dtimoney@att.com>2019-04-02 12:53:53 -0700
committerTimoney, Dan (dt5972) <dtimoney@att.com>2019-04-02 12:53:53 -0700
commit1b1086659c8a3c31b29e3275f1636d50ef4ac71b (patch)
treeaecbc35c90bce5a146f121c3aa19e8fecccea4cc
parentcea8d3ee9628be96730b8473813cbbd7ca9360dd (diff)
Update to use fabric io docker plugin
Update to use fabric io docker plugin to create docker image Change-Id: I6b068a3224bf9af9cc8c3b2e43dbb3af377d54b7 Issue-ID: CCSDK-1011 Signed-off-by: Timoney, Dan (dt5972) <dtimoney@att.com>
-rw-r--r--TagVersion.groovy41
-rw-r--r--ccsdk-app-os/pom.xml102
2 files changed, 116 insertions, 27 deletions
diff --git a/TagVersion.groovy b/TagVersion.groovy
new file mode 100644
index 0000000..68a8b78
--- /dev/null
+++ b/TagVersion.groovy
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CCSDK
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.ccsdk.distribution
+
+
+def versionArray;
+if ( project.properties['ccsdk.project.version'] != null ) {
+ versionArray = project.properties['ccsdk.project.version'].split('\\.');
+}
+
+if ( project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT") ) {
+ patchArray = versionArray[2].split('-');
+ project.properties['project.docker.latestminortag.version']=versionArray[0] + '.' + versionArray[1] + "-SNAPSHOT-latest";
+ project.properties['project.docker.latestfulltag.version']=versionArray[0] + '.' + versionArray[1] + '.' + patchArray[0] + "-SNAPSHOT-latest";
+ project.properties['project.docker.latesttagtimestamp.version']=versionArray[0] + '.' + versionArray[1] + '.' + patchArray[0] + "-SNAPSHOT-"+project.properties['ccsdk.build.timestamp'];
+} else {
+ project.properties['project.docker.latestminortag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+ project.properties['project.docker.latestfulltag.version']=versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2] + "-STAGING-latest";
+ project.properties['project.docker.latesttagtimestamp.version']=versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2] + "-STAGING-"+project.properties['ccsdk.build.timestamp'];
+}
diff --git a/ccsdk-app-os/pom.xml b/ccsdk-app-os/pom.xml
index 7744dda..a7c7f58 100644
--- a/ccsdk-app-os/pom.xml
+++ b/ccsdk-app-os/pom.xml
@@ -30,11 +30,16 @@
<build.version>${project.version}</build.version>
<!-- Tests usually require some setup that maven cannot do, so skip. -->
<skiptests>true</skiptests>
- <docker.image.name>onap/${project.groupId}.${project.artifactId}</docker.image.name>
- <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
- <image-name>${docker.push.registry}/${docker.image.name}</image-name>
+
+ <image.name>onap/${project.groupId}.${project.artifactId}</image.name>
+ <ccsdk.project.version>${project.version}</ccsdk.project.version>
+ <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp>
+ <ccsdk.distribution.version>${project.version}</ccsdk.distribution.version>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+ <docker.verbose>true</docker.verbose>
</properties>
+
<repositories>
<repository>
<!-- Releases repository has ECOMP release artifacts -->
@@ -71,7 +76,21 @@
<target>1.8</target>
</configuration>
</plugin>
-
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>${basedir}/../TagVersion.groovy</source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
@@ -120,29 +139,7 @@
</overlays>
</configuration>
</plugin>
- <plugin>
- <groupId>com.spotify</groupId>
- <artifactId>dockerfile-maven-plugin</artifactId>
- <version>1.4.10</version>
- <configuration>
- <useMavenSettingsForAuth>true</useMavenSettingsForAuth>
- <repository>${image-name}</repository>
- <tag>latest</tag>
- <dockerfile>Dockerfile</dockerfile>
- <buildArgs>
- <WAR_FILE>${project.build.finalName}.war</WAR_FILE>
- </buildArgs>
- </configuration>
- <executions>
- <execution>
- <id>default</id>
- <goals>
- <goal>build</goal>
- <goal>push</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+
<!-- no deployment needed -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -154,6 +151,57 @@
</plugin>
</plugins>
</build>
+
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.28.0</version>
+ <inherited>false</inherited>
+ <configuration>
+ <images>
+ <image>
+ <name>${image.name}</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${basedir}</dockerFileDir>
+ <dockerFile>Dockerfile</dockerFile>
+ <tags>
+ <tag>${project.docker.latestminortag.version}</tag>
+ <tag>${project.docker.latestfulltag.version}</tag>
+ <tag>${project.docker.latesttagtimestamp.version}</tag>
+ </tags>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-images</id>
+ <phase>package</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
<dependencies>
<!-- ECD webapp resources -->