Closed jostnes closed 1 year ago
@jostnes FYI, given https://github.com/Automattic/a8c-ci-toolkit-buildkite-plugin/pull/58 was recently merged and also updated annotate_test_failures
script, you might want to update your branch to make sure your changes fit nicely on top of those (I don't forsee any conflict, but just to make things clean and avoid any surprise) 🙃
thanks for the review @AliSoftware ! i made the suggested changes and tested with this CI build and locally, it's ready for another review.
though i did notice one thing - the main branches name are different on Tumblr repos. i made this update https://github.com/Automattic/a8c-ci-toolkit-buildkite-plugin/pull/60/commits/f89ed065dfb7e31cd51d5713fa1555ddc55fdc32 to also check if the build is on develop or master. wdyt?
Merging this, the latest changes were tested using this WCiOS build (notification sent, notification not sent) and works as expected.
Description
This PR updates
annotate_test_failures
with the ability to send Slack notification when there are test failures. It is an optional feature and is used by passing a second argument when calling it from project repos (I just realized via this PR when updating to latest trunk that Tumblr also uses this and they might not want the Slack notification to be sent which was the reason I added the second argument).The changes made for this to happen:
update_annotation
to return a JSON object when a failure happensend_slack_notification
to read the JSON object, parse and form the message payload, and send a POST call to the Slack Webhook. For now, it's set specifically to#build-and-ship
channelIn this change, the message displays the repo (to know which app) and step name (to know if it's Unit, UI iPhone or UI iPad, etc), the number of failing test cases, and the names + test classes of failing tests.
Some notes:
Testing
Testing PR: https://github.com/woocommerce/woocommerce-ios/pull/9798
Slack: p1685000034603039-slack-C03Q9FTCQA0
Slack: p1685001564964369-slack-C03Q9FTCQA0
When all test pass (with flaky tests) or one without flaky test here:
When failure not on trunk branch:
When
should_send_slack_notification
is "false":CHANGELOG.md
if necessary.