forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
34 lines (31 loc) · 868 Bytes
/
cloudbuild.yaml
File metadata and controls
34 lines (31 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
steps:
- name: 'gcr.io/cloud-builders/docker'
id: generate-image-name
dir: scanners/spring4shell
entrypoint: 'bash'
args:
- '-c'
- |
echo "northamerica-northeast1-docker.pkg.dev/track-compliance/tracker/spring4shell-scanner:$(echo $BRANCH_NAME | sed 's/[^a-zA-Z0-9]/-/g')-$SHORT_SHA-$(date +%s)" > /workspace/imagename
- name: 'gcr.io/cloud-builders/docker'
id: build
dir: scanners/spring4shell
entrypoint: 'bash'
args:
- '-c'
- |
image=$(cat /workspace/imagename)
docker build -t $image .
- name: 'gcr.io/cloud-builders/docker'
id: push-if-master
entrypoint: 'bash'
args:
- '-c'
- |
if [[ "$BRANCH_NAME" == "master" ]]
then
image=$(cat /workspace/imagename)
docker push $image
else
exit 0
fi