diff options
author | Vijay Venkatesh Kumar <vv770d@att.com> | 2019-12-09 05:32:08 +0000 |
---|---|---|
committer | Jessica Wagantall <jwagantall@linuxfoundation.org> | 2019-12-17 17:55:23 +0000 |
commit | 8610636cca4dfc68e727d36058900b65911641e2 (patch) | |
tree | 0e3a83a822d0770bf9a8c881954f406983e957a3 /shell | |
parent | 4acd3bdbfc60419b3e4533ba00adace82a616dd5 (diff) |
Global jjb tag override for ONAP
Related to RELENG-2422
Change-Id: I7d6a99a7fee7eb5a1db2879ecb4398640b836a20
Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com>
Issue-ID: DCAEGEN2-1893
Issue-ID: DCAEGEN2-1862
Diffstat (limited to 'shell')
-rwxr-xr-x | shell/docker-ts-tag-override.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/shell/docker-ts-tag-override.sh b/shell/docker-ts-tag-override.sh new file mode 100755 index 000000000..e14d2e5a9 --- /dev/null +++ b/shell/docker-ts-tag-override.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# ================================================================================ +# Copyright (c) 2019 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========================================================= + +set -feu -o pipefail + +echo "--> docker-ts-tag-override.sh" + +# Get project version from pom.xml +version=`xmllint --xpath "//*[local-name()='project']/*[local-name()='version']/text()" $DOCKER_ROOT/pom.xml` +echo "INFO: version from pom file $version" + +# Some pom has -SNAPSHOT or -STAGING under pom version, remove all text +version="${version//[^0-9.]/}" + +# Get build TS for specifying in the tag +timestamp=$(date +%C%y%m%dT%H%M%SZ) + +# Following the https://wiki.onap.org/display/DW/Independent+Versioning+and+Release+Process +# IndependentVersioningandReleaseProcess-StandardizedDockerTagging +# ONAP Tag requirement : {imagename}:{semver}-SNAPSHOT-{timestamp}Z (from CIMAN-132) + +if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + tag="${version}-SNAPSHOT-${timestamp}" +else + # Default to latest tag with TS if not conforming to semantic versioning + echo "WARN: version not complaint to sem-ver; tag defaulted to latest" + version=latest + tag="${version}-${timestamp}" +fi + +echo "INFO: docker tag is $tag" + +# Write DOCKER_IMAGE_TAG information to a file so it can be +# injected into the environment for following steps +echo "DOCKER_IMAGE_TAG=$tag" >> "$WORKSPACE/env_docker_inject.txt" |