diff options
author | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-08-23 15:54:30 +0000 |
---|---|---|
committer | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-08-23 15:57:47 +0000 |
commit | 380b7afc7c81a13c3025de0efed050ddbd1d929b (patch) | |
tree | 465c93569ecffd83fe187e10c1cf5cf92e62e45f | |
parent | 5285007a4e66bc18c69cef96aa32326a139d7642 (diff) |
Controller Blueprints Microservice
Add Docker Build and Deploy Maven Implementations for Controller Blueprint MS and their dependencies
Change-Id: I9eee9fff535bcc9ca0b855150892ce53af126d1c
Issue-ID: CCSDK-483
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
12 files changed, 276 insertions, 87 deletions
diff --git a/ms/controllerblueprints/application/pom.xml b/ms/controllerblueprints/application/pom.xml index 19fd9c72d..4e781ad1b 100644 --- a/ms/controllerblueprints/application/pom.xml +++ b/ms/controllerblueprints/application/pom.xml @@ -21,24 +21,18 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>controllerblueprints-parent</artifactId>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
- <artifactId>controllerblueprints-application</artifactId>
+ <artifactId>application</artifactId>
<name>Controller Blueprints Application</name>
<properties>
<swagger.directory>${basedir}/src/main/resources/swagger-ui/dist</swagger.directory>
<java.version>1.8</java.version>
- <docker.registry>xxxxxxxxx:5100</docker.registry>
- <assembly.id>distribution</assembly.id>
- <build.number>local</build.number>
<name.space>org.onap.ccsdk.apps</name.space> <!-- <name.space>${namespace}</name.space> -->
- <grm.namespace>org.onap.ccsdk.apps</grm.namespace>
- <archetypeVersion>200.0.49</archetypeVersion>
<serviceArtifactName>controllerblueprints</serviceArtifactName>
-
<!-- Sonar -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
@@ -50,15 +44,12 @@ <sonar.jacoco.itReportPath>${basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
<sonar.language>java</sonar.language>
<ilib.version>2.0.7</ilib.version>
- <!--<skip.assembly>false</skip.assembly>-->
- <!--<skip.swagger.generation>false</skip.swagger.generation>-->
</properties>
<dependencies>
-
<dependency>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>controllerblueprints-service</artifactId>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>service</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -102,17 +93,35 @@ </includes>
<filtering>true</filtering>
</resource>
- <resource>
- <directory>src/main/docker</directory>
- <targetPath>${basedir}/target</targetPath>
- <includes>
- <include>**/*</include>
- </includes>
- <filtering>true</filtering>
- </resource>
</resources>
<plugins>
<plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-dockerfile</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals><!-- here the phase you need -->
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/docker</directory>
+ <includes>
+ <include>*</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
@@ -167,28 +176,6 @@ </executions>
</plugin>
<plugin>
- <!--build the final artifact for docker deployment -->
- <artifactId>maven-assembly-plugin</artifactId>
- <version>3.0.0</version>
- <configuration>
- <!-- <skipAssembly>${skip.assembly}</skipAssembly>-->
- <outputDirectory>target</outputDirectory>
- <descriptors>
- <descriptor>src/assembly/distribution.xml</descriptor>
- </descriptors>
- <tarLongFileMode>posix</tarLongFileMode>
- </configuration>
- <executions>
- <execution>
- <id>${assembly.id}</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
diff --git a/ms/controllerblueprints/distribution/pom.xml b/ms/controllerblueprints/distribution/pom.xml new file mode 100644 index 000000000..37c0b8448 --- /dev/null +++ b/ms/controllerblueprints/distribution/pom.xml @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ 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
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <artifactId>distribution</artifactId>
+ <packaging>pom</packaging>
+ <name>Controller Blueprints Distribution</name>
+ <properties>
+ <assembly.id>maven</assembly.id>
+ <name.space>org.onap.ccsdk.apps</name.space> <!-- <name.space>${namespace}</name.space> -->
+ <serviceArtifactName>controllerblueprints</serviceArtifactName>
+ <image.name>onap/ccsdk-controllerblueprints</image.name>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>application</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-dockerfile</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals><!-- here the phase you need -->
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/docker</directory>
+ <includes>
+ <include>*</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>ant-test</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <fixcrlf srcdir="${basedir}" eol="unix"
+ includes="**/*.sh, **/*.source"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!--build the final artifact for docker deployment -->
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>3.0.0</version>
+ <configuration>
+ <!-- <skipAssembly>${skip.assembly}</skipAssembly>-->
+ <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+ <descriptors>
+ <descriptor>src/main/docker/distribution.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>posix</tarLongFileMode>
+ </configuration>
+ <executions>
+ <execution>
+ <id>${assembly.id}</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </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>
+ println project.properties['ccsdk.project.version'];
+ def versionArray;
+ if (project.properties['ccsdk.project.version'] != null ) {
+ versionArray = project.properties['ccsdk.project.version'].split('\\.');
+ }
+
+ if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
+ {
+ project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+ } else {
+ project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest";
+ }
+
+ println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.26.1</version>
+ <inherited>false</inherited>
+ <configuration>
+ <images>
+ <image>
+ <name>${image.name}</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ </build>
+ </image>
+ </images>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <!--<execution>-->
+ <!--<id>build-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>
+</project>
+
diff --git a/ms/controllerblueprints/application/src/main/dc/docker-compose.yaml b/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml index 5696d02b3..9450f3065 100644 --- a/ms/controllerblueprints/application/src/main/dc/docker-compose.yaml +++ b/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml @@ -17,7 +17,7 @@ services: controller-blueprints:
depends_on:
- db
- image: onap/controllerblueprints:1.0.0
+ image: onap/ccsdk-controllerblueprints:latest
container_name: cb-rest
ports:
- "8080:8080"
diff --git a/ms/controllerblueprints/application/src/main/docker/Dockerfile b/ms/controllerblueprints/distribution/src/main/docker/Dockerfile index 06304e1db..a2f453f24 100644 --- a/ms/controllerblueprints/application/src/main/docker/Dockerfile +++ b/ms/controllerblueprints/distribution/src/main/docker/Dockerfile @@ -1,5 +1,8 @@ FROM anapsix/alpine-java:8_jdk +ENV HTTP_PROXY ${HTTP_PROXY} +ENV HTTPS_PROXY ${HTTPS_PROXY} + RUN apk add --no-cache curl COPY startService.sh /startService.sh diff --git a/ms/controllerblueprints/application/src/assembly/distribution.xml b/ms/controllerblueprints/distribution/src/main/docker/distribution.xml index c58c20d78..f2f3cb0be 100644 --- a/ms/controllerblueprints/application/src/assembly/distribution.xml +++ b/ms/controllerblueprints/distribution/src/main/docker/distribution.xml @@ -32,11 +32,11 @@ </dependencySets> <fileSets> <fileSet> - <directory>${project.basedir}/src/main/resources</directory> + <directory>${project.basedir}/../application/src/main/resources</directory> <includes> <include>application.properties</include> </includes> - <outputDirectory>/</outputDirectory> + <outputDirectory>./</outputDirectory> <useDefaultExcludes>true</useDefaultExcludes> </fileSet> <fileSet> @@ -45,26 +45,26 @@ <include>Dockerfile</include> <include>startService.sh</include> </includes> - <outputDirectory>/</outputDirectory> + <outputDirectory>./</outputDirectory> <useDefaultExcludes>true</useDefaultExcludes> </fileSet> <fileSet> - <directory>${project.basedir}/src/main/groovy</directory> + <directory>${project.basedir}/../application/src/main/groovy</directory> <outputDirectory>src/main/groovy</outputDirectory> <useDefaultExcludes>true</useDefaultExcludes> </fileSet> <fileSet> - <directory>${project.basedir}/src/main/resources</directory> + <directory>${project.basedir}/../application/src/main/resources</directory> <outputDirectory>src/main/resources</outputDirectory> <useDefaultExcludes>true</useDefaultExcludes> </fileSet> <fileSet> - <directory>${project.basedir}/etc</directory> - <outputDirectory>/etc</outputDirectory> + <directory>${project.basedir}/../application/etc</directory> + <outputDirectory>./etc</outputDirectory> <useDefaultExcludes>true</useDefaultExcludes> </fileSet> <fileSet> - <directory>${project.basedir}/load</directory> + <directory>${project.basedir}/../application/load</directory> <outputDirectory>load</outputDirectory> <useDefaultExcludes>true</useDefaultExcludes> </fileSet> diff --git a/ms/controllerblueprints/application/src/main/docker/startService.sh b/ms/controllerblueprints/distribution/src/main/docker/startService.sh index 7077c2246..7077c2246 100644 --- a/ms/controllerblueprints/application/src/main/docker/startService.sh +++ b/ms/controllerblueprints/distribution/src/main/docker/startService.sh diff --git a/ms/controllerblueprints/modules/core/pom.xml b/ms/controllerblueprints/modules/core/pom.xml index fc7581c8c..5782c60fc 100644 --- a/ms/controllerblueprints/modules/core/pom.xml +++ b/ms/controllerblueprints/modules/core/pom.xml @@ -21,11 +21,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>controllerblueprints-modules</artifactId>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>modules</artifactId>
<version>0.3.0-SNAPSHOT</version>
</parent>
- <artifactId>controllerblueprints-core</artifactId>
+ <artifactId>core</artifactId>
<name>Controller Blueprints Core</name>
<dependencies>
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml index 9e7215ba8..5ab4e4477 100644 --- a/ms/controllerblueprints/modules/pom.xml +++ b/ms/controllerblueprints/modules/pom.xml @@ -21,12 +21,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>controllerblueprints-parent</artifactId>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
- <artifactId>controllerblueprints-modules</artifactId>
+ <artifactId>modules</artifactId>
<name>Controller Blueprints Modules</name>
<packaging>pom</packaging>
diff --git a/ms/controllerblueprints/modules/resource-dict/pom.xml b/ms/controllerblueprints/modules/resource-dict/pom.xml index 337f5512f..4f2261853 100644 --- a/ms/controllerblueprints/modules/resource-dict/pom.xml +++ b/ms/controllerblueprints/modules/resource-dict/pom.xml @@ -21,17 +21,17 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>controllerblueprints-modules</artifactId>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>modules</artifactId>
<version>0.3.0-SNAPSHOT</version>
</parent>
- <artifactId>controllerblueprints-resource-dict</artifactId>
+ <artifactId>resource-dict</artifactId>
<name>Controller Blueprints Resource Dictionary</name>
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>controllerblueprints-core</artifactId>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>core</artifactId>
</dependency>
</dependencies>
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml index b4b798e6e..6a40a4a71 100644 --- a/ms/controllerblueprints/modules/service/pom.xml +++ b/ms/controllerblueprints/modules/service/pom.xml @@ -21,11 +21,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>controllerblueprints-modules</artifactId>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>modules</artifactId>
<version>0.3.0-SNAPSHOT</version>
</parent>
- <artifactId>controllerblueprints-service</artifactId>
+ <artifactId>service</artifactId>
<name>Controller Blueprints Service</name>
<properties>
@@ -33,8 +33,8 @@ <dependencies>
<dependency>
- <groupId>org.onap.ccsdk.apps</groupId>
- <artifactId>controllerblueprints-resource-dict</artifactId>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>resource-dict</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml index f8977d1f3..e48c11342 100644 --- a/ms/controllerblueprints/parent/pom.xml +++ b/ms/controllerblueprints/parent/pom.xml @@ -20,18 +20,18 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> - <groupId>org.onap.ccsdk.apps</groupId> - <artifactId>controllerblueprints-parent</artifactId> + <parent> + <groupId>org.onap.ccsdk.apps</groupId> + <artifactId>controllerblueprints</artifactId> + <version>0.3.0-SNAPSHOT</version> + </parent> + <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> + <artifactId>parent</artifactId> <name>Controller Blueprints Parent</name> - <version>0.3.0-SNAPSHOT</version> <packaging>pom</packaging> <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <maven.compiler.target>1.8</maven.compiler.target> - <maven.compiler.source>1.8</maven.compiler.source> - <java.version>1.8</java.version> <spring.boot.version>2.0.4.RELEASE</spring.boot.version> + <spring.version>5.0.8.RELEASE</spring.version> <kotlin.version>1.2.60</kotlin.version> <eelf.version>1.0.0</eelf.version> <springfox.swagger2.version>2.9.2</springfox.swagger2.version> @@ -122,19 +122,26 @@ <version>${kotlin.version}</version> <scope>test</scope> </dependency> + + <!-- Application Components --> <dependency> - <groupId>org.onap.ccsdk.apps</groupId> - <artifactId>controllerblueprints-core</artifactId> + <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> + <artifactId>core</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.onap.ccsdk.apps</groupId> - <artifactId>controllerblueprints-service</artifactId> + <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> + <artifactId>service</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.onap.ccsdk.apps</groupId> - <artifactId>controllerblueprints-resource-dict</artifactId> + <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> + <artifactId>application</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId> + <artifactId>resource-dict</artifactId> <version>${project.version}</version> </dependency> </dependencies> @@ -148,17 +155,14 @@ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> - <version>3.2.1</version> - </dependency> + </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> - <version>3.2.2</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> - <version>2.6</version> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> diff --git a/ms/controllerblueprints/pom.xml b/ms/controllerblueprints/pom.xml index d76f4c8cb..798bdae4a 100644 --- a/ms/controllerblueprints/pom.xml +++ b/ms/controllerblueprints/pom.xml @@ -30,12 +30,20 @@ <properties> <service.name>ControllerBlueprints</service.name> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> + <build.number>${maven.build.timestamp}</build.number> + <java.version>1.8</java.version> + <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + <ccsdk.project.version>${project.version}</ccsdk.project.version> </properties> <packaging>pom</packaging> <modules> <module>parent</module> <module>modules</module> <module>application</module> + <module>distribution</module> </modules> </project> |