-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
49 lines (40 loc) · 1.43 KB
/
cloudbuild.yaml
File metadata and controls
49 lines (40 loc) · 1.43 KB
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
steps:
#First Clone from Google Cloud Source Repository
- name: 'gcr.io/cloud-builders/git'
args: ['clone','https://source.developers.google.com/p/${_PROJECT}/r/${_REPO_NAME}']
#Build the image
- name: 'gcr.io/cloud-builders/docker'
args: ['build','-f','Dockerfile','-t','gcr.io/${_PROJECT}/${_CONTAINERNAME}:${_VERSION}','.']
#Push the image
- name: 'gcr.io/cloud-builders/docker'
args: ['push','gcr.io/${_PROJECT}/${_CONTAINERNAME}:${_VERSION}']
#Kubectl configure
- name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', 'hey.yaml']
env:
- 'CLOUDSDK_COMPUTE_ZONE=${_ZONE}'
- 'CLOUDSDK_CONTAINER_CLUSTER=${_GKE_CLUSTER}'
#Update the container image using kubectl set
- name: 'gcr.io/cloud-builders/kubectl'
args:
- 'set'
- 'image'
- 'deployment/${_DEPLOYMENTNAME}'
- '${_CONTAINERNAME}=gcr.io/${_PROJECT}/${_CONTAINERNAME}:${_VERSION}'
env:
- 'CLOUDSDK_COMPUTE_ZONE=${_ZONE}'
- 'CLOUDSDK_CONTAINER_CLUSTER=${_GKE_CLUSTER}'
substitutions:
#GCP Specific configuration. Please DON'T change anything
_PROJECT: cheq-inscope
_ZONE: asia-south1-a
_GKE_CLUSTER: cluster-1-inscope
#Repository Specific configuration. DevOps can change this settings
_DEPLOYMENTNAME: hello-deployment
_CONTAINERNAME: hey
_REPO_NAME: cheq-stage-cicd
# Developers ONLY change
_VERSION: $COMMIT_SHA
options:
substitution_option: 'ALLOW_LOOSE'
logging: CLOUD_LOGGING_ONLY