summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorDenes Nemeth <denes.nemeth@nokia.com>2018-05-12 09:40:20 +0200
committerJessica Wagantall <jwagantall@linuxfoundation.org>2018-05-15 18:28:52 +0000
commit801d2a6ff0044cc64b937f9ecd19e08f1eaed801 (patch)
tree44adbacb67587fe09d220c3bf966adc7d38c3579 /shell
parent93fa5d34af606c3c0c04b0b2b3aaf07454e0c71d (diff)
Tag docker images with latest tag too
Change-Id: Ic9c47ab3792db1cd52f2a11d94d2d4414aef507b Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com> Issue-ID: VFC-728
Diffstat (limited to 'shell')
-rw-r--r--shell/docker-build.sh17
-rw-r--r--shell/docker-push.sh1
2 files changed, 13 insertions, 5 deletions
diff --git a/shell/docker-build.sh b/shell/docker-build.sh
index 79907845d..080a8b638 100644
--- a/shell/docker-build.sh
+++ b/shell/docker-build.sh
@@ -7,11 +7,15 @@ FULL_DATE=`date +'%Y%m%dT%H%M%S'`
IMAGE_VERSION=`xmlstarlet sel -N "x=http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:version" pom.xml | cut -c1-5`
case "$DOCKERREGISTRY" in
- "$DOCKER_REGISTRY:10004") DOCKER_TAG="$IMAGE_VERSION"-STAGING-"$FULL_DATE"Z
- echo "Using tag $DOCKER_TAG"
+ "$DOCKER_REGISTRY:10004")
+ DOCKER_TAG="$IMAGE_VERSION"-STAGING-"$FULL_DATE"Z
+ DOCKER_LATEST_TAG="$IMAGE_VERSION"-STAGING-latest
+ echo "Using tags $DOCKER_TAG and $DOCKER_LATEST_TAG"
;;
- "$DOCKER_REGISTRY:10003") DOCKER_TAG="$IMAGE_VERSION"-SNAPSHOT-"$FULL_DATE"Z
- echo "Using tag $DOCKER_TAG"
+ "$DOCKER_REGISTRY:10003")
+ DOCKER_TAG="$IMAGE_VERSION"-SNAPSHOT-"$FULL_DATE"Z
+ DOCKER_LATEST_TAG="$IMAGE_VERSION"-SNAPSHOT-latest
+ echo "Using tags $DOCKER_TAG and $DOCKER_LATEST_TAG"
;;
esac
@@ -21,14 +25,17 @@ cd "$DOCKER_ROOT"
# DOCKERREGISTRY is purposely not using an '_' so as to not conflict with the
# Jenkins global env var of the DOCKER_REGISTRY which the docker-login step uses
IMAGE_NAME="$DOCKERREGISTRY/$DOCKER_NAME:$DOCKER_TAG"
+IMAGE_NAME_LATEST="$DOCKERREGISTRY/$DOCKER_NAME:$DOCKER_LATEST_TAG"
# Build the docker image
# Allow word splitting
# shellcheck disable=SC2086
-docker build $DOCKER_ARGS . -t $IMAGE_NAME | tee "$WORKSPACE/docker_build_log.txt"
+docker build $DOCKER_ARGS . -t $IMAGE_NAME -t $IMAGE_NAME_LATEST | tee "$WORKSPACE/docker_build_log.txt"
# Write DOCKER_IMAGE information to a file so it can be injected into the
# environment for following steps
echo "DOCKER_IMAGE=$IMAGE_NAME" >> "$WORKSPACE/env_inject.txt"
+echo "DOCKER_IMAGE_LATEST=$IMAGE_NAME_LATEST" >> "$WORKSPACE/env_inject.txt"
+
diff --git a/shell/docker-push.sh b/shell/docker-push.sh
index 68b2bdb95..937a01ab3 100644
--- a/shell/docker-push.sh
+++ b/shell/docker-push.sh
@@ -4,3 +4,4 @@ set -e -o pipefail
# Push our image to wherever it's defined to go by the name
docker push "$DOCKER_IMAGE"
+docker push "$DOCKER_IMAGE_LATEST"