Skip to content

Commit 75dfd05

Browse files
authored
Merge helm scan to cluster scan (#957)
Merge helm scan to cluster scan
1 parent 49af645 commit 75dfd05

File tree

2 files changed

+27
-51
lines changed

2 files changed

+27
-51
lines changed

cloudbuild.yaml

+27-6
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ steps:
299299
args:
300300
- '-c'
301301
- |
302+
mkdir -p security_test/scan_target/ && find . -mindepth 1 -maxdepth 1 -type d ! -name "security_test" -exec cp -r {} security_test/scan_target/ \;
303+
mkdir -p /workspace/security_test/scan_target
304+
# Exclude /workspace/security_test from the copy to avoid recursive issue
305+
find . -mindepth 1 -maxdepth 1 ! -path "./security_test" -exec cp -r {} /workspace/security_test/scan_target/ \;
306+
chown -R 65532:65532 /workspace/security_test/scan_target
302307
mkdir -p /workspace/security_test/allowlist
303308
cp security_test/config.yaml /workspace/security_test/config.yaml
304309
cp -r security_test/allowlist/* /workspace/security_test/allowlist/ || echo "Allowlist folder is empty or not found"
@@ -308,7 +313,7 @@ steps:
308313
# gcr.io/cloud-builders/docker is a special image: This image provided by Google Cloud contains the docker command-line tool, which is essential for executing Docker commands like docker build and docker run within your Cloud Build steps.
309314
# 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.
310315
- name: 'gcr.io/cloud-builders/docker'
311-
id: 'run shipshape'
316+
id: 'Run shipshape on cluster'
312317
args:
313318
- 'run'
314319
- '--network=cloudbuild'
@@ -322,16 +327,32 @@ steps:
322327
- '${_SHIPSHAPE_IMAGE}'
323328
- '--mode=cluster'
324329
- '--allowlist_folder=/workspace/security_test/allowlist'
325-
- '--cluster_name=ml-${SHORT_SHA}-${_PR_NUMBER}-${_BUILD_ID}-cluster'
326-
- '--project_id=$PROJECT_ID'
327-
- '--location=${_REGION}'
328330
- '--kube_config_path=/root/.kube/config'
329331
- '--max_wait_duration=3000'
330332
- '--max_parallel=100'
331333
- '--cluster_scan_config_path=/workspace/security_test/config.yaml'
332334
allowFailure: true
333335
waitFor: ['Copy metadata']
334336

337+
338+
- id: 'Run Shipshape on helm'
339+
name: 'gcr.io/cloud-builders/docker'
340+
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'
353+
allowFailure: true
354+
waitFor: ['Copy metadata']
355+
335356
- id: 'cleanup rag'
336357
name: 'gcr.io/$PROJECT_ID/terraform'
337358
entrypoint: 'bash'
@@ -358,7 +379,7 @@ steps:
358379
-var=cloudsql_instance=pgvector-instance-$SHORT_SHA-$_BUILD_ID \
359380
-auto-approve -no-color
360381
allowFailure: true
361-
waitFor: ['run shipshape']
382+
waitFor: ['Run shipshape on cluster', 'Run Shipshape on helm']
362383

363384
- id: 'cleanup gke cluster'
364385
name: 'gcr.io/$PROJECT_ID/terraform'
@@ -441,7 +462,7 @@ substitutions:
441462
_USER_NAME: github
442463
_AUTOPILOT_CLUSTER: "false"
443464
_BUILD_ID: ${BUILD_ID:0:8}
444-
_SHIPSHAPE_IMAGE: us-docker.pkg.dev/k8ssecurityvalidation-agent/k8ssecurityvalidation-agent/k8ssecurityvalidation-agent@sha256:1f80ae746014330a3a83b5ee2fabeacf90fa488c4f0922072b628b95144f25c8
465+
_SHIPSHAPE_IMAGE: us-docker.pkg.dev/k8ssecurityvalidation-agent/k8ssecurityvalidation-agent/k8ssecurityvalidation-agent@sha256:cd45e6cd84e9a45462ddbca18c4731fd4e264d517ee98131eb5be4eb57691f44
445466
logsBucket: gs://ai-on-gke-build-logs
446467
options:
447468
substitutionOption: "ALLOW_LOOSE"

violation_scan_helm.yaml

-45
This file was deleted.

0 commit comments

Comments
 (0)