summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conductor/pom.xml66
-rw-r--r--pom.xml5
-rw-r--r--script/TagVersion.groovy45
3 files changed, 116 insertions, 0 deletions
diff --git a/conductor/pom.xml b/conductor/pom.xml
index e914da3..5188397 100644
--- a/conductor/pom.xml
+++ b/conductor/pom.xml
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2018 Intel Corporation. All rights reserved.
+ Copyright (c) 2020 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
@@ -69,6 +70,71 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>${project.basedir}/../script/TagVersion.groovy</source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.26.0</version>
+ <configuration>
+ <verbose>true</verbose>
+ <apiVersion>1.23</apiVersion>
+ <images>
+ <image>
+ <name>${image.namespace}</name>
+ <alias>optf-has</alias>
+ <build>
+ <cleanup>true</cleanup>
+ <tags>
+ <tag>latest</tag>
+ <tag>${project.docker.latesttagtimestamp.version}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+
+ <dockerFile>${project.basedir}/docker/Dockerfile</dockerFile>
+ <args>
+ <MVN_ARTIFACT_VERSION>${project.version}</MVN_ARTIFACT_VERSION>
+ <REPO>${project.repo}</REPO>
+ </args>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-images</id>
+ <phase>install</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ <configuration>
+ <image>${image.namespace}:%l</image>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
diff --git a/pom.xml b/pom.xml
index bf7bbf7..14f5ec9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,6 +48,11 @@
<sonar.exclusions>**/tests/**,setup.py,**/lib/**</sonar.exclusions>
<sonar.test.inclusions>**/tests/**.py</sonar.test.inclusions>
<sonar.test.exclusions>**/**.py,setup.py,**/lib/**</sonar.test.exclusions>
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+ <has.build.timestamp>${maven.build.timestamp}</has.build.timestamp>
+ <has.project.version>${project.version}</has.project.version>
+ <has.docker.repository>nexus3.onap.org:10003</has.docker.repository>
+ <image.namespace>${has.docker.repository}/onap/optf-has</image.namespace>
</properties>
<build>
diff --git a/script/TagVersion.groovy b/script/TagVersion.groovy
new file mode 100644
index 0000000..468b2d4
--- /dev/null
+++ b/script/TagVersion.groovy
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP HAS
+ * ================================================================================
+ * Copyright (C) 2020 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.has.maven.scripts
+
+println project.properties['has.project.version']
+
+def versionTag
+if ( project.properties['has.project.version'] != null ) {
+ versionArray = project.properties['has.project.version'].split('\\.|-');
+ versionTag = versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2]
+ timestamp = project.properties['has.build.timestamp']
+}
+
+if ( project.properties['has.project.version'].endsWith("-SNAPSHOT") ) {
+ project.properties['project.docker.latesttag.version']=versionTag + "-SNAPSHOT-latest";
+ project.properties['project.docker.latesttagtimestamp.version']=versionTag + "-SNAPSHOT-"+timestamp;
+ project.properties['project.repo'] = 'snapshots'
+} else {
+ project.properties['project.docker.latesttag.version']=versionTag + "-STAGING-latest";
+ project.properties['project.docker.latesttagtimestamp.version']=versionTag + "-STAGING-"+timestamp;
+ project.properties['project.repo'] = 'releases'
+}
+
+println 'New Tag for docker: ' + project.properties['project.docker.latesttag.version']; \ No newline at end of file