openclarity / vmclarity

VMClarity is a tool for agentless detection and management of Virtual Machine Software Bill Of Materials (SBOM) and vulnerabilities
openclarity.io
Apache License 2.0
102 stars 22 forks source link

Enable caching for plugin binary artifacts #1854

Closed ramizpolic closed 2 months ago

ramizpolic commented 3 months ago

Problem Statement

The downloaded artifacts for binary mode are not cached between runs. It would be useful to allow caching to reduce time needed to setup and perform a scan using plugins.

Proposed Solution

Add two more config options for plugins to allow users to

  1. specify custom dir if they want the plugin data to be saved/loaded to allow caching via binary_artifacts_path which would default to ${HOME}/.vmclarity/plugins if not specified
  2. specify keep/clean option if they want to preserve artifacts pulled in in a given run via binary_artifacts_keep. Alternatively, binary_artifacts_clean config can be used that defaults to preserve behaviour when not specified.

For example

## reruns preserve new and reuse existing artifacts
binary_artifacts_path: /tmp/plugin-artifacts
binary_artifacts_keep: true
# or binary_artifacts_clean: false

## reruns reuse existing artifacts between runs but do not preserve the new artifacts
binary_artifacts_path: /tmp/plugin-artifacts
binary_artifacts_keep: false
# or binary_artifacts_clean: true

## reruns neither reuse nor preserve
# empty binary_artifact configs
# or binary_artifacts_clean: true