Skip to content

Commit 4c6dbce

Browse files
author
Taka Cho
committed
move docker-build groovy script to docker repo
For all docker builds, policy is using groovy-maven-plugin to run a groovy script to determine the tag for docker. The plan is: 1, move docker-tag groovy script to docker repo. 2, change source for groovy-maven-plugin to a URL below, that will point to the source code from step #1. <configuration> <source>https://raw.githubusercontent.com/onap /policy-docker/master/utils/groovy /docker-tag.groovy</source> </configuration> Issue-ID: POLICY-3378 Change-Id: Iff1f09e5ae47205240305b09602c49d403fad98f Signed-off-by: Taka Cho <[email protected]>
1 parent ab96e4d commit 4c6dbce

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

utils/groovy/docker-tag.groovy

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*-
2+
* ============LICENSE_START=======================================================
3+
* ONAP POLICY
4+
* ================================================================================
5+
* Copyright (C) 2021 AT&T Intellectual Property. All right reserved.
6+
* ================================================================================
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* ============LICENSE_END============================================
19+
* ===================================================================
20+
*
21+
*/
22+
println 'Project version: ' + project.properties['dist.project.version']
23+
if (project.properties['dist.project.version'] != null) {
24+
def versionArray = project.properties['dist.project.version'].split('-')
25+
def minMaxVersionArray = versionArray[0].tokenize('.')
26+
if (project.properties['dist.project.version'].endsWith("-SNAPSHOT")) {
27+
project.properties['project.docker.latest.minmax.tag.version'] =
28+
minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-SNAPSHOT-latest"
29+
} else {
30+
project.properties['project.docker.latest.minmax.tag.version'] =
31+
minMaxVersionArray[0] + "." + minMaxVersionArray[1] + "-STAGING-latest"
32+
}
33+
println 'New tag for docker: ' + properties['project.docker.latest.minmax.tag.version']
34+
}

0 commit comments

Comments
 (0)