@@ -47,6 +47,7 @@ const (
4747 TargetRepository TargetKind = "repo"
4848 TargetSBOM TargetKind = "sbom"
4949 TargetVM TargetKind = "vm"
50+ TargetK8s TargetKind = "k8s"
5051)
5152
5253var (
@@ -113,7 +114,7 @@ func WithInitializeService(f InitializeScanService) RunnerOption {
113114
114115// NewRunner initializes Runner that provides scanning functionalities.
115116// It is possible to return SkipScan and it must be handled by caller.
116- func NewRunner (ctx context.Context , cliOptions flag.Options , opts ... RunnerOption ) (Runner , error ) {
117+ func NewRunner (ctx context.Context , cliOptions flag.Options , targetKind TargetKind , opts ... RunnerOption ) (Runner , error ) {
117118 r := & runner {}
118119 for _ , opt := range opts {
119120 opt (r )
@@ -125,9 +126,8 @@ func NewRunner(ctx context.Context, cliOptions flag.Options, opts ...RunnerOptio
125126 Timeout : cliOptions .Timeout ,
126127 TraceHTTP : cliOptions .TraceHTTP ,
127128 }))
128- // get the sub command that is being used or fallback to "trivy"
129- commandName := lo .NthOr (os .Args , 1 , "trivy" )
130- r .versionChecker = notification .NewVersionChecker (commandName , & cliOptions )
129+
130+ r .versionChecker = notification .NewVersionChecker (string (targetKind ), & cliOptions )
131131
132132 // Update the vulnerability database if needed.
133133 if err := r .initDB (ctx , cliOptions ); err != nil {
@@ -421,7 +421,7 @@ func Run(ctx context.Context, opts flag.Options, targetKind TargetKind) (err err
421421}
422422
423423func run (ctx context.Context , opts flag.Options , targetKind TargetKind ) (types.Report , error ) {
424- r , err := NewRunner (ctx , opts )
424+ r , err := NewRunner (ctx , opts , targetKind )
425425 if err != nil {
426426 if errors .Is (err , SkipScan ) {
427427 return types.Report {}, nil
0 commit comments