Skip to content

Commit 3ebe8d8

Browse files
authored
Update example to use inline-scan V2 and secret from Secrets Manager (#8)
1 parent 7e50822 commit 3ebe8d8

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

google-cloud-build/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
![Cloud Build workflow with Sysdig inline image scanning](cloud-build-workflow-inline-scan.drawio.svg)
1111

12+
In this example, the Sysdig API Token is stored as a secret in Secrets Manager, so the Google Cloud Build account will need secret accessor permissions.
13+
1214
## References
1315

1416
More details on Sysdig blog article: https://sysdig.com/blog/securing-google-cloud-run/

google-cloud-build/cloudbuild.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ steps:
33
- name: 'gcr.io/cloud-builders/docker'
44
args: ['build', '-t', '${_IMAGE_URL}:${_IMAGE_TAG}', '.']
55

6-
- name: gcr.io/cloud-builders/gcloud
7-
entrypoint: 'bash'
8-
args: [ '-c', "gcloud secrets versions access latest --secret=sysdig_token --format='get(payload.data)' | tr '_-' '/+' | base64 -d > decrypted-data.txt" ]
9-
10-
- name: 'sysdiglabs/secure-inline-scan'
11-
entrypoint: 'bash'
12-
args: [ '-c', '/bin/inline_scan.sh analyze -k $(cat decrypted-data.txt) ${_IMAGE_URL}:${_IMAGE_TAG}' ]
6+
- name: 'quay.io/sysdig/secure-inline-scan:2'
7+
args: [ '--storage-type=docker-daemon', '--storage-path=/var/run/docker.sock', '${_IMAGE_URL}:${_IMAGE_TAG}' ]
8+
secretEnv: ['SYSDIG_API_TOKEN']
139

1410
- name: 'gcr.io/cloud-builders/docker'
1511
args: ['push', '${_IMAGE_URL}:${_IMAGE_TAG}']
1612

13+
availableSecrets:
14+
secretManager:
15+
- versionName: projects/PROJECT_ID/secrets/sysdig_token/versions/latest
16+
env: 'SYSDIG_API_TOKEN'
17+
1718
substitutions:
1819
_IMAGE_URL: 'gcr.io/project-name/image-name'
1920
_IMAGE_TAG: 'latest'
2021

21-
2222
timeout: 900s

0 commit comments

Comments
 (0)