Skip to content

ROX-20811: Roxctl central generate pvc bug#14312

Merged
jschnath merged 6 commits intomasterfrom
jschnath/ROX-20811_roxctl_central_generate_pvc_bug
Feb 19, 2025
Merged

ROX-20811: Roxctl central generate pvc bug#14312
jschnath merged 6 commits intomasterfrom
jschnath/ROX-20811_roxctl_central_generate_pvc_bug

Conversation

@jschnath
Copy link
Copy Markdown
Contributor

Description

The OutputZip() function in roxctl does not actually always output a zip file to stdout, even though it says that it does. However making it always do this could now pose a problem for existing docker setups using the logic of roxctl central generate k8s pvc where is puts the output into an output path iff ROX_ROXCTL_IN_MAIN_IMAGE is unset.

But the output path is populated by default so checking if that's unset does not work. I propose fixing this problem by checking if we are running inside a docker container, and always outputting the zip to STDOUT if we are not. That way the behavior of roxctl central generate k8s pvc matches its description.

Alternative idea: Change the description of roxctl central generate k8s pvc and explain that it only prints the output to STDOUT if ROX_ROXCTL_IN_MAIN_IMAGE is set, but I think that is the worse approach.

User-facing documentation

  • CHANGELOG is updated OR update is not needed
  • documentation PR is created and is linked above OR is not needed

Testing and quality

  • the change is production ready: the change is GA or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

Locally ran roxctl central generate k8s pvc > pvc.zip and then file pvc.zip confirming the file was not empty.

@jschnath jschnath requested a review from a team as a code owner February 17, 2025 16:14
@jschnath jschnath requested a review from janisz February 17, 2025 16:14
@rhacs-bot
Copy link
Copy Markdown
Contributor

rhacs-bot commented Feb 17, 2025

Images are ready for the commit at 4795317.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.8.x-34-g4795317113.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 64.70588% with 6 lines in your changes missing coverage. Please review.

Project coverage is 49.04%. Comparing base (177bdd2) to head (4795317).
Report is 23 commits behind head on master.

Files with missing lines Patch % Lines
pkg/containers/detection.go 62.50% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #14312   +/-   ##
=======================================
  Coverage   49.04%   49.04%           
=======================================
  Files        2514     2516    +2     
  Lines      182854   182868   +14     
=======================================
+ Hits        89680    89688    +8     
- Misses      86051    86057    +6     
  Partials     7123     7123           
Flag Coverage Δ
go-unit-tests 49.04% <64.70%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jschnath
Copy link
Copy Markdown
Contributor Author

/retest

@jschnath jschnath requested a review from janisz February 18, 2025 08:42
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Feb 18, 2025

@jschnath: 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/ocp-4-12-scanner-v4-install-tests 4795317 link false /test ocp-4-12-scanner-v4-install-tests

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.

@jschnath jschnath merged commit 7212815 into master Feb 19, 2025
@jschnath jschnath deleted the jschnath/ROX-20811_roxctl_central_generate_pvc_bug branch February 19, 2025 08:37
davdhacs added a commit that referenced this pull request Mar 31, 2026
Added in #14312 as a CI sanity check for IsRunningInContainer().
The test is inherently circular — it can only verify container
detection by checking the same signals the function checks.
Actual regression protection comes from local-roxctl bats tests
which exercise the central generate command that depends on this.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
davdhacs added a commit that referenced this pull request Mar 31, 2026
Added in #14312 as a CI sanity check for IsRunningInContainer().
The test is inherently circular — it can only verify container
detection by checking the same signals the function checks.
Actual regression protection comes from local-roxctl bats tests
which exercise the central generate command that depends on this.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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