Skip to content

Commit

Permalink
[CI] [Buildkite] Only report test failures for hourly/daily pipelines (
Browse files Browse the repository at this point in the history
…#112729) (#112752)

Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
  • Loading branch information
kibanamachine and brianseeders authored Sep 21, 2021
1 parent 1190eb0 commit 1036718
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .buildkite/pipelines/hourly.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
env:
REPORT_FAILED_TESTS_TO_GITHUB: 'true'
steps:
- command: .buildkite/scripts/lifecycle/pre_build.sh
label: Pre-Build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,31 @@ 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) {
throw createFailError(
'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({
Expand Down

0 comments on commit 1036718

Please sign in to comment.