Skip to content

Commit b01e844

Browse files
committed
Revert "disable test log reporting to flaky-bot"
This reverts commit 03987a4.
1 parent 03987a4 commit b01e844

File tree

4 files changed

+63
-2
lines changed

4 files changed

+63
-2
lines changed

.github/workflows/flakybot.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,26 @@ jobs:
2828
contents: 'read'
2929
id-token: 'write'
3030
steps:
31-
- name: DISABLED run FlakyBot
32-
run: echo flakybot error reporting disabled
31+
- name: authenticate
32+
uses: 'google-github-actions/auth@62cf5bd3e4211a0a0b51f2c6d6a37129d828611d' # v2
33+
with:
34+
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
35+
service_account: '[email protected]'
36+
create_credentials_file: 'true'
37+
access_token_lifetime: 600s
38+
- name: download test results
39+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
40+
with:
41+
name: test-results
42+
- name: download FlakyBot
43+
run: |
44+
curl -s -L https://github.com/googleapis/repo-automation-bots/archive/refs/tags/flakybot-v${{ env.FLAKYBOT_VERSION }}.tar.gz -o flakybot.tar.gz
45+
tar xzf flakybot.tar.gz
46+
cp -rT repo-automation-bots-flakybot-v${{ env.FLAKYBOT_VERSION}}/packages/flakybot/ .
47+
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5
48+
with:
49+
cache: true
50+
cache-dependency-path: '${{ github.workspace }}/go.sum'
51+
go-version-file: '${{ github.workspace }}/go.mod'
52+
- name: run FlakyBot
53+
run: go run flakybot.go --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

.kokoro/build-with-appengine.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,19 @@ trap cleanup EXIT HUP
6161
# Install dependencies and run tests
6262
npm install
6363

64+
# If tests are running against main, configure FlakyBot
65+
# to open issues on failures:
66+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"release"* ]]; then
67+
export MOCHA_REPORTER_SUITENAME=${PROJECT}
68+
notify_flakybot() {
69+
# Call the original trap function.
70+
cleanup
71+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
72+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
73+
}
74+
trap notify_flakybot EXIT HUP
75+
fi
76+
6477
npm test
6578

6679
exit $?

.kokoro/build-with-run.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ export SERVICE_NAME="${SAMPLE_NAME}-${SUFFIX}"
118118
export NODE_ENV=development
119119
npm install
120120

121+
# If tests are running against main, configure FlakyBot
122+
# to open issues on failures:
123+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"release"* ]]; then
124+
export MOCHA_REPORTER_SUITENAME=${PROJECT}
125+
notify_flakybot() {
126+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
127+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
128+
}
129+
trap notify_flakybot EXIT HUP
130+
fi
131+
121132
# Configure Cloud SQL variables for deploying idp-sql sample
122133
export DB_NAME="kokoro_ci"
123134
export DB_USER="kokoro_ci"

.kokoro/build.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,22 @@ print_logfile() {
139139
echo '----- End ${MOCHA_REPORTER_OUTPUT} -----'
140140
}
141141

142+
# If tests are running against main, configure FlakyBot
143+
# to open issues on failures:
144+
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"release"* ]]; then
145+
export MOCHA_REPORTER_SUITENAME=${PROJECT}
146+
cleanup() {
147+
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
148+
$KOKORO_GFILE_DIR/linux_amd64/flakybot
149+
150+
# We can only set one trap per signal, so run `print_logfile` here
151+
print_logfile
152+
}
153+
trap cleanup EXIT HUP
154+
else
155+
trap print_logfile EXIT HUP
156+
fi
157+
142158
npm test
143159

144160
exit $?

0 commit comments

Comments
 (0)