From 8ad7f68bd95f2633dbc7ce03ac52d74264157fcf Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Wed, 15 May 2024 18:08:57 +0100 Subject: [PATCH] Add guard against trying to upload non-existant artifacts to GCS (#10677) --- .../terraform/.teamcity/components/builds/build_steps.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mmv1/third_party/terraform/.teamcity/components/builds/build_steps.kt b/mmv1/third_party/terraform/.teamcity/components/builds/build_steps.kt index 68d9aa0a0206..523a7dfb30f0 100644 --- a/mmv1/third_party/terraform/.teamcity/components/builds/build_steps.kt +++ b/mmv1/third_party/terraform/.teamcity/components/builds/build_steps.kt @@ -140,6 +140,12 @@ fun BuildSteps.saveArtifactsToGCS() { #!/bin/bash echo "Post-test step - storge artifacts(debug logs) to GCS" + export TEST_COUNT=${'$'}(./test-binary -test.list="%TEST_PREFIX%" | wc -l) + if test ${'$'}TEST_COUNT -le "0"; then + echo "Skipping upload to GCS; no tests were run, so no artifacts were generated" + exit 0 + fi + # Authenticate gcloud CLI echo "${'$'}{GOOGLE_CREDENTIALS_GCS}" > google-account.json chmod 600 google-account.json