-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
61 lines (59 loc) · 1.88 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
steps:
###########################################################
# Step 1: Retrieve the cached .m2 directory from GCS
###########################################################
- name: 'gcr.io/cloud-builders/gsutil'
args:
- '-m'
- 'rsync'
- '-r'
- 'gs://${_BUCKET}/cache/.m2'
- '/cache/.m2'
volumes:
- path: '/cache/.m2'
name: 'm2_cache'
###########################################################
# Step 2: Build, Test, and Verify
###########################################################
- name: 'gcr.io/cloud-builders/mvn'
args:
- 'clean'
- 'verify'
- '--batch-mode'
dir: '/workspace'
volumes:
- path: '/cache/.m2'
name: 'm2_cache'
env:
- MAVEN_OPTS=-Dmaven.repo.local=/cache/.m2
###########################################################
# Step 3: Update cached .m2 directory on GCS with any
# additional dependencies downloaded during the
# build.
###########################################################
- name: 'gcr.io/cloud-builders/gsutil'
args:
- '-m'
- 'rsync'
- '-r'
- '/cache/.m2'
- 'gs://${_BUCKET}/cache/.m2/'
volumes:
- path: '/cache/.m2'
name: 'm2_cache'
###########################################################
# Step 4: Build docker image
###########################################################
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: [ '-c', 'docker pull gcr.io/$PROJECT_ID/exchange:latest || exit 0' ]
- name: 'gcr.io/cloud-builders/docker'
args: ['build',
'-t', 'gcr.io/$PROJECT_ID/exchange:$COMMIT_SHA',
'--cache-from', 'gcr.io/$PROJECT_ID/exchange:latest',
'.']
dir: '/workspace'
images: ['gcr.io/$PROJECT_ID/exchange:$COMMIT_SHA']
substitutions:
# Default values
_BUCKET: 'gcloud-ozink-bucket1'