[buildkite] Fix off-by-one problem for test failure annotations (#113852)

This commit is contained in:
Brian Seeders 2021-10-04 19:29:43 -04:00 committed by GitHub
parent 55bd942a1f
commit fc89528c40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,6 +76,12 @@ export function reportFailuresToFile(log: ToolingLog, failures: TestFailure[]) {
.flat()
.join('\n');
// Buildkite steps that use `parallelism` need a numerical suffix added to identify them
// We should also increment the number by one, since it's 0-based
const jobNumberSuffix = process.env.BUILDKITE_PARALLEL_JOB
? ` #${parseInt(process.env.BUILDKITE_PARALLEL_JOB, 10) + 1}`
: '';
const failureJSON = JSON.stringify(
{
...failure,
@ -84,9 +90,7 @@ export function reportFailuresToFile(log: ToolingLog, failures: TestFailure[]) {
jobId: process.env.BUILDKITE_JOB_ID || '',
url: process.env.BUILDKITE_BUILD_URL || '',
jobName: process.env.BUILDKITE_LABEL
? `${process.env.BUILDKITE_LABEL}${
process.env.BUILDKITE_PARALLEL_JOB ? ` #${process.env.BUILDKITE_PARALLEL_JOB}` : ''
}`
? `${process.env.BUILDKITE_LABEL}${jobNumberSuffix}`
: '',
},
null,