File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 : ' kokoro-system-test@long-door-651.iam.gserviceaccount.com'
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}}
Original file line number Diff line number Diff line change @@ -61,6 +61,19 @@ trap cleanup EXIT HUP
6161# Install dependencies and run tests
6262npm 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+
6477npm test
6578
6679exit $?
Original file line number Diff line number Diff line change @@ -118,6 +118,17 @@ export SERVICE_NAME="${SAMPLE_NAME}-${SUFFIX}"
118118export NODE_ENV=development
119119npm 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
122133export DB_NAME=" kokoro_ci"
123134export DB_USER=" kokoro_ci"
Original file line number Diff line number Diff 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+
142158npm test
143159
144160exit $?
You can’t perform that action at this time.
0 commit comments