Skip to content

Conversation

@christophermancini
Copy link

@christophermancini christophermancini commented Dec 10, 2025

[SDCICD-1704] enhance Slack notifications with metadata and smart truncation

  • Added Cluster ID and Expiration timestamp to Slack notifications
  • Implemented smart log truncation: preserves first/last lines and extracts
    up to 3 [FAILED] blocks with 35 lines of context
  • Added automatic Prow job URL generation based on environment variables
  • Enhanced Slack client to support file uploads to threads using bot tokens
  • Added comprehensive unit tests and real-world Prow log fixtures
  • Cleaned up linting errors and improved integration test skip logic

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 10, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 10, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christophermancini

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 10, 2025
@christophermancini christophermancini marked this pull request as ready for review January 8, 2026 21:20
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 8, 2026
@openshift-ci openshift-ci bot requested review from minlei98 and ritmun January 8, 2026 21:20
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 8, 2026
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 8, 2026
@christophermancini christophermancini force-pushed the cm/cluster-info branch 2 times, most recently from f6c412b to 4511f85 Compare January 8, 2026 22:33
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 19, 2026
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 19, 2026
@christophermancini christophermancini force-pushed the cm/cluster-info branch 2 times, most recently from 0ff3b4e to 508a98b Compare January 19, 2026 16:50
@christophermancini christophermancini changed the title [SDCICD-1704] add cluster id and expiration to message [SDCICD-1704] enhance Slack notifications with metadata and smart truncation Jan 19, 2026
errorBuilder.WriteString(errorMsg)
}
return fmt.Errorf("%s", errorMsg)
return errors.New(errorMsg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason to touch this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the format wasn't actually applying a format so it was unnecessary. It is a small and likely negligible performance improvement.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you describe further how it wasn't applying the format? We use this pattern extensively throughout the code to return error objects, so this would be an unnecessary file touch to the PR and also oddity from the pattern.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was flagged by static analysis while running it locally. I will double check whether or not CICD configuration flags it, if not, I can remove it from this PR.

Here is the rule that is violated: https://staticcheck.dev/docs/checks#S1025

@ritmun
Copy link
Contributor

ritmun commented Jan 22, 2026

Could you please post a link to a sample slack thread created from this code?

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 22, 2026
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

text := ""

// Add Prow job link if available
if prowURL := s.buildProwJobURL(config); prowURL != "" {
Copy link
Contributor

@ritmun ritmun Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prow jobs runs on their own schedule and teams are not expecting any new failure notifications outside of their own CICD pipelines.

So, we're not enabling individual test suite notifications for prow jobs so this code is not necessary right now.

Copy link
Contributor

@ritmun ritmun Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg/e2e/e2e.go Outdated
// Get cluster expiration timestamp
clusterExpiration := ""
if o.provider != nil {
if cluster, err := o.provider.GetCluster(viper.GetString(config.Cluster.ID)); err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable 'cluster' collides with imported package name

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch! will fix.

…mart log extraction

This commit adds cluster info to notifications, implements a failure-aware
log truncation strategy, and enables rich file attachments via the Slack API.
Includes comprehensive unit tests and improved local test reliability.
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 22, 2026

@christophermancini: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/code-quality-checks c1b53ff link true /test code-quality-checks
ci/prow/hypershift-pr-check c1b53ff link true /test hypershift-pr-check

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.


// If we have bot token, use chat.postMessage with file attachments
if hasBotToken && botToken != "" && hasChannel && channel != "" && hasReportDir && reportDir != "" {
logFiles := s.collectLogFiles(reportDir)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may introduce a large number of additional files, especially for framework-level log analysis. For example, see the contents of the report directory here.

Something to keep in mind. In the future, we may want to filter this down to only the required files (e.g., test_output.log).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants