Skip to content

Commit 83b6520

Browse files
committed
fix(scanner): align job creation in tests with implementation
1 parent 3b5a0ed commit 83b6520

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/scanner/inline_adapter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (i *inlineAdapter) buildJob(name string, req harbor.ScanRequest) *batchv1.J
129129
ValueFrom: nil,
130130
})
131131
envVars = appendLocalEnvVar(envVars, "NO_PROXY")
132-
cmdString := fmt.Sprintf("/home/nonroot/sysdig-cli-scanner -a %s --skiptlsverify --console-log --output-json=output.json ", i.secureURL)
132+
cmdString := fmt.Sprintf("/home/nonroot/sysdig-cli-scanner -a %s --console-log --output-json=output.json ", i.secureURL)
133133
// Add skiptlsverify if insecure
134134
if !i.verifySSL {
135135
cmdString += "--skiptlsverify "

pkg/scanner/inline_adapter_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,19 @@ func job() *batchv1.Job {
211211
ObjectMeta: metav1.ObjectMeta{
212212
Name: resourceName,
213213
Namespace: namespace,
214+
Labels: map[string]string{
215+
"created-by": "harbor-scanner-sysdig-secure",
216+
},
214217
},
215218
Spec: batchv1.JobSpec{
216219
TTLSecondsAfterFinished: &jobTTL,
217220
BackoffLimit: &backoffLimit,
218221
Template: corev1.PodTemplateSpec{
222+
ObjectMeta: metav1.ObjectMeta{
223+
Labels: map[string]string{
224+
"created-by": "harbor-scanner-sysdig-secure",
225+
},
226+
},
219227
Spec: corev1.PodSpec{
220228
RestartPolicy: corev1.RestartPolicyNever,
221229
Containers: []corev1.Container{
@@ -225,7 +233,7 @@ func job() *batchv1.Job {
225233
Command: []string{"/busybox/sh"},
226234
Args: []string{
227235
"-c",
228-
"/home/nonroot/sysdig-cli-scanner -a https://secure.sysdig.com --skiptlsverify --output-json=output.json pull://harbor.sysdig-demo.zone/sysdig/agent:9.7.0@an image digest; RC=$?; if [ $RC -eq 1 ]; then exit 0; else exit $RC; fi",
236+
"/home/nonroot/sysdig-cli-scanner -a https://secure.sysdig.com --console-log --output-json=output.json pull://harbor.sysdig-demo.zone/sysdig/agent:9.7.0@an image digest; RC=$?; if [ $RC -eq 1 ]; then exit 0; else exit $RC; fi",
229237
},
230238
Env: []corev1.EnvVar{
231239
{

0 commit comments

Comments
 (0)