Skip to content

[ROSAENG-63153] Modify logging to trim trailing newline causing cloudwatch issues. - #1436

Open
Mhodesty wants to merge 1 commit into
openshift:mainfrom
Mhodesty:ROSAENG-63153
Open

[ROSAENG-63153] Modify logging to trim trailing newline causing cloudwatch issues.#1436
Mhodesty wants to merge 1 commit into
openshift:mainfrom
Mhodesty:ROSAENG-63153

Conversation

@Mhodesty

@Mhodesty Mhodesty commented Jul 31, 2026

Copy link
Copy Markdown

Trim a new line character from risk.Message entries that result in an empty line in the logs. This is causing issues for Rosa Log Router because cloudwatch does not allow empty log entries.

Added a string trim and a new test to ensure it works as expected.

Summary by CodeRabbit

  • Bug Fixes
    • Improved risk-related error messages by removing unnecessary surrounding whitespace and trailing blank lines.
    • Ensured error details display cleanly and consistently.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 345af88a-3dd5-4164-8a99-e82d7aa99e28

📥 Commits

Reviewing files that changed from the base of the PR and between 42ff52c and cc297c4.

📒 Files selected for processing (2)
  • pkg/cvo/availableupdates.go
  • pkg/cvo/availableupdates_test.go

Walkthrough

The change trims surrounding whitespace from risk messages in unknownExposureMessage and adds a regression test for trailing newlines.

Changes

Unknown exposure message formatting

Layer / File(s) Summary
Trim and test risk messages
pkg/cvo/availableupdates.go, pkg/cvo/availableupdates_test.go
unknownExposureMessage trims surrounding whitespace from risk.Message. The test verifies that trailing newlines do not create blank lines and that the formatted message matches the expected output.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: wking, hongkailiu

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes trimming trailing newlines from logging to prevent CloudWatch issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The added test is a standard Go test with the static name Test_unknownExposureMessage_trims_trailing_newline; the PR adds no Ginkgo title or dynamic test-name value.
Test Structure And Quality ✅ Passed The added standard Go unit test checks one formatting behavior, uses clear error messages, and creates no cluster resources or waits; it matches the package's testing.T style.
Microshift Test Compatibility ✅ Passed The PR adds a standard Go unit test (Test_unknownExposureMessage_trims_trailing_newline), not a new Ginkgo e2e test, so MicroShift compatibility checks do not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR adds a standard Go unit test (Test_unknownExposureMessage_trims_trailing_newline), not a new Ginkgo e2e test, and it makes no multi-node assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The patch only trims risk-message whitespace and adds a unit test; it modifies no manifests, controllers, or scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The patch changes only pkg/cvo files and adds no process-level stdout writes; the OTE main has no Print or logger calls, and the suite only calls RunSpecs.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds a standard Go unit test, not a Ginkgo e2e test; its example URL is inert data and it adds no IPv4 assumption or external connectivity.
No-Weak-Crypto ✅ Passed The PR only trims risk text and adds a regression test. Its added lines contain no weak-crypto APIs, algorithms, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The PR changes only two Go files; the added lines contain no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or privilege-escalation settings.
No-Sensitive-Data-In-Logs ✅ Passed The PR only trims an existing risk description before formatting; it adds no logging and introduces no passwords, tokens, PII, or customer data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Mhodesty
Once this PR has been reviewed and has the lgtm label, please assign pratikmahajan for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@Mhodesty: 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/e2e-agnostic-ovn-upgrade-into-change cc297c4 link true /test e2e-agnostic-ovn-upgrade-into-change
ci/prow/e2e-agnostic-ovn-techpreview-serial-2of3 cc297c4 link true /test e2e-agnostic-ovn-techpreview-serial-2of3
ci/prow/e2e-hypershift-conformance cc297c4 link true /test e2e-hypershift-conformance
ci/prow/e2e-aws-ovn-techpreview cc297c4 link true /test e2e-aws-ovn-techpreview

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.

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