-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathcloudbuild.yaml
70 lines (60 loc) · 2.21 KB
/
cloudbuild.yaml
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
steps:
- id: 'build'
name: 'gcr.io/cloud-builders/docker'
args:
- build
- --rm
- --no-cache
- --tag=us-docker.pkg.dev/$PROJECT_ID/tools/rcran-build:$BUILD_ID
- .
# Delete old images
- id: 'delete-old-images'
name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
set -e
gcloud container images list-tags us-docker.pkg.dev/$PROJECT_ID/tools/rcran-build:$BUILD_ID --filter="NOT tags:latest timestamp.datetime < -P6M" --format='get(digest)' --limit 100 | xargs -I {} gcloud container images delete us-docker.pkg.dev/$PROJECT_ID/tools/rcran-build@{} --quiet --force-delete-tags
gcloud container images list-tags gcr.io/kaggle-images/rcran --filter="NOT tags:latest timestamp.datetime < -P6M" --format='get(digest)' --limit 100 | xargs -I {} gcloud container images delete gcr.io/kaggle-images/rcran@{} --quiet --force-delete-tags
# Pushing the intermediate image can be useful to debug test failures.
- id: 'intermediate-push'
waitFor: ['build']
name: 'gcr.io/cloud-builders/docker'
args:
- push
- us-docker.pkg.dev/$PROJECT_ID/tools/rcran-build:$BUILD_ID
# Verify 'convert' (ImageMagick) is available.
- id: 'test-convert'
waitFor: ['intermediate-push'] # Otherwise the test failure should stop push.
name: 'us-docker.pkg.dev/$PROJECT_ID/tools/rcran-build:$BUILD_ID'
args: ['convert', '--version']
- id: 'test'
waitFor: ['intermediate-push'] # Otherwise the test failure should stop push.
name: 'us-docker.pkg.dev/$PROJECT_ID/tools/rcran-build:$BUILD_ID'
entrypoint: 'bash'
args:
- '-c'
- |
set -e
Rscript test_build.R
# Verify expected test_build.R output is present.
[ -s plot1.png ]
echo "ok"
- id: 'retag'
waitFor: ['test', 'test-convert']
name: 'gcr.io/cloud-builders/docker'
args:
- tag
- us-docker.pkg.dev/$PROJECT_ID/tools/rcran-build:$BUILD_ID
- gcr.io/kaggle-images/rcran:$_TAG
images: ['gcr.io/kaggle-images/rcran:$_TAG']
options:
# Use of largest GCB instance size in shared pool.
# Upon change, update Ncpus in package_installs.R.
machineType: 'N1_HIGHCPU_32'
diskSizeGb: 1000 # Max disk size. Gives more IOPS.
timeout: 86400s
substitutions:
_TAG: testing # Change to latest for production.
tags: ['rcran', 'notification']