Skip to content

Commit

Permalink
use env variable to ping the slack team
Browse files Browse the repository at this point in the history
Apply suggestions from code review

rename
  • Loading branch information
v1v committed Dec 30, 2024
1 parent 4f0069c commit d30ec5f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 29 deletions.
15 changes: 7 additions & 8 deletions .buildkite/pipeline-utils/test-failures/annotate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,12 @@ export const annotateTestFailures = async () => {

export const pingTeam = async () => {
if (process.env.ELASTIC_SLACK_NOTIFICATIONS_ENABLED === 'true') {
const reportSlackDir = 'target/report-slack-team';
const team: string =
recursiveReadDir(reportSlackDir).find((file) => file.endsWith('.slack')) || '';

buildkite.setMetadata(
'slack:ping_team:body',
`@${team}, can you please take a look at the test failures?`
);
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
1 change: 0 additions & 1 deletion .buildkite/scripts/common/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export CI=true
KIBANA_DIR=$(pwd)
export KIBANA_DIR
export XPACK_DIR="$KIBANA_DIR/x-pack"
export REPORT_SLACK_TEAM="target/report-slack-team"

export CACHE_DIR="$HOME/.kibana"
export ES_CACHE_DIR="$HOME/.es-snapshot-cache"
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/lifecycle/post_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then
ts-node .buildkite/scripts/lifecycle/annotate_test_failures.ts
fi

if [[ -d "${REPORT_SLACK_TEAM}" ]]; then
if [ -n "$SLACK_TEAM_FTR" ]; then
ts-node .buildkite/scripts/lifecycle/ping_team_ftrs.ts
fi
fi
13 changes: 3 additions & 10 deletions .buildkite/scripts/steps/functional/apm_cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,8 @@ fi

echo "--- APM Cypress Tests"

pushd "$XPACK_DIR"
cd "$XPACK_DIR"

if ! node solutions/observability/plugins/apm/scripts/test/e2e.js \
node solutions/observability/plugins/apm/scripts/test/e2e.js \
--kibana-install-dir "$KIBANA_BUILD_LOCATION" \
$CYPRESS_ARGS ; then

# Report the error to the team using the subfolder matching the Slack Team
popd
mkdir "$REPORT_SLACK_TEAM"
touch "$REPORT_SLACK_TEAM"/obs-ux-infra_services-team.slack
exit 1
fi
$CYPRESS_ARGS
12 changes: 3 additions & 9 deletions .buildkite/scripts/steps/functional/profiling_cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ export JOB=kibana-profiling-cypress

echo "--- Profiling Cypress Tests"

pushd "$XPACK_DIR"
cd "$XPACK_DIR"

if ! NODE_OPTIONS=--openssl-legacy-provider node solutions/observability/plugins/profiling/scripts/test/e2e.js \
--kibana-install-dir "$KIBANA_BUILD_LOCATION" ; then
# Report the error to the team using the subfolder matching the Slack Team
popd
mkdir "$REPORT_SLACK_TEAM"
touch "$REPORT_SLACK_TEAM"/obs-ux-infra_services-team.slack
exit 1
fi
NODE_OPTIONS=--openssl-legacy-provider node solutions/observability/plugins/profiling/scripts/test/e2e.js \
--kibana-install-dir "$KIBANA_BUILD_LOCATION" \

0 comments on commit d30ec5f

Please sign in to comment.