Skip to content

Refactor Slack message construction logic#526

Open
andrewmogan wants to merge 24 commits intodevelopfrom
amogan/refactor_slack_message_builder
Open

Refactor Slack message construction logic#526
andrewmogan wants to merge 24 commits intodevelopfrom
amogan/refactor_slack_message_builder

Conversation

@andrewmogan
Copy link
Collaborator

This PR improves the maintainability of the automated Slack message generation for nightly workflows. The primary motivation is that I found the present implementation difficult to extend when trying to create a new message type for "new release appeared on CVMFS", which is currently done by Cronitor.

The gh api call from slack-notification.yml has been factored into its own script, get_workflow_summary.sh. This script outputs workflow_summary.json, a required input to slack_message_builder.py (renamed from slack_payload_generator.py). Rather than the message builder script take an ever-growing number of command-line arguments, additional workflow summary data, such as release name or location of pytest logs, can now be added during the Add metadata to workflow summary step of the Slack notification workflow.

The slack_message_builder.py script uses the input json summary file to pick a message building strategy. Each message strategy assembles a list of Blocks and writes that data to slack_payload.json. The BaseMessageStrategy serves as a template from which other strategies can build. For example, the IntegrationTestMessageStrategy adds a Block for the location of pytest logs.

Finally, I've removed the XML parsing logic which attempts to summarize the cause of integration test failures. These messages tend to boil down to "there are errors in the log files," which is not incredibly helpful. Failure messages will now simply list the jobs and steps that failed. This also means that the slack-notification.yml workflow no longer takes the junit XML directory as input. If we really want to revive this logic, it should live in the (also newly refactored) integtest_xml_parser.py.

Aside from some minor formatting changes, this should preserve the present functionality. I've tested the relevant workflows in the private #gha-slack-tests channel, which you can see in the screenshot below.

Screenshot 2026-02-06 at 10 52 47 AM

@andrewmogan andrewmogan marked this pull request as ready for review February 6, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant