Skip to content

Commit

Permalink
fix: set default value for useBuiltIntPolicies (#2114)
Browse files Browse the repository at this point in the history
Signed-off-by: chenk <hen.keinan@gmail.com>
  • Loading branch information
chen-keinan authored Jun 3, 2024
1 parent 20a8a5b commit 4cde7c1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/plugins/trivy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (c Config) GetDBRepositoryInsecure() bool {
func (c Config) GetUseBuiltinRegoPolicies() bool {
val, ok := c.Data[keyTrivyUseBuiltinRegoPolicies]
if !ok {
return true
return false
}
boolVal, err := strconv.ParseBool(val)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions pkg/vulnerabilityreport/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,16 @@ func (s *ScanJobBuilder) Get() (*batchv1.Job, []*corev1.Secret, error) {
}
}

jobAnnotations := make(map[string]string, len(s.annotations) + 1)
jobAnnotations := make(map[string]string, len(s.annotations)+1)
jobAnnotations[trivyoperator.AnnotationContainerImages] = containerImagesAsJSON
for k, v := range s.annotations {
jobAnnotations[k] = v
}
job := &batchv1.Job{
ObjectMeta: metav1.ObjectMeta{
Name: GetScanJobName(s.object),
Namespace: s.pluginContext.GetNamespace(),
Labels: jobLabels,
Name: GetScanJobName(s.object),
Namespace: s.pluginContext.GetNamespace(),
Labels: jobLabels,
Annotations: jobAnnotations,
},
Spec: jobSpec,
Expand Down
2 changes: 1 addition & 1 deletion pkg/vulnerabilityreport/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func TestScanJobBuilder(t *testing.T) {
trivyoperator.LabelResourceSpecHash: "788f48d57f",
},
Annotations: map[string]string{
"test-annotation": "test-value",
"test-annotation": "test-value",
trivyoperator.AnnotationContainerImages: `{"nginx":"nginx:1.16"}`,
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/vulnerabilityreport/controller/scanjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func (r *ScanJobController) completedContainers(ctx context.Context, scanJob *ba
}
if strings.Contains(status.Message, "no child with platform linux") {
log.Info("Scan job container", "container", container, "status.reason", status.Reason, "status.message", "Scanning Windows images is not supported.")
}else{
} else {
log.Error(nil, "Scan job container", "container", container, "status.reason", status.Reason, "status.message", status.Message)
}
}
Expand Down

0 comments on commit 4cde7c1

Please sign in to comment.