Skip to content

preflight: Don't put error message when check fails #4803

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

praveenkumar
Copy link
Member

@praveenkumar praveenkumar commented Jun 26, 2025

preflight checks have auto fix functionality (most of them) otherwise Nofix tag make sure it is not fixable automatic so error out. we shouldn't put logging.error for these checks because it shows as part of setup.

Summary by Sourcery

Enhancements:

  • Change preflight check failure logs from error to debug level to hide them from setup output.

Summary by CodeRabbit

  • Style
    • Adjusted error logging to reduce the severity of certain log messages.

preflight checks have auto fix functionality (most of them) otherwise
Nofix tag make sure it is not fixable automatic so error out. we
shouldn't put logging.error for these checks because it shows as part of
setup.
Copy link

sourcery-ai bot commented Jun 26, 2025

Reviewer's Guide

This PR adjusts the logging behavior in the preflight check implementation by downgrading failure log messages from error to debug level to prevent unnecessary error output during setup.

File-Level Changes

Change Details Files
Downgraded logging level for failed preflight checks
  • Replaced logging.Error call with logging.Debug in doCheck
pkg/crc/preflight/preflight.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@openshift-ci openshift-ci bot requested review from albfan and cfergeau June 26, 2025 07:18
Copy link

coderabbitai bot commented Jun 26, 2025

Walkthrough

The logging level for errors encountered during the execution of the check.check() function within the doCheck method was changed from error to debug, affecting only how these messages are logged. No changes were made to the control flow or public interfaces.

Changes

File Change Summary
pkg/crc/preflight/preflight.go Changed error logging from Error to Debug in doCheck method.

Poem

In the warren where logs once cried "Error!",
Now they whisper "Debug" with far less terror.
Hopping through checks, the rabbits agree,
Less noise in the burrow, more clarity!
With gentle paws and a lighter touch,
Our logs now chatter, but not too much.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e267724 and b2df113.

📒 Files selected for processing (1)
  • pkg/crc/preflight/preflight.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: verify-devcontainer
  • GitHub Check: build (ubuntu-latest, 1.23)
  • GitHub Check: build-qe (linux, amd64)
  • GitHub Check: build-qe (windows, amd64)
  • GitHub Check: build (macOS-13, 1.23)
  • GitHub Check: Run OKD bundle with crc (1.23)
  • GitHub Check: build-qe (darwin, amd64)
  • GitHub Check: build (macOS-14, 1.23)
  • GitHub Check: build (ubuntu-latest, 1.23)
  • GitHub Check: build-qe (darwin, arm64)
  • GitHub Check: build-qe (linux, arm64)
  • GitHub Check: build (ubuntu-22.04, 1.23)
  • GitHub Check: build (macOS-13, 1.23)
  • GitHub Check: build (macOS-14, 1.23)
  • GitHub Check: build-installer (windows-2022, 1.23)
  • GitHub Check: build (windows-2022, 1.23)
  • GitHub Check: build (windows-2022, 1.23)
🔇 Additional comments (1)
pkg/crc/preflight/preflight.go (1)

