diff --git a/.kokoro/build-with-run.sh b/.kokoro/build-with-run.sh index 949ac6d253..b8a6716b6e 100755 --- a/.kokoro/build-with-run.sh +++ b/.kokoro/build-with-run.sh @@ -33,7 +33,9 @@ gcloud config set project $GOOGLE_CLOUD_PROJECT # to run them concurrently. export SAMPLE_VERSION="${KOKORO_GIT_COMMIT:-latest}" export SAMPLE_NAME="$(basename $(pwd))" -export SERVICE_NAME="${SAMPLE_NAME}-${KOKORO_GITHUB_PULL_REQUEST_NUMBER}" +# Builds not triggered by a PR will fall back to the commit hash then "latest". +SUFFIX=${KOKORO_GITHUB_PULL_REQUEST_NUMBER:-${SAMPLE_VERSION:0:12}} +export SERVICE_NAME="${SAMPLE_NAME}-${SUFFIX}" export CONTAINER_IMAGE="gcr.io/${GOOGLE_CLOUD_PROJECT}/run-${SAMPLE_NAME}:${SAMPLE_VERSION}" # Register post-test cleanup.