10000 Allow for single grype installation with multiple shared DBs by wagoodman · Pull Request #113 · anchore/yardstick · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow for single grype installation with multiple shared DBs #113

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

Merged
merged 14 commits into from
Aug 17, 2023

Conversation

wagoodman
Copy link
Contributor
@wagoodman wagoodman commented Aug 15, 2023

This PR allows for a single installation of grype share multiple DB and track by the checksum of the DB (or is as oss).

It was noticed while working on this that:

  • the root yardstick functions (such as compare_results) do not allow for passing an optional store_root as done elsewhere. This option has been added.
  • some adjustments to logging where done to shorten the output, such as bump some log lines from info to debug and to summarize long tool and image strings intelligently (edit: descoped)
  • add debug logging when hitting negative cases for capturing a result
  • note explicitly in logging when a scan configuration is being replaced in a result set
  • in the files I modified I tried to make the type hint annotations more accurate

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman marked this pull request as ready for review August 16, 2023 16:26
@wagoodman wagoodman marked this pull request as draft August 17, 2023 12:35
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman marked this pull request as ready for review August 17, 2023 12:52
store_base = install_base(name=config.tool_name, store_root=store_root)

version = config.tool_version
if config.tool_name.startswith("grype"):
Copy link
Contributor

Choose a reason for hiding this comment

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

The tool base class knowing about grype is another signal that it might be time to refactor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

one of a hundred signals 🔥

tool_obj.run("db", "update")

return tool_obj

@property
def db_root(self) -> str:
return os.path.join(self.path, "db")
return os.path.join(self.path, "db", self.db_identity)
Copy link
Contributor

Choose a reason for hiding this comment

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

So this will just have oss in it for grype installs that are using the normal database?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup 👍

@@ -77,7 +77,7 @@ def find(
by_tool: str = "",
by_time: str = "",
by_description: str = "",
store_root: str = None,
store_root: Optional[str] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'd prefer if unrelated changes were in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I highlighted that I was upgrading logging and type hints around store_root as found while integrating this into grype-db

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw that. I just wish it had all been done as a previous PR; that would have made it much easier to review both PRs.

@wagoodman
Copy link
Contributor Author

Let me take another stab at this one. Thanks for the review @willmurphyscode

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman merged commit a7ea334 into main Aug 17, 2023
@wagoodman wagoodman deleted the grype-install-path branch August 17, 2023 15:44
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.

2 participants
0