-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
93 lines (93 loc) · 2.84 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
steps:
- name: gcr.io/cloud-builders/docker
id: build-builder
args:
- build
- '-t'
- '$_GCR_HOSTNAME/$PROJECT_ID/custom-builder:$COMMIT_SHA'
- custom-builder
waitFor: ['-']
- name: gcr.io/cloud-builders/docker
id: push-builder
args:
- push
- '$_GCR_HOSTNAME/$PROJECT_ID/custom-builder:$COMMIT_SHA'
waitFor: ['build-builder']
- name: gcr.io/k8s-skaffold/pack
id: 'build-luanerizer'
args:
- build
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
- '--builder=heroku/buildpacks'
- '--path=.'
entrypoint: pack
waitFor: ['-']
- name: gcr.io/cloud-builders/docker
id: 'push-luanerizer'
args:
- push
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
waitFor: ['build-luanerizer']
- name: '$_GCR_HOSTNAME/$PROJECT_ID/custom-builder:$COMMIT_SHA'
waitFor: ['push-builder', 'push-luanerizer']
id: get-credentials
entrypoint: gcloud
args:
- container
- clusters
- get-credentials
- '--project=$PROJECT_ID'
- '--zone=$_CLUSTER_LOCATION'
- '$_CLUSTER'
- name: '$_GCR_HOSTNAME/$PROJECT_ID/custom-builder:$COMMIT_SHA'
id: deploy-canary
entrypoint: bash
args:
- '-c'
- |-
kapp deploy -a luanerizer -y -f <(ytt \
-f config/ \
-v canary.deploy=true \
-v canary.previousRevision="$(kubectl get ksvc/luanerizer -o=jsonpath={.status.latestReadyRevisionName} || echo "")" \
-v image=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA)
- name: '$_GCR_HOSTNAME/$PROJECT_ID/custom-builder:$COMMIT_SHA'
id: check-canary
entrypoint: bash
args:
- '-c'
- |-
curl 'http://canary-luanerizer.default.34.83.171.200.xip.io/luanize' \
-sS -L -X POST \
--connect-timeout 5 \
--max-time 10 \
--retry 5 \
--retry-delay 0 \
--retry-max-time 40 \
-F 'text=my name is luan' |\
grep ':luan:'
- name: '$_GCR_HOSTNAME/$PROJECT_ID/custom-builder:$COMMIT_SHA'
id: deploy-prod
entrypoint: bash
args:
- '-c'
- |-
kapp deploy -a luanerizer -y -f <(ytt \
-f config/ \
-v image=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA)
images:
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
- '$_GCR_HOSTNAME/$PROJECT_ID/custom-builder:$COMMIT_SHA'
options:
substitutionOption: ALLOW_LOOSE
substitutions:
_LABELS: gcb-trigger-id=36921152-9563-4da6-87c5-0bba525ee4da
_TRIGGER_ID: 36921152-9563-4da6-87c5-0bba525ee4da
_PLATFORM: gke
_SERVICE_NAME: luanerizer
_DEPLOY_REGION: us-west1
_GCR_HOSTNAME: us.gcr.io
tags:
- gcp-cloud-build-deploy-cloud-run
- gcp-cloud-build-deploy-cloud-run-managed
- luanerizer