From 8a792c33674b4c18930e5d0c874c864cc702bc21 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Thu, 23 Jul 2020 12:41:45 -0700 Subject: [PATCH] buildscripts: Fix check for java-example-hostname:latest tagging The previous 'git ls-remote' was returning the tag-referenced commits via vF.O.O^{} which was confusing the version check (as v1.30.0 would not match v1.30.0^{}). Passing --refs filters those ^{} tags. There was also a missing 'v' in the version check. It was added explicitly to generate the list but not to check the result. --- buildscripts/kokoro/upload_artifacts.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildscripts/kokoro/upload_artifacts.sh b/buildscripts/kokoro/upload_artifacts.sh index c56cddf8f8..45e49d1e36 100644 --- a/buildscripts/kokoro/upload_artifacts.sh +++ b/buildscripts/kokoro/upload_artifacts.sh @@ -73,7 +73,7 @@ fi VERSION="$(cat $LOCAL_OTHER_ARTIFACTS/version)" EXAMPLE_HOSTNAME_ID="$(cat "$LOCAL_OTHER_ARTIFACTS/example-hostname.id")" docker load --input "$LOCAL_OTHER_ARTIFACTS/example-hostname.tar" -LATEST_VERSION="$((echo "v$VERSION"; git ls-remote -t https://github.com/grpc/grpc-java.git | cut -f 2 | sed s#refs/tags/##) | sort -V | tail -n 1)" +LATEST_VERSION="$((echo "v$VERSION"; git ls-remote -t --refs https://github.com/grpc/grpc-java.git | cut -f 2 | sed s#refs/tags/##) | sort -V | tail -n 1)" STAGING_REPO=a93898609ef848 @@ -81,7 +81,7 @@ STAGING_REPO=a93898609ef848 docker tag "$EXAMPLE_HOSTNAME_ID" "grpc/java-example-hostname:${VERSION}" docker push "grpc/java-example-hostname:${VERSION}" -if [[ "$VERSION" = "$LATEST_VERSION" ]]; then +if [[ "v$VERSION" = "$LATEST_VERSION" ]]; then docker tag "$EXAMPLE_HOSTNAME_ID" grpc/java-example-hostname:latest docker push grpc/java-example-hostname:latest fi