Introduce support for multiple scanners
Introducing this MR in response to this comment.
In preparation for adding more scanner choices beyond Trivy, this MR introduces a mechanism for callers of gtcs
to select the scanner via a CLI switch:
gtcs scan <some-image>
# the existing output!
gtcs scan <some-image> --scanner trivy
# the existing output!
gtcs scan <some-image> --scanner grype
[ERROR] [2021-04-28 16:56:42 -0400] [] ▶ Unrecognized scanner selected: grype
In the code, the scanner is chosen using the function get_scan_function
in lib/gcs/cli.rb
, where a concrete scanner implementation (such as the class Gcs.Trivy
) can be used behind the generalized abstraction of a "scan function".