Skip to content

Commit

Permalink
Merge pull request #293 from intelops/cacheproblemtempfix
Browse files Browse the repository at this point in the history
cache temp fix
  • Loading branch information
vijeyash1 authored Dec 19, 2023
2 parents 0a65eaf + a291bda commit 7ca0329
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions agent/kubviz/trivy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func RunTrivyK8sClusterScan(js nats.JetStreamContext) error {
}
var report report.ConsolidatedReport
cmdString := fmt.Sprintf("trivy k8s --report summary cluster --exclude-nodes kubernetes.io/arch:amd64 --timeout 60m -f json --cache-dir %s --debug", trivyCacheDir)
clearCacheCmd := "trivy k8s --clear-cache"
// clearCacheCmd := "trivy k8s --clear-cache"
out, err := executeCommandTrivy(cmdString)
if err != nil {
log.Printf("Error executing command: %v\n", err)
Expand All @@ -62,11 +62,11 @@ func RunTrivyK8sClusterScan(js nats.JetStreamContext) error {
log.Printf("Error occurred while Unmarshalling json for k8s cluster scan: %v", err)
return err
}
_, err = executeCommandTrivy(clearCacheCmd)
if err != nil {
log.Printf("Error executing command: %v\n", err)
return err
}
// _, err = executeCommandTrivy(clearCacheCmd)
// if err != nil {
// log.Printf("Error executing command: %v\n", err)
// return err
// }
err = publishTrivyK8sReport(report, js)
if err != nil {
return err
Expand Down
12 changes: 6 additions & 6 deletions agent/kubviz/trivy_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func RunTrivyImageScans(config *rest.Config, js nats.JetStreamContext) error {
log.Printf("Error creating Trivy Image cache directory: %v\n", err)
return err
}
clearCacheCmd := "trivy image --clear-cache"
// clearCacheCmd := "trivy image --clear-cache"

images, err := ListImages(config)
if err != nil {
Expand Down Expand Up @@ -56,11 +56,11 @@ func RunTrivyImageScans(config *rest.Config, js nats.JetStreamContext) error {
log.Printf("Error occurred while Unmarshalling json for image: %v", err)
continue // Move on to the next image in case of an error
}
_, err = executeCommandTrivy(clearCacheCmd)
if err != nil {
log.Printf("Error executing command: %v\n", err)
return err
}
// _, err = executeCommandTrivy(clearCacheCmd)
// if err != nil {
// log.Printf("Error executing command: %v\n", err)
// return err
// }
err = publishImageScanReports(report, js)
if err != nil {
return err
Expand Down
12 changes: 6 additions & 6 deletions agent/kubviz/trivy_sbom.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func RunTrivySbomScan(config *rest.Config, js nats.JetStreamContext) error {
log.Printf("Error creating Trivy cache directory: %v\n", err)
return err
}
clearCacheCmd := "trivy image --clear-cache"
// clearCacheCmd := "trivy image --clear-cache"

log.Println("trivy sbom run started")
images, err := ListImages(config)
Expand Down Expand Up @@ -85,11 +85,11 @@ func RunTrivySbomScan(config *rest.Config, js nats.JetStreamContext) error {
continue // Move on to the next image in case of an error
}
// log.Println("report", report)
_, err = executeCommandTrivy(clearCacheCmd)
if err != nil {
log.Printf("Error executing command: %v\n", err)
return err
}
// _, err = executeCommandTrivy(clearCacheCmd)
// if err != nil {
// log.Printf("Error executing command: %v\n", err)
// return err
// }
// Publish the report using the given function
publishTrivySbomReport(report, js)
}
Expand Down

0 comments on commit 7ca0329

Please sign in to comment.