diff options
6 files changed, 101 insertions, 105 deletions
diff --git a/TagVersion.groovy b/TagVersion.groovy new file mode 100644 index 00000000..68a8b780 --- /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/ms/blueprintsprocessor/distribution/pom.xml b/ms/blueprintsprocessor/distribution/pom.xml index fb5e3c12..b3eabc10 100755 --- a/ms/blueprintsprocessor/distribution/pom.xml +++ b/ms/blueprintsprocessor/distribution/pom.xml @@ -14,7 +14,9 @@ ~ 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"> +<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"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId> @@ -33,6 +35,8 @@ <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy> <docker.push.phase>deploy</docker.push.phase> <docker.verbose>true</docker.verbose> + <ccsdk.project.version>${project.version}</ccsdk.project.version> + <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp> </properties> <dependencies> @@ -77,7 +81,8 @@ <phase>package</phase> <configuration> <tasks> - <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/> + <fixcrlf srcdir="${basedir}" eol="unix" + includes="**/*.sh, **/*.source" /> </tasks> </configuration> <goals> @@ -91,7 +96,7 @@ <artifactId>maven-assembly-plugin</artifactId> <version>3.1.0</version> <configuration> - <!-- <skipAssembly>${skip.assembly}</skipAssembly>--> + <!-- <skipAssembly>${skip.assembly}</skipAssembly> --> <outputDirectory>${basedir}/target/docker-stage</outputDirectory> <descriptors> <descriptor>src/main/docker/distribution.xml</descriptor> @@ -119,22 +124,7 @@ <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> + <source>${basedir}/../../../TagVersion.groovy</source> </configuration> </execution> </executions> @@ -147,30 +137,30 @@ <profile> <id>docker</id> <build> - <plugins> - <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> + <plugins> + <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.docker.latestminortag.version}</tag> + <tag>${project.docker.latestfulltag.version}</tag> + <tag>${project.docker.latesttagtimestamp.version}</tag> + </tags> + </build> + </image> + </images> + <verbose>true</verbose> + </configuration> + <executions> <execution> <id>generate-images</id> <phase>package</phase> @@ -193,4 +183,4 @@ </profile> </profiles> -</project>
\ No newline at end of file +</project> diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt index 5552e75e..876c75fa 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolution/processor/PrimaryDataResourceAssignmentProcessor.kt @@ -18,6 +18,7 @@ package org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor import com.fasterxml.jackson.databind.node.JsonNodeFactory +import com.fasterxml.jackson.databind.node.MissingNode import com.fasterxml.jackson.databind.node.NullNode import org.onap.ccsdk.apps.blueprintsprocessor.db.primary.PrimaryDBLibGenericService import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.DatabaseResourceSource @@ -51,7 +52,7 @@ open class PrimaryDataResourceAssignmentProcessor(private val primaryDBLibGeneri // Check if It has Input val value = raRuntimeService.getInputValue(resourceAssignment.name) - if (value != null && value !is NullNode) { + if (value !is NullNode && value !is MissingNode) { logger.info("primary-db source template key (${resourceAssignment.name}) found from input and value is ($value)") ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value) } else { diff --git a/ms/controllerblueprints/distribution/pom.xml b/ms/controllerblueprints/distribution/pom.xml index 91d4bbca..c73d15b6 100755 --- a/ms/controllerblueprints/distribution/pom.xml +++ b/ms/controllerblueprints/distribution/pom.xml @@ -34,6 +34,8 @@ <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy> <docker.push.phase>deploy</docker.push.phase> <docker.verbose>true</docker.verbose> + <ccsdk.project.version>${project.version}</ccsdk.project.version> + <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp> </properties> <dependencies> @@ -120,22 +122,7 @@ <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> + <source>${basedir}/../../../TagVersion.groovy</source> </configuration> </execution> </executions> @@ -162,9 +149,9 @@ <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> + <tag>${project.docker.latestminortag.version}</tag> + <tag>${project.docker.latestfulltag.version}</tag> + <tag>${project.docker.latesttagtimestamp.version}</tag> </tags> </build> </image> diff --git a/ms/neng/pom.xml b/ms/neng/pom.xml index ed68afb4..fcd3f3d2 100644 --- a/ms/neng/pom.xml +++ b/ms/neng/pom.xml @@ -59,7 +59,9 @@ <ccsdk.project.version>${project.version}</ccsdk.project.version> <image.name>onap/ccsdk-apps-ms-neng</image.name> <timestamp>${maven.build.timestamp}</timestamp> - <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format> + <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format> + <ccsdk.project.version>${project.version}</ccsdk.project.version> + <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp> </properties> <profiles> @@ -198,9 +200,9 @@ <cleanup>try</cleanup> <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir> <tags> - <tag>${project.version}</tag> - <tag>${project.docker.latesttag.version}</tag> - <tag>${project.version}-STAGING-${maven.build.timestamp}</tag> + <tag>${project.docker.latestminortag.version}</tag> + <tag>${project.docker.latestfulltag.version}</tag> + <tag>${project.docker.latesttagtimestamp.version}</tag> </tags> </build> </image> @@ -381,21 +383,7 @@ <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> + <source>${basedir}/../../TagVersion.groovy</source> </configuration> </execution> </executions> diff --git a/ms/vlantag-api/pom.xml b/ms/vlantag-api/pom.xml index ea461056..e2734703 100644 --- a/ms/vlantag-api/pom.xml +++ b/ms/vlantag-api/pom.xml @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<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"> +<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"> <modelVersion>4.0.0</modelVersion> <groupId>org.onap.ccsdk.apps.ms.vlantagapi</groupId> @@ -34,13 +36,14 @@ <docker.push.phase>deploy</docker.push.phase> <docker.verbose>true</docker.verbose> <ccsdk.project.version>${project.version}</ccsdk.project.version> + <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp> </properties> <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.2.1-SNAPSHOT</version> - <relativePath/> + <relativePath /> </parent> @@ -116,22 +119,7 @@ <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> + <source>${basedir}/../../TagVersion.groovy</source> </configuration> </execution> </executions> @@ -152,7 +140,7 @@ <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.5.201505241946</version> <executions> - <!-- Prepares the property pointing to the JaCoCo runtime agent which + <!-- Prepares the property pointing to the JaCoCo runtime agent which is passed as VM argument when Maven the Surefire plugin is executed. --> <execution> <id>pre-unit-test</id> @@ -165,7 +153,7 @@ <propertyName>surefireArgLine</propertyName> </configuration> </execution> - <!-- Ensures that the code coverage report for unit tests is created + <!-- Ensures that the code coverage report for unit tests is created after unit tests have been run. --> <execution> <id>post-unit-test</id> @@ -234,8 +222,9 @@ <serverId>docker-hub</serverId> <registryUrl>https://${docker.registry}</registryUrl> <imageTags> - <imageTag>${project.version}</imageTag> - <imageTag>latest</imageTag> + <imageTag>${project.docker.latestminortag.version}</imageTag> + <imageTag>${project.docker.latestfulltag.version}</imageTag> + <imageTag>${project.docker.latesttagtimestamp.version}</imageTag> </imageTags> <forceTags>true</forceTags> <resources> |