-
Notifications
You must be signed in to change notification settings - Fork 3
/
.cloudbuild.yaml
30 lines (30 loc) · 1.02 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
steps:
- id: 'build-image'
name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME/$REPO_NAME:$SHORT_SHA'
- '-t'
- 'eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME/$REPO_NAME:latest'
- '.'
- '-f'
- './Dockerfile'
timeout: 1200s
- id: 'push-to-registry'
name: 'gcr.io/cloud-builders/docker'
args:
- 'push'
- 'eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME/$REPO_NAME'
- '--all-tags'
- id: 'deploy-to-gke'
name: 'gcr.io/cloud-builders/gcloud'
env:
- 'KUBECONFIG=/.kube/config'
entrypoint: 'bash'
args:
- '-c'
- |
gcloud container clusters get-credentials soils-revealed-cluster-v20 --project=$PROJECT_ID --zone=europe-west4-a
kubectl set image deployment/$REPO_NAME --namespace=$BRANCH_NAME soils-revealed=eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME/$REPO_NAME:$SHORT_SHA
kubectl rollout restart deployment $REPO_NAME --namespace=$BRANCH_NAME