-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
58 lines (54 loc) · 1.43 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
steps:
# loads cached files
- name: gcr.io/cloud-builders/gsutil
dir: /root
entrypoint: bash
args:
- -c
- |
(
gsutil cp gs://${_GCS_CACHE_BUCKET}/m2-cache.tar.gz /tmp/m2-cache.tar.gz &&
tar -xzf /tmp/m2-cache.tar.gz
) || echo 'Cache not found'
volumes:
- name: m2
path: /root/.m2/
# builds and creates a docker image
- name: maven:3.6.0-jdk-11-slim
id: build
entrypoint: mvn
args:
- "clean"
- "install"
- "jib:build"
- "-Dimage=eu.gcr.io/${PROJECT_ID}/${_IMAGE_NAME}"
- "-DDB_USER=${_DB_USER}"
- "-DDB_PASS=${_DB_PASS}"
- "-Djib.container.environment=SPRING_PROFILES_ACTIVE=${_SPRING_PROFILES_ACTIVE}"
volumes:
- name: m2
path: /root/.m2/
# saves cached files
- name: gcr.io/cloud-builders/gsutil
waitFor:
- build
dir: /root
entrypoint: bash
args:
- -c
- |
tar -czf /tmp/m2-cache.tar.gz .m2 &&
gsutil cp /tmp/m2-cache.tar.gz gs://${_GCS_CACHE_BUCKET}/m2-cache.tar.gz
volumes:
- name: m2
path: /root/.m2/
# configures kubernetes and deploys the image to it
- name: gcr.io/cloud-builders/gke-deploy:stable
waitFor:
- build
args:
- "run"
- "--filename=k8s-config"
- "--location=europe-west1-b"
- "--cluster=${_CLUSTER_NAME}"
- "--image=eu.gcr.io/${PROJECT_ID}/${_IMAGE_NAME}:latest"