From f64ebeab8c320471fa200d3624ad3813389cd865 Mon Sep 17 00:00:00 2001 From: Tyler Bui-Palsulich Date: Wed, 5 Feb 2020 11:27:41 -0500 Subject: [PATCH 1/3] .kokoro: publish test log to Build Cop Bot The Build Cop Bot will open/close issues for failing/passing tests. --- .kokoro/tests/run_tests.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.kokoro/tests/run_tests.sh b/.kokoro/tests/run_tests.sh index d29aae6e05e..577ba412f4c 100755 --- a/.kokoro/tests/run_tests.sh +++ b/.kokoro/tests/run_tests.sh @@ -90,6 +90,33 @@ for file in **/requirements.txt; do nox -s "$RUN_TESTS_SESSION" EXIT=$? + # If we're running system tests, send the test log to the Build Cop Bot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. + if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"system-tests"* ]]; then + # Use the service account with access to the repo-automation-bots project. + gcloud auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS + gcloud config set project repo-automation-bots + + XML=$(base64 -w 0 sponge_log.xml) + + # See https://github.com/apps/build-cop-bot/installations/5943459. + MESSAGE=$(cat < Date: Wed, 5 Feb 2020 13:02:18 -0500 Subject: [PATCH 2/3] .kokoro: switch Build Cop build to continuous --- .kokoro/tests/run_tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kokoro/tests/run_tests.sh b/.kokoro/tests/run_tests.sh index 577ba412f4c..de6c9e600a8 100755 --- a/.kokoro/tests/run_tests.sh +++ b/.kokoro/tests/run_tests.sh @@ -90,9 +90,9 @@ for file in **/requirements.txt; do nox -s "$RUN_TESTS_SESSION" EXIT=$? - # If we're running system tests, send the test log to the Build Cop Bot. + # If this is a continuous build, send the test log to the Build Cop Bot. # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. - if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"system-tests"* ]]; then + if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then # Use the service account with access to the repo-automation-bots project. gcloud auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS gcloud config set project repo-automation-bots From f707ca8d8db89a44e16cf77b436783ba1832ee05 Mon Sep 17 00:00:00 2001 From: Tyler Bui-Palsulich Date: Fri, 7 Feb 2020 10:38:46 -0500 Subject: [PATCH 3/3] .kokoro: use gcloud --project flag --- .kokoro/tests/run_tests.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.kokoro/tests/run_tests.sh b/.kokoro/tests/run_tests.sh index fc6170efa5c..13dc27d70ad 100755 --- a/.kokoro/tests/run_tests.sh +++ b/.kokoro/tests/run_tests.sh @@ -103,10 +103,6 @@ for file in **/requirements.txt; do # If this is a continuous build, send the test log to the Build Cop Bot. # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then - # Use the service account with access to the repo-automation-bots project. - gcloud auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS - gcloud config set project repo-automation-bots - XML=$(base64 -w 0 sponge_log.xml) # See https://github.com/apps/build-cop-bot/installations/5943459. @@ -124,7 +120,9 @@ for file in **/requirements.txt; do EOF ) - gcloud pubsub topics publish passthrough --message="$MESSAGE" + # Use a service account with access to the repo-automation-bots project. + gcloud auth activate-service-account --key-file $GOOGLE_APPLICATION_CREDENTIALS + gcloud pubsub topics publish passthrough --project=repo-automation-bots --message="$MESSAGE" fi if [[ $EXIT -ne 0 ]]; then