-
Notifications
You must be signed in to change notification settings - Fork 13
ROX-12967: Introduce local-nodescanner #1027
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
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
Skipping CI for Draft Pull Request. |
Run against a UBI 8.7 image:
|
Run against the unpacked RHCOS 4.11 ISO image with a live-copy rpm Packages DB:
|
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 looks okay, but I see potential in documenting how this could be used without downloading the RHCOS iso.
I have also minor comments in the code.
I think we can merge this as a helper.
Maybe we could remove it from the Graphite stack and consider it separately (it does not depend on the code in #1026)?
flag.Parse() | ||
|
||
logrus.Infof("%v", path) | ||
if path == "" { |
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.
We could validate this with path.Exists()
(need to check the func, writing this from memory)
flag.BoolVar(&uncertifiedRHEL, "uncertifiedRHEL", false, "Whether to treat this run as uncertified RHEL FS") | ||
flag.Parse() | ||
|
||
logrus.Infof("%v", path) |
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.
Maybe let's write here some reasonable text? Will scan %s
maybe?
And I would go for %s
and add nil check.
|
||
components, err := nodes.Analyze("localnode", path, uncertifiedRHEL) | ||
if err != nil { | ||
logrus.Fatal(err) |
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.
Maybe some prefix here: Fatalf("Nodescan failed: %v", err)
?
// local-nodescanner is an application that allows you to run the node scan / inventory code locally on you machine. | ||
|
||
// Required: | ||
// Extracted filesystem from an RHCOS live .ISO (https://mirror.openshift.com/pub/openshift-v4/dependencies/rhcos/latest/) |
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 is optional, right? We could also use this on RHCOS or other mounted filesystem.
// How To: | ||
// Download the ISO, extract with 7z x <iso-name>, then extract images/pxeboot/root.squashfs with 7z as well | ||
// The root fs will be in ostree/deploy/rhcos/deploy/ | ||
// Caveat: The image doesn't contain a populated rpm Package DB. You still need to get that from a running system, e.g. a node. |
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 looks also optional for me.
Maybe we should convert these comments into a small readme in the tools/local-nodescanner
?
- Roll back RegEx change - Introduce IsRHCOSNamespace
- RHCOS has its RPM DB in a different path - RHCOS provides a CPE json in a different path
8cd5f2a
to
9fcc0a7
Compare
@Maddosaurus: The following tests failed, say
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/test-infra repository. I understand the commands that are listed here. |
@Maddosaurus I still have this PR on my list - do we want to merge it or can it be dropped? |
Closing this PR to restart the process with a fresh main branch and slightly different methodology. |
This PR introduces
local-nodescanner
in thetools
directory.Its goal is to run the code used for RHCOS node scanning, usually run by
Compliance
on a Node, locally.As the local version expects a path to a filesystem as argument, it can either run in a live environment or on an unpacked filesystem on disk.
Testing:
path=/
path=/path/to/extracted/dir
In case of the RHCOS FS, I copied a populated
/var/lib/rpm/Packages
file from an OpenShift Node running RHCOS 4.11 and manually added it to the right folder in the unpacked FS dump.Results of both runs can be found in the comments below.