Skip to content

Commit c63520b

Browse files
authored
Enable Shipshape secure by default (#996)
* Enable Shipshape secure by default The test fail of shipshape will cause the presubmit test fail. * Enable Shipshape secure by default The test fail of shipshape will cause the presubmit test fail. * Enable Shipshape secure by default The test fail of shipshape will cause the presubmit test fail. * Enable Shipshape secure by default The test fail of shipshape will cause the presubmit test fail.
1 parent 34e2131 commit c63520b

File tree

2 files changed

+43
-29
lines changed

2 files changed

+43
-29
lines changed

cloudbuild.yaml

+41-28
Original file line numberDiff line numberDiff line change
@@ -314,42 +314,45 @@ steps:
314314
# gcr.io/${_PROJECT_ID}/check_violations:latest is your application image: This image contains your security check tool and its dependencies. It's designed to be run, not to build or run other Docker images.
315315
- name: 'gcr.io/cloud-builders/docker'
316316
id: 'Run shipshape on cluster'
317+
entrypoint: 'bash'
317318
args:
318-
- 'run'
319-
- '--network=cloudbuild'
320-
- '--rm'
321-
- '-v'
322-
- '/workspace/security_test/allowlist:/workspace/security_test/allowlist'
323-
- '-v'
324-
- '/workspace/security_test/config.yaml:/workspace/security_test/config.yaml'
325-
- '-v'
326-
- '/workspace/kubeconfig:/root/.kube/config'
327-
- '${_SHIPSHAPE_IMAGE}'
328-
- '--mode=cluster'
329-
- '--allowlist_folder=/workspace/security_test/allowlist'
330-
- '--kube_config_path=/root/.kube/config'
331-
- '--max_wait_duration=3000'
332-
- '--max_parallel=100'
333-
- '--cluster_scan_config_path=/workspace/security_test/config.yaml'
319+
- '-c'
320+
- |
321+
docker run \
322+
--network=cloudbuild \
323+
--rm \
324+
-v /workspace/security_test/allowlist:/workspace/security_test/allowlist \
325+
-v /workspace/security_test/config.yaml:/workspace/security_test/config.yaml \
326+
-v /workspace/kubeconfig:/root/.kube/config \
327+
${_SHIPSHAPE_IMAGE} \
328+
--mode=cluster \
329+
--allowlist_folder=/workspace/security_test/allowlist \
330+
--kube_config_path=/root/.kube/config \
331+
--max_wait_duration=3000 \
332+
--max_parallel=100 \
333+
--cluster_scan_config_path=/workspace/security_test/config.yaml \
334+
2>&1 | tee /workspace/shipshape_on_cluster.txt 2>&1
334335
allowFailure: true
335336
waitFor: ['Copy metadata']
336337

337338

338339
- id: 'Run Shipshape on helm'
339340
name: 'gcr.io/cloud-builders/docker'
341+
entrypoint: 'bash'
340342
args:
341-
- 'run'
342-
- '--network=cloudbuild'
343-
- '--rm'
344-
- '-v'
345-
- '/workspace/security_test/allowlist:/workspace/security_test/allowlist'
346-
- '-v'
347-
- '/workspace/security_test/scan_target:/workspace/security_test/scan_target'
348-
- '${_SHIPSHAPE_IMAGE}'
349-
- '--mode=helm'
350-
- '--allowlist_folder=/workspace/security_test/allowlist'
351-
- '--scan_path=/workspace/security_test/scan_target'
352-
- '--max_wait_duration=60'
343+
- '-c'
344+
- |
345+
docker run \
346+
--network=cloudbuild \
347+
--rm \
348+
-v /workspace/security_test/allowlist:/workspace/security_test/allowlist \
349+
-v /workspace/security_test/scan_target:/workspace/security_test/scan_target \
350+
${_SHIPSHAPE_IMAGE} \
351+
--mode=helm \
352+
--allowlist_folder=/workspace/security_test/allowlist \
353+
--scan_path=/workspace/security_test/scan_target \
354+
--max_wait_duration=60 \
355+
2>&1 | tee /workspace/shipshape_on_helm.txt 2>&1
353356
allowFailure: true
354357
waitFor: ['Copy metadata']
355358

@@ -455,6 +458,16 @@ steps:
455458
echo "rag prompt test failed"
456459
exit 1
457460
fi
461+
462+
if grep -q "Validation failed" /workspace/shipshape_on_cluster.txt; then
463+
echo "Shipshape on cluster scan validation failed, please check the log. knowledge share slides: go/shipshape-ai-on-gke-slide"
464+
exit 1
465+
fi
466+
467+
if grep -q "Validation failed" /workspace/shipshape_on_helm.txt; then
468+
echo "Shipshape on helm scan validation failed, please check the log. knowledge share slides: go/shipshape-ai-on-gke-slide"
469+
exit 1
470+
fi
458471
waitFor: ['cleanup gke cluster']
459472

460473
substitutions:

security_test/config.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ ignoredObjects:
3737
- Group: ".*"
3838
Kind: ".*"
3939
Version: ".*"
40-
Namespace: "^(kube-system|kube-public|kube-node-lease|gke-(gmp-system.*|managed-.*|gmp-public))$"
40+
Namespace: "^(kube-system|kube-public|kube-node-lease|gke-(gmp-system.*|managed-.*|gmp-public)|gmp-system.*)$"
4141
Name: ".*"
4242

4343
# ClusterRoles (system-related or not security-relevant)
@@ -67,3 +67,4 @@ ignoredObjects:
6767
Version: "v1"
6868
Namespace: "default"
6969
Name: "^default$"
70+

0 commit comments

Comments
 (0)