summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerban Jora <jora@research.att.com>2017-10-05 00:53:51 -0400
committerSerban Jora <jora@research.att.com>2017-10-13 14:43:38 -0400
commit9cec84e1594129c4035cb5e258e13cd1191eac19 (patch)
treee2cb3a0387fffa9c5065e2f7bd62313c17356f2f
parentac8436a606dddd9b00f6bb62ac3fa661eea6773d (diff)
Add Docker build plugin and support
Change-Id: I5dde9d9c12a5f62f53a1ce943fe5acf8a2c236bd Issue-Id: MODELING-26 Signed-off-by: Serban Jora <jora@research.att.com>
-rw-r--r--javatoscachecker/checker/src/main/java/org/onap/tosca/checker/Messages.java11
-rw-r--r--javatoscachecker/pom.xml1
-rw-r--r--javatoscachecker/service/pom.xml99
-rw-r--r--javatoscachecker/service/src/main/docker/Dockerfile15
-rw-r--r--javatoscachecker/service/src/main/docker/startService.sh26
5 files changed, 148 insertions, 4 deletions
diff --git a/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/Messages.java b/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/Messages.java
index 98158da..be10ea9 100644
--- a/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/Messages.java
+++ b/javatoscachecker/checker/src/main/java/org/onap/tosca/checker/Messages.java
@@ -13,6 +13,7 @@
package org.onap.tosca.checker;
import java.text.MessageFormat;
+import java.util.Locale;
import java.util.ResourceBundle;
import java.util.MissingResourceException;
@@ -28,9 +29,14 @@ public class Messages {
this.messages = ResourceBundle.getBundle("org/onap/tosca/checker/messages");
}
catch (MissingResourceException mrx) {
- throw new RuntimeException("", mrx);
+ //default
+ try {
+ this.messages = ResourceBundle.getBundle("org/onap/tosca/checker/messages", new Locale("en", "US"));
+ }
+ catch (MissingResourceException mrxx) {
+ throw new RuntimeException("Faile to load resources for locale or default resources", mrx);
+ }
}
-
//check that the Message enum is in sync with the resource bundle
}
@@ -52,3 +58,4 @@ public class Messages {
INCOMPATIBLE_REQUIREMENT_TARGET
}
}
+
diff --git a/javatoscachecker/pom.xml b/javatoscachecker/pom.xml
index 689f86e..0c0d853 100644
--- a/javatoscachecker/pom.xml
+++ b/javatoscachecker/pom.xml
@@ -63,7 +63,6 @@
</site>
</distributionManagement>
-
<!-- Black Duck plugin dependencies -->
<!--
<pluginRepositories>
diff --git a/javatoscachecker/service/pom.xml b/javatoscachecker/service/pom.xml
index 26597c4..94da89f 100644
--- a/javatoscachecker/service/pom.xml
+++ b/javatoscachecker/service/pom.xml
@@ -27,12 +27,27 @@
<properties>
<java.version>1.8</java.version>
- <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss a</maven.build.timestamp.format>
+ <maven.build.timestamp.format>yyyy.MM.dd'T'hh.mm.ss'Z'</maven.build.timestamp.format>
+ <docker.push.registry>${onap.nexus.dockerregistry.daily}</docker.push.registry>
+ <docker.tag.version>${project.version}</docker.tag.version>
+ <docker.tag.timestamp>${maven.build.timestamp}</docker.tag.timestamp>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.2</version>
+ <configuration>
+ <environmentVariables>
+ <DOCKER_HOST>tcp://127.0.0.1:2375</DOCKER_HOST>
+ </environmentVariables>
+ </configuration>
+ </plugin>
+
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
@@ -115,6 +130,88 @@
</execution>
</executions>
</plugin>
+
+ <plugin>
+ <groupId>com.spotify</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <imageName>onap/modeling/javatoscachecker</imageName>
+ <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
+ <!-- <serverId>docker-daily</serverId> -->
+ <!-- <serverId>ecomp-snapshots</serverId> -->
+
+ <noCache>true</noCache>
+ <imageTags>
+ <imageTag>latest</imageTag>
+ <imageTag>${docker.tag.version}-${docker.tag.timestamp}</imageTag>
+ </imageTags>
+ <forceTags>true</forceTags>
+ <resources>
+ <resource>
+ <targetPath>/</targetPath>
+ <directory>${project.build.directory}</directory>
+ <include>${project.build.finalName}.jar</include>
+ </resource>
+ <resource>
+ <targetPath>/</targetPath>
+ <directory>${project.basedir}</directory>
+ <include>application.properties</include>
+ </resource>
+ </resources>
+ </configuration>
+ <executions>
+ <execution>
+ <id>build-image</id>
+ <phase>package</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>tag-image-latest-timestamp</id>
+ <phase>package</phase>
+ <goals>
+ <goal>tag</goal>
+ </goals>
+ <configuration>
+ <image>onap/modeling/javatoscachecker:${docker.tag.version}-${docker.tag.timestamp}</image>
+ <newName>${docker.push.registry}/onap/modeling/javatoscachecker:${docker.tag.version}-${docker.tag.timestamp}</newName>
+ </configuration>
+ </execution>
+ <execution>
+ <id>push-image-latest-timestamp</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>push</goal>
+ </goals>
+ <configuration>
+ <imageName>${docker.push.registry}/onap/modeling/javatoscachecker:${docker.tag.version}-${docker.tag.timestamp}</imageName>
+ </configuration>
+ </execution>
+ <execution>
+ <id>tag-image-latest</id>
+ <phase>package</phase>
+ <goals>
+ <goal>tag</goal>
+ </goals>
+ <configuration>
+ <image>onap/modeling/javatoscachecker:latest</image>
+ <newName>${docker.push.registry}/onap/modeling/javatoscachecker:latest</newName>
+ </configuration>
+ </execution>
+ <execution>
+ <id>push-image-latest</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>push</goal>
+ </goals>
+ <configuration>
+ <imageName>${docker.push.registry}/onap/modeling/javatoscachecker:latest</imageName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/javatoscachecker/service/src/main/docker/Dockerfile b/javatoscachecker/service/src/main/docker/Dockerfile
new file mode 100644
index 0000000..2287b7d
--- /dev/null
+++ b/javatoscachecker/service/src/main/docker/Dockerfile
@@ -0,0 +1,15 @@
+FROM openjdk:8
+
+MAINTAINER "sj2381@att.com"
+
+ADD Service-1.0.0-SNAPSHOT.jar /opt/modeling/Service-1.0.0-SNAPSHOT.jar
+ADD application.properties /opt/modeling/application.properties
+VOLUME /etc
+ADD startService.sh /opt/modeling/startService.sh
+RUN chmod 700 /opt/modeling/startService.sh
+
+WORKDIR /opt/modeling/
+EXPOSE 8080
+ENTRYPOINT /opt/modeling/startService.sh
+
+
diff --git a/javatoscachecker/service/src/main/docker/startService.sh b/javatoscachecker/service/src/main/docker/startService.sh
new file mode 100644
index 0000000..d42cfe1
--- /dev/null
+++ b/javatoscachecker/service/src/main/docker/startService.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+###
+# ============LICENSE_START=======================================================
+# ================================================================================
+# 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============================================
+# ===================================================================
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+###
+
+java -Xms1024m -Xmx1024m -jar ./Service-1.0.0-SNAPSHOT.jar
+