Skip to content

OCPBUGS-64640: remove environment setup output#1384

Open
dorzel wants to merge 1 commit intoopenshift:mainfrom
dorzel:OCPBUGS-64640
Open

OCPBUGS-64640: remove environment setup output#1384
dorzel wants to merge 1 commit intoopenshift:mainfrom
dorzel:OCPBUGS-64640

Conversation

@dorzel
Copy link
Copy Markdown
Member

@dorzel dorzel commented Apr 6, 2026

Description

Remove unneeded environment setup output. This isn't providing much useful information, and the time between this message and the next is near-instant.

Github / Jira issue: https://redhat.atlassian.net/browse/OCPBUGS-64640

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code Improvements (Refactoring, Performance, CI upgrades, etc)
  • Internal repo assets (diagrams / docs on github repo)
  • This change requires a documentation update on openshift docs

How Has This Been Tested?

  • ran oc-mirror version --v2
  • ran oc-mirror --v2 list releases
  • ran oc-mirror --v2 list operators --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.21
  • ran a small m2d, d2m

Expected Outcome

Output in question is removed.

Summary by CodeRabbit

  • Bug Fixes

    • Added stricter validation for log levels to ensure only valid options (info, debug, trace, error) are accepted.
  • Chores

    • Optimized performance by streamlining command initialization.
    • Improved logging output clarity and sequencing.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Apr 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@dorzel: This pull request references Jira Issue OCPBUGS-64640, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @nidangavali

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

…t subcommands

Description

Skip unnecessary environment setup (umask check, workspace validation, cache dir resolution) for version, list operators, and list releases subcommands. Keep welcome message, log level configuration, and version output for all subcommands

Github / Jira issue: https://redhat.atlassian.net/browse/OCPBUGS-64640

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code Improvements (Refactoring, Performance, CI upgrades, etc)
  • Internal repo assets (diagrams / docs on github repo)
  • This change requires a documentation update on openshift docs

How Has This Been Tested?

  • ran oc-mirror version --v2
  • ran oc-mirror --v2 list releases
  • ran oc-mirror --v2 list operators --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.21
  • ran a small m2d, d2m

Expected Outcome

Output in question does not exist for version and list subcommands. Continues to exist for all other commands.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot requested a review from nidangavali April 6, 2026 17:33
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 6, 2026

Warning

Rate limit exceeded

@dorzel has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 36 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c000574f-6897-41a4-b5ae-48f0a8b114b4

📥 Commits

Reviewing files that changed from the base of the PR and between 83b2828 and 88f9c31.

📒 Files selected for processing (1)
  • internal/pkg/cli/executor.go

Walkthrough

Reorders the mirror command's PersistentPreRunE to log a welcome message early, validate and apply the requested log level, add a gating path to skip environment setup for certain subcommands, and move/remove related environment log lines accordingly. (≤50 words)

Changes

Command Execution Hook Restructuring

Layer / File(s) Summary
Data / Inputs
internal/pkg/cli/executor.go
Introduces reading/validation of the log-level option and a greeting log line.
Control Flow / Validation
internal/pkg/cli/executor.go
Adds validation that log level is one of info, debug, trace, or error, and applies it via ex.Log.Level(ex.Opts.Global.LogLevel).
Gating / Early-return
internal/pkg/cli/executor.go
Adds conditional path to bypass environment setup for specific subcommands (e.g., version, list).
Logging / Repositioning
internal/pkg/cli/executor.go
Removes prior setting up the environment log, adds welcome log, and moves the environment-version log to occur after validation/gating.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title mentions 'remove environment setup output' but the actual change skips environment setup for specific subcommands while preserving logs for all. The title is partially related but incomplete. Consider revising the title to more accurately reflect that environment setup is skipped conditionally for specific subcommands (version/list), not entirely removed.
✅ Passed checks (11 passed)
Check name Status Explanation
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 Not applicable. Repository uses standard Go testing (func Test pattern), not Ginkgo. No Ginkgo test syntax found in codebase.
Test Structure And Quality ✅ Passed PR modifies CLI code in executor.go, not Ginkgo tests. executor_test.go uses standard Go testing (*testing.T), not Ginkgo. Of 94 test files in repo, only 1 uses Ginkgo. Check is not applicable.
Microshift Test Compatibility ✅ Passed PR modifies CLI executor code only (executor.go), not e2e tests. No Ginkgo test code (It(), Describe(), etc.) or new test files added. Check for MicroShift test compatibility is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR contains no new Ginkgo e2e tests. SNO check applies only to Ginkgo tests. This PR modifies CLI executor logic using standard Go unit tests, not subject to SNO checking.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only CLI code (executor.go). Check targets deployment manifests, operators, and controllers—none present in this PR.
Ote Binary Stdout Contract ✅ Passed Logging in PersistentPreRunE uses PluggableLogger (wrapping simple.Logger) which writes to stderr. No unredirected klog or direct stdout writes found in process-level code. OTE contract preserved.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR modifies only internal/pkg/cli/executor.go (main CLI code). The custom check applies only to new Ginkgo e2e tests. No Ginkgo tests are added and the framework is not used in this codebase.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@openshift-ci openshift-ci Bot requested review from adolfo-ab and aguidirh April 6, 2026 17:33
@dorzel
Copy link
Copy Markdown
Member Author

dorzel commented Apr 6, 2026

/retest

Comment thread internal/pkg/cli/executor.go Outdated
@r4f4
Copy link
Copy Markdown
Contributor

r4f4 commented Apr 8, 2026

What is the benefit of doing this?

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 6, 2026
@dorzel dorzel changed the title OCPBUGS-64640: skip unnecessary environment setup for version and lis… OCPBUGS-64640: remove environment setup output May 6, 2026
@openshift-ci-robot openshift-ci-robot added jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. and removed jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels May 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@dorzel: This pull request references Jira Issue OCPBUGS-64640, which is invalid:

  • expected the bug to target either version "5.0." or "openshift-5.0.", but it targets "4.22" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Description

Remove unneeded environment setup output. This isn't providing much useful information, and the time between this message and the next is near-instant.

Github / Jira issue: https://redhat.atlassian.net/browse/OCPBUGS-64640

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code Improvements (Refactoring, Performance, CI upgrades, etc)
  • Internal repo assets (diagrams / docs on github repo)
  • This change requires a documentation update on openshift docs

How Has This Been Tested?

  • ran oc-mirror version --v2
  • ran oc-mirror --v2 list releases
  • ran oc-mirror --v2 list operators --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.21
  • ran a small m2d, d2m

Expected Outcome

Output in question is removed.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 6, 2026
@dorzel
Copy link
Copy Markdown
Member Author

dorzel commented May 6, 2026

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@dorzel: This pull request references Jira Issue OCPBUGS-64640, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @nidangavali

Details

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@dorzel
Copy link
Copy Markdown
Member Author

dorzel commented May 6, 2026

After some discussion, switched this to instead just removing the environment setup output line.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 6, 2026

@dorzel: all tests passed!

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.

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 7, 2026
@nidangavali
Copy link
Copy Markdown

/verified by @nidangavali

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label May 7, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@nidangavali: This PR has been marked as verified by @nidangavali.

Details

In response to this:

/verified by @nidangavali

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented May 7, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aguidirh, dorzel, nidangavali

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

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. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants