From c3c810f5c3b5c3dbd5a4fbe7092dc5ec780cee73 Mon Sep 17 00:00:00 2001 From: Spencer Fang Date: Thu, 16 Aug 2018 12:12:52 -0700 Subject: [PATCH] buildscripts: Make kokoro script runnable from workstation - Only cat /VERSION if it exists - The host name is used as the version name, and if running locally the versions no longer necessarily start with 'kokoro'. Update the clean up command. --- buildscripts/kokoro/gae-interop.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/buildscripts/kokoro/gae-interop.sh b/buildscripts/kokoro/gae-interop.sh index 29697130bd..feb3c5c5a8 100755 --- a/buildscripts/kokoro/gae-interop.sh +++ b/buildscripts/kokoro/gae-interop.sh @@ -1,7 +1,9 @@ #!/bin/bash set -exu -o pipefail -cat /VERSION +if [[ -f /VERSION ]]; then + cat /VERSION +fi KOKORO_GAE_SERVICE="java-gae-interop-test" @@ -20,7 +22,8 @@ function cleanup() { } trap cleanup SIGHUP SIGINT SIGTERM EXIT -cd ./github/grpc-java +readonly GRPC_JAVA_DIR="$(cd "$(dirname "$0")"/../.. && pwd)" +cd "$GRPC_JAVA_DIR" ## ## Deploy the dummy 'default' version of the service @@ -47,8 +50,8 @@ set +e echo "Cleaning out stale deploys from previous runs, it is ok if this part fails" # Sometimes the trap based cleanup fails. -# Delete all versions whose name starts with 'kokoro' and is older than 1 hour. +# Delete all versions whose name is not 'dummy-default' and is older than 1 hour. # This expression is an ISO8601 relative date: # https://cloud.google.com/sdk/gcloud/reference/topic/datetimes -gcloud app versions list --format="get(version.id)" --filter="service=$KOKORO_GAE_SERVICE AND version : 'kokoro*' AND version.createTime<'-p1h'" | xargs -i gcloud app services delete $KOKORO_GAE_SERVICE --version {} --quiet +gcloud app versions list --format="get(version.id)" --filter="service=$KOKORO_GAE_SERVICE AND NOT version : 'dummy-default' AND version.createTime<'-p1h'" | xargs -i gcloud app services delete "$KOKORO_GAE_SERVICE" --version {} --quiet exit 0