Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 1 | <!-- |
| 2 | ============LICENSE_START======================================================= |
| 3 | Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. |
Ram Krishna Verma | 1d4ce8d | 2020-02-05 16:28:33 -0500 | [diff] [blame] | 4 | Modifications Copyright (C) 2020 Bell Canada. |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 5 | ================================================================================ |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | |
| 18 | SPDX-License-Identifier: Apache-2.0 |
| 19 | ============LICENSE_END========================================================= |
| 20 | --> |
| 21 | |
| 22 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 23 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| 24 | |
| 25 | <modelVersion>4.0.0</modelVersion> |
| 26 | |
| 27 | <parent> |
| 28 | <groupId>org.onap.policy.api</groupId> |
Ram Krishna Verma | 1d4ce8d | 2020-02-05 16:28:33 -0500 | [diff] [blame] | 29 | <artifactId>api-packages</artifactId> |
Jim Hahn | 6c686f9 | 2020-04-24 16:27:47 -0400 | [diff] [blame] | 30 | <version>2.2.4-SNAPSHOT</version> |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 31 | </parent> |
| 32 | |
| 33 | <packaging>pom</packaging> |
| 34 | <artifactId>policy-api-docker</artifactId> |
Ram Krishna Verma | 1d4ce8d | 2020-02-05 16:28:33 -0500 | [diff] [blame] | 35 | <name>${project.artifactId}</name> |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 36 | <description>Policy api docker image</description> |
| 37 | |
| 38 | <properties> |
| 39 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 40 | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
| 41 | <dist.project.version>${project.version}</dist.project.version> |
| 42 | <docker.skip>false</docker.skip> |
| 43 | <docker.skip.build>false</docker.skip.build> |
| 44 | <docker.skip.push>false</docker.skip.push> |
| 45 | <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry> |
| 46 | <docker.push.registry>nexus3.onap.org:10003</docker.push.registry> |
| 47 | <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format> |
| 48 | </properties> |
| 49 | |
| 50 | <build> |
| 51 | <finalName>${project.artifactId}-${project.version}</finalName> |
| 52 | <plugins> |
| 53 | <plugin> |
| 54 | <groupId>org.codehaus.groovy.maven</groupId> |
| 55 | <artifactId>gmaven-plugin</artifactId> |
| 56 | <version>1.0</version> |
| 57 | <executions> |
| 58 | <execution> |
| 59 | <phase>validate</phase> |
| 60 | <goals> |
| 61 | <goal>execute</goal> |
| 62 | </goals> |
| 63 | <configuration> |
| 64 | <source> |
Rashmi Pujar | 11e7349 | 2019-06-07 15:48:40 -0400 | [diff] [blame] | 65 | println 'Project version: ' + project.properties['dist.project.version'] |
| 66 | if (project.properties['dist.project.version'] != null) { |
| 67 | def versionArray = project.properties['dist.project.version'].split('-') |
| 68 | def minMaxVersionArray = versionArray[0].tokenize('.') |
| 69 | if (project.properties['dist.project.version'].endsWith("-SNAPSHOT")) { |
| 70 | project.properties['project.docker.latest.minmax.tag.version'] = |
| 71 | minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-SNAPSHOT-latest" |
| 72 | } else { |
| 73 | project.properties['project.docker.latest.minmax.tag.version'] = |
| 74 | minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-STAGING-latest" |
| 75 | } |
| 76 | println 'New tag for docker: ' + project.properties['project.docker.latest.minmax.tag.version'] |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 77 | } |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 78 | </source> |
| 79 | </configuration> |
| 80 | </execution> |
| 81 | </executions> |
| 82 | </plugin> |
| 83 | |
| 84 | <plugin> |
| 85 | <groupId>io.fabric8</groupId> |
| 86 | <artifactId>docker-maven-plugin</artifactId> |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 87 | |
| 88 | <configuration> |
| 89 | <verbose>true</verbose> |
| 90 | <apiVersion>1.23</apiVersion> |
| 91 | <pullRegistry>${docker.pull.registry}</pullRegistry> |
| 92 | <pushRegistry>${docker.push.registry}</pushRegistry> |
| 93 | |
| 94 | <images> |
| 95 | <image> |
| 96 | <name>onap/policy-api</name> |
| 97 | <build> |
| 98 | <cleanup>try</cleanup> |
| 99 | <dockerFile>Dockerfile</dockerFile> |
| 100 | <tags> |
| 101 | <tag>${project.version}</tag> |
| 102 | <tag>${project.version}-${maven.build.timestamp}</tag> |
Rashmi Pujar | 11e7349 | 2019-06-07 15:48:40 -0400 | [diff] [blame] | 103 | <tag>${project.docker.latest.minmax.tag.version}</tag> |
Chenfei Gao | 6ea2e1b | 2019-01-31 16:09:09 -0500 | [diff] [blame] | 104 | </tags> |
| 105 | <assembly> |
| 106 | <inline> |
| 107 | <dependencySets> |
| 108 | <dependencySet> |
| 109 | <includes> |
| 110 | <include>org.onap.policy.api:policy-api-tarball</include> |
| 111 | </includes> |
| 112 | <outputDirectory>/lib</outputDirectory> |
| 113 | <outputFileNameMapping>policy-api.tar.gz</outputFileNameMapping> |
| 114 | </dependencySet> |
| 115 | </dependencySets> |
| 116 | </inline> |
| 117 | </assembly> |
| 118 | </build> |
| 119 | </image> |
| 120 | </images> |
| 121 | </configuration> |
| 122 | |
| 123 | <executions> |
| 124 | <execution> |
| 125 | <id>clean-images</id> |
| 126 | <phase>pre-clean</phase> |
| 127 | <goals> |
| 128 | <goal>remove</goal> |
| 129 | </goals> |
| 130 | <configuration> |
| 131 | <removeAll>true</removeAll> |
| 132 | </configuration> |
| 133 | </execution> |
| 134 | |
| 135 | <execution> |
| 136 | <id>generate-images</id> |
| 137 | <phase>generate-sources</phase> |
| 138 | <goals> |
| 139 | <goal>build</goal> |
| 140 | </goals> |
| 141 | </execution> |
| 142 | |
| 143 | <execution> |
| 144 | <id>push-images</id> |
| 145 | <phase>deploy</phase> |
| 146 | <goals> |
| 147 | <goal>build</goal> |
| 148 | <goal>push</goal> |
| 149 | </goals> |
| 150 | <configuration> |
| 151 | <image>onap/policy-api</image> |
| 152 | </configuration> |
| 153 | </execution> |
| 154 | </executions> |
| 155 | </plugin> |
| 156 | |
| 157 | <plugin> |
| 158 | <groupId>org.apache.maven.plugins</groupId> |
| 159 | <artifactId>maven-deploy-plugin</artifactId> |
| 160 | <configuration> |
| 161 | <skip>true</skip> |
| 162 | </configuration> |
| 163 | </plugin> |
| 164 | </plugins> |
| 165 | </build> |
| 166 | |
| 167 | <dependencies> |
| 168 | <dependency> |
| 169 | <groupId>org.onap.policy.api</groupId> |
| 170 | <artifactId>policy-api-tarball</artifactId> |
| 171 | <version>${project.version}</version> |
| 172 | <classifier>tarball</classifier> |
| 173 | <type>tar.gz</type> |
| 174 | </dependency> |
| 175 | </dependencies> |
| 176 | </project> |