Skip to content

Commit

Permalink
feat: change flag name from skip-deep to skip images
Browse files Browse the repository at this point in the history
Signed-off-by: chenk <[email protected]>
  • Loading branch information
chen-keinan committed Apr 3, 2024
1 parent 000cb88 commit 0f79a25
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/docs/references/configuration/cli/trivy_kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ trivy kubernetes [flags] { cluster | all | specific resources like kubectl. eg:
-s, --severity strings severities of security issues to be displayed (UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL) (default [UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL])
--show-suppressed [EXPERIMENTAL] show suppressed vulnerabilities
--skip-db-update skip updating vulnerability database
--skip-deep skip the deep scan of the resources
--skip-dirs strings specify the directories or glob patterns to skip
--skip-files strings specify the files or glob patterns to skip
--skip-images skip the scanning of images in the resources
--skip-java-db-update skip updating Java index database
--skip-policy-update skip fetching rego policy updates
-t, --template string output template
Expand Down
18 changes: 9 additions & 9 deletions pkg/flag/kubernetes_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ var (
ConfigName: "kubernetes.exclude.owned",
Usage: "exclude resources that have an owner reference",
}
SkipDeep = Flag[bool]{
Name: "skip-deep",
ConfigName: "kubernetes.skip.deep",
Usage: "skip the deep scan of the resources",
SkipImages = Flag[bool]{
Name: "skip-images",
ConfigName: "kubernetes.skip.images",
Usage: "skip the scanning of images in the resources",
}
ExcludeNodes = Flag[[]string]{
Name: "exclude-nodes",
Expand Down Expand Up @@ -110,7 +110,7 @@ type K8sFlagGroup struct {
AllNamespaces *Flag[bool]
NodeCollectorNamespace *Flag[string]
ExcludeOwned *Flag[bool]
SkipDeep *Flag[bool]
SkipImages *Flag[bool]
ExcludeNodes *Flag[[]string]
QPS *Flag[float64]
Burst *Flag[int]
Expand All @@ -129,7 +129,7 @@ type K8sOptions struct {
ExcludeOwned bool
ExcludeNodes map[string]string
QPS float32
SkipDeep bool
SkipImages bool
Burst int
}

Expand All @@ -147,7 +147,7 @@ func NewK8sFlagGroup() *K8sFlagGroup {
ExcludeNodes: ExcludeNodes.Clone(),
NodeCollectorImageRef: NodeCollectorImageRef.Clone(),
QPS: QPS.Clone(),
SkipDeep: SkipDeep.Clone(),
SkipImages: SkipImages.Clone(),
Burst: Burst.Clone(),
}
}
Expand All @@ -170,7 +170,7 @@ func (f *K8sFlagGroup) Flags() []Flagger {
f.ExcludeNodes,
f.NodeCollectorImageRef,
f.QPS,
f.SkipDeep,
f.SkipImages,
f.Burst,
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ func (f *K8sFlagGroup) ToOptions() (K8sOptions, error) {
ExcludeNodes: exludeNodeLabels,
NodeCollectorImageRef: f.NodeCollectorImageRef.Value(),
QPS: float32(f.QPS.Value()),
SkipDeep: f.SkipDeep.Value(),
SkipImages: f.SkipImages.Value(),
Burst: f.Burst.Value(),
}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (s *Scanner) Scan(ctx context.Context, artifactsData []*artifacts.Artifact)

onItem := func(ctx context.Context, artifact *artifacts.Artifact) (scanResult, error) {
scanResults := scanResult{}
if s.opts.Scanners.AnyEnabled(types.VulnerabilityScanner, types.SecretScanner) && !s.opts.SkipDeep {
if s.opts.Scanners.AnyEnabled(types.VulnerabilityScanner, types.SecretScanner) && !s.opts.SkipImages {
opts := s.opts
opts.Credentials = make([]ftypes.Credential, len(s.opts.Credentials))
copy(opts.Credentials, s.opts.Credentials)
Expand Down

0 comments on commit 0f79a25

Please sign in to comment.