[CI] [Buildkite] Only report test failures for hourly/daily pipelines (#112729)

This commit is contained in:
Brian Seeders 2021-09-21 17:26:36 -04:00 committed by GitHub
parent 7d8d89f50d
commit e67a25c8b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View file

@ -1,3 +1,5 @@
env:
REPORT_FAILED_TESTS_TO_GITHUB: 'true'
steps:
- command: .buildkite/scripts/lifecycle/pre_build.sh
label: Pre-Build

View file

@ -37,17 +37,24 @@ export function runFailedTestsReporterCli() {
}
if (updateGithub) {
let branch: string | undefined = '';
let branch: string = '';
let isPr = false;
if (process.env.BUILDKITE === 'true') {
branch = process.env.BUILDKITE_BRANCH;
branch = process.env.BUILDKITE_BRANCH || '';
isPr = process.env.BUILDKITE_PULL_REQUEST === 'true';
updateGithub = process.env.REPORT_FAILED_TESTS_TO_GITHUB === 'true';
} else {
// JOB_NAME is formatted as `elastic+kibana+7.x` in some places and `elastic+kibana+7.x/JOB=kibana-intake,node=immutable` in others
const jobNameSplit = (process.env.JOB_NAME || '').split(/\+|\//);
branch = jobNameSplit.length >= 3 ? jobNameSplit[2] : process.env.GIT_BRANCH;
branch = jobNameSplit.length >= 3 ? jobNameSplit[2] : process.env.GIT_BRANCH || '';
isPr = !!process.env.ghprbPullId;
const isMasterOrVersion = branch === 'master' || branch.match(/^\d+\.(x|\d+)$/);
if (!isMasterOrVersion || isPr) {
log.info('Failure issues only created on master/version branch jobs');
updateGithub = false;
}
}
if (!branch) {
@ -55,12 +62,6 @@ export function runFailedTestsReporterCli() {
'Unable to determine originating branch from job name or other environment variables'
);
}
const isMasterOrVersion = branch === 'master' || branch.match(/^\d+\.(x|\d+)$/);
if (!isMasterOrVersion || isPr) {
log.info('Failure issues only created on master/version branch jobs');
updateGithub = false;
}
}
const githubApi = new GithubApi({