-
Notifications
You must be signed in to change notification settings - Fork 127
[SDCICD-1704] enhance Slack notifications with metadata and smart truncation #3065
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
base: main
Are you sure you want to change the base?
[SDCICD-1704] enhance Slack notifications with metadata and smart truncation #3065
Conversation
|
Skipping CI for Draft Pull Request. |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
3203c80 to
43741a3
Compare
f6c412b to
4511f85
Compare
4511f85 to
c097cae
Compare
c097cae to
1431a1b
Compare
0ff3b4e to
508a98b
Compare
pkg/common/aws/iam.go
Outdated
| errorBuilder.WriteString(errorMsg) | ||
| } | ||
| return fmt.Errorf("%s", errorMsg) | ||
| return errors.New(errorMsg) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
Could you please post a link to a sample slack thread created from this code? |
|
PR needs rebase. DetailsInstructions 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 != "" { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way we can compose tekton URL here instead? that would be quite important for the PD jobs.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
508a98b to
c1b53ff
Compare
|
@christophermancini: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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) |
There was a problem hiding this comment.
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).
[SDCICD-1704] enhance Slack notifications with metadata and smart truncation
up to 3 [FAILED] blocks with 35 lines of context