-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
30 lines (26 loc) · 987 Bytes
/
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
steps:
## Set build tag and write to file _TAG
- name: 'ubuntu'
args: ['bash', '-c', 'date -u +%Y%m%dT%H%M_$SHORT_SHA > _TAG']
##gradle build
- name: gcr.io/cloud-builders/gradle
args: ['bootJar']
##docker build
- name: gcr.io/cloud-builders/docker
entrypoint: sh
args: ['-c', 'docker build -t asia.gcr.io/note-project-243400/note-server:$(cat _TAG) .']
##docker push
- name: gcr.io/cloud-builders/docker
entrypoint: sh
args: ['-c', 'docker push asia.gcr.io/note-project-243400/note-server:$(cat _TAG)']
##kubctl deploy
- name: gcr.io/cloud-builders/kubectl
entrypoint: bash
args:
- '-c'
- |
gcloud container clusters get-credentials note-project-cluster --project="note-project-243400" --zone="asia-northeast2-c"
kubectl set image deployment/note-server-node-deploy note-server=asia.gcr.io/note-project-243400/note-server:$(cat _TAG)
env:
- 'CLOUDSDK_COMPUTE_ZONE=asia-northeast2-c'
- 'CLOUDSDK_CONTAINER_CLUSTER=note-project-cluster'