From ccfc025593f9ff819fd8d5e6dc5e4068ec8467f3 Mon Sep 17 00:00:00 2001 From: john30 Date: Sun, 17 Jan 2021 18:15:29 +0100 Subject: [PATCH] support latest tag --- contrib/docker/hooks/post_push | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/contrib/docker/hooks/post_push b/contrib/docker/hooks/post_push index 1d1dffd3..aee9475d 100755 --- a/contrib/docker/hooks/post_push +++ b/contrib/docker/hooks/post_push @@ -1,10 +1,21 @@ #!/bin/bash curl -sLo manifest-tool "https://github.com/estesp/manifest-tool/releases/download/v1.0.3/manifest-tool-linux-amd64" chmod +x manifest-tool -sed -e "s#%image_name%#${IMAGE_NAME%%-*}#" manifest.template > manifest.yaml +image_name="${IMAGE_NAME%%-*}" set +e +sed -e "s#%image_name%#${image_name}#" manifest.template > manifest.yaml ./manifest-tool push from-spec manifest.yaml if [ $? -ne 0 ]; then echo "manifest failed, post_push step ignored" exit 0 fi +latest +if [ "${image_name##*:v}" != "$image_name" ]; then + latest="${image_name%%:v*}:latest" + sed -e "s#%image_name%#${latest}#" manifest.template > manifest.yaml + ./manifest-tool push from-spec manifest.yaml + if [ $? -ne 0 ]; then + echo "manifest failed for latest, post_push step ignored" + exit 0 + fi +fi