Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(ftr): notify owners in the slack message when failures #205260

Merged
merged 7 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .buildkite/pipeline-utils/test-failures/annotate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,15 @@ export const annotateTestFailures = async () => {
);
}
};

export const pingTeam = async () => {
if (process.env.ELASTIC_SLACK_NOTIFICATIONS_ENABLED === 'true') {
const team = process.env.PING_SLACK_TEAM;
if (team) {
buildkite.setMetadata(
'slack:ping_team:body',
`${team}, can you please take a look at the test failures?`
);
}
}
};
4 changes: 4 additions & 0 deletions .buildkite/pipelines/on_merge_unsupported_ftrs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ steps:
machineType: n2-standard-4
preemptible: true
depends_on: build
env:
PING_SLACK_TEAM: "@obs-ux-infra_services-team"
timeout_in_minutes: 120
retry:
automatic:
Expand All @@ -54,6 +56,8 @@ steps:
machineType: n2-standard-4
preemptible: true
depends_on: build
env:
PING_SLACK_TEAM: "@obs-ux-infra_services-team"
timeout_in_minutes: 120
retry:
automatic:
Expand Down
23 changes: 23 additions & 0 deletions .buildkite/scripts/lifecycle/ping_team_ftrs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { TestFailures } from '#pipeline-utils';

(async () => {
try {
await TestFailures.pingTeam();
} catch (ex) {
console.error('Ping team for the test failures error', ex.message);
if (ex.response) {
console.error('HTTP Error Response Status', ex.response.status);
console.error('HTTP Error Response Body', ex.response.data);
}
process.exit(1);
}
})();
4 changes: 4 additions & 0 deletions .buildkite/scripts/lifecycle/post_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then
buildkite-agent artifact upload 'target/test_failures/**/*'
ts-node .buildkite/scripts/lifecycle/annotate_test_failures.ts
fi

if [ -n "$SLACK_TEAM_FTR" ]; then
ts-node .buildkite/scripts/lifecycle/ping_team_ftrs.ts
fi
fi