63-68: ```shell
#!/bin/bash
set -e

echo "=== Displaying lines 60-100 of preflight.go ==="
sed -n '60,100p' pkg/crc/preflight/preflight.go


</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACJeEgAzL3giWE5IABF8DAByUO48SEoKfD42REQ0UkgAd1gyRjqGAGtIeO0vRGiatGQHAWZ1Gno5MLrIbERKHiopMibHZ3RkW0gMRwEpgBYADgAGAGYNGDGGWEwqtFpaf3LpUY8Ns4l4Ev546YSklNDT0SbkeBYXBjRCyRA0ZhHACy+HBH0SyVSDT+yCeHkwOAIYHi8AAHq1sBgxC8MGgkrhZAAaGoISKjWEeZjOJpRarqWDoGIAOXwONxXVwlXQ/lW+FCaDwLGo8AYZK88j5KjpmHoDGwFH8GAi8llE3RWCKrwIkA2kC8+CIpHotXqwJICvaR3c424tGoHl4+G4DOQxrQEnw8HoE0BRDNFqIoY0hr48SNdUmyOaMlEEsTdsKGteZQqpGQaG43BIix6PGcoV593sJFw2G403wDGkiGptRlHNQGDFkCUiHgVAEkSdYyI+DJKF9+A+Ui1meKpWblTu8WKzBNJFD4ctUTjfDiCO+Sf+o2orXaJoKzg8XfFkqZ4llPgVeKVJGp8GYnueGDDGYYXmcdR5ErDNJlret8DwfJNGOD1vF8fwghCRgMVNONCXoU9UlwbhEA4AB6fDI2BbABA0JhmHwhgKAYMASiIKiaPw/IfHwnYDg0Ix9GMcAoDIehKwlLFSHIKghgUVh2C4Xh+GEURxCkGQdUUZRVHULQdG4kwoDgVBUAxITCBE5RxIotgtS4KhqnsRwmRcE1lKUAc1E0bRdDAQweNMAxuCaBjqIYZj/APVIgs+RFNFHDgDGiWKDAsSAAEEAEliDIEyogcJx7MrU5zmkNwxnNS1N0iKRfF3OcSmQfxawochhnkDMAANfmacjGiaAAKABKZqCSJcQshQDA+yUKtmtofAAGFOv6thgUUN4Jtmv5+vBChsDEbpkDyn8d1XSBmuKyMfw0ABRLMKH641jojKN0hIARsCIZrh1QZhFHgHE7lAkgpAoICzX+khfFPNtTirGNIBzJcJy3K0anZSDxS8GhAZ/KsmC1YoKvNazXmhs4MFoJJMcef0XgoTj4ssRK0ZMklJyrJR/2caUsmQSsSFxb0KHE158kHGVCi1dR4AKgweXITjYuiLiPK8viSeWwy0tE91VRYcy0ismzsvkEYmCclQXI09zDG0iSBlwAB9INEFt/xnhIao6Ft8FywtpWTQAJloeIAEZA/2BJtk2BgAFZfYYBhfeDwOSAAdkDgA2ABOdOBCudPdk2WhI8j1R05D72DCtsz1Ht2hHediW3doW3+ItoA== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=crc-org/crc&utm_content=4803):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @praveenkumar - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

openshift-ci bot commented Jun 26, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfergeau

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

The pull request process is described here

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

@@ -62,7 +62,7 @@ func (check *Check) doCheck(config crcConfig.Storage) error {

err := check.check()
if err != nil {
logging.Error(err.Error())
logging.Debug(err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

The log level was changed to enhance clarity because of this issue: #4662. The user was complaining that the error message was not clear.

Copy link
Member Author

Choose a reason for hiding this comment

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

This changes all the preflight check, I think port check is non fix so it should automatic go to error side? can you check it once.

Copy link
Contributor

Choose a reason for hiding this comment

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

crc setup --bundle ~/.crc/cache/crc_vfkit_4.18.2_arm64.crcbundle
WARN Using crc_vfkit_4.18.2_arm64.crcbundle bundle, but crc_vfkit_4.19.0_arm64.crcbundle is expected for this release
INFO Using bundle path /Users/gvyas/.crc/cache/crc_vfkit_4.18.2_arm64.crcbundle
INFO Checking if running macOS version >= 13.x
INFO Checking if running as non-root
INFO Checking if crc-admin-helper executable is cached
INFO Checking if running on a supported CPU architecture
INFO Checking if crc executable symlink exists
INFO Checking minimum RAM requirements
INFO Check if Podman binary exists in: /Users/gvyas/.crc/bin/oc
INFO Checking if running emulated on Apple silicon
INFO Checking if vfkit is installed
INFO Checking if CRC bundle is extracted in '$HOME/.crc'
INFO Checking if /Users/gvyas/.crc/cache/crc_vfkit_4.18.2_arm64.crcbundle exists
INFO Checking if old launchd config for tray and/or daemon exists
INFO Checking if crc daemon plist file is present and loaded
INFO Checking SSH port availability
ERRO port 2222 already in use: listen tcp 127.0.0.1:2222: bind: address already in use
ERRO crc requires port 2222 to run SSH

After the change ERRO port 2222 already in use: listen tcp 127.0.0.1:2222: bind: address already in use gets hidden unless log-level is debug

gvyas@Gunjans-MacBook-Pro crc % crc setup --bundle ~/.crc/cache/crc_vfkit_4.18.2_arm64.crcbundle
WARN Using crc_vfkit_4.18.2_arm64.crcbundle bundle, but crc_vfkit_4.19.0_arm64.crcbundle is expected for this release
INFO Using bundle path /Users/gvyas/.crc/cache/crc_vfkit_4.18.2_arm64.crcbundle
INFO Checking if running macOS version >= 13.x
INFO Checking if running as non-root
INFO Checking if crc-admin-helper executable is cached
INFO Checking if running on a supported CPU architecture
INFO Checking if crc executable symlink exists
INFO Checking minimum RAM requirements
INFO Check if Podman binary exists in: /Users/gvyas/.crc/bin/oc
INFO Checking if running emulated on Apple silicon
INFO Checking if vfkit is installed
INFO Checking if CRC bundle is extracted in '$HOME/.crc'
INFO Checking if /Users/gvyas/.crc/cache/crc_vfkit_4.18.2_arm64.crcbundle exists
INFO Checking if old launchd config for tray and/or daemon exists
INFO Checking if crc daemon plist file is present and loaded
INFO Checking SSH port availability
ERRO crc requires port 2222 to run SSH

Copy link
Member Author

Choose a reason for hiding this comment

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

@vyasgun in this case the error message for port is Port 2222 already in use which crc requires to run SSH. I will update that also. For end user listen tcp 127.0.0.1:2222: bind: address already in use doesn't make more sense than just letting them know port which we want to use.

Copy link

openshift-ci bot commented Jun 26, 2025

@praveenkumar: The following test 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-crc b2df113 link true /test e2e-crc

Full PR test history. Your PR dashboard.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants