-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
73 lines (63 loc) · 1.9 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
steps:
- id: 'Build image'
name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/laomaojp/github.com/eoslaomao/watchdog:$TAG_NAME', '.']
- id: 'Push image'
name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/laomaojp/github.com/eoslaomao/watchdog:$TAG_NAME']
- id: 'Make sure kubectl can work'
name: 'gcr.io/cloud-builders/kubectl'
env:
- 'CLOUDSDK_COMPUTE_ZONE=asia-northeast1'
- 'CLOUDSDK_CONTAINER_CLUSTER=laomao'
- 'KUBECONFIG=/workspace/.kube/config'
args: ['cluster-info']
# Decrypt the file containing the key
- name: 'gcr.io/cloud-builders/gcloud'
args:
- kms
- decrypt
- --ciphertext-file=github_rsa.enc
- --plaintext-file=/root/.ssh/github_rsa
- --location=global
- --keyring=laomaojp
- --key=github-key
- --project=laomaojp
volumes:
- name: 'ssh'
path: /root/.ssh
# Set up git with key and domain
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- |
chmod 600 /root/.ssh/github_rsa
cat <<EOF >/root/.ssh/config
Hostname github.com
IdentityFile /root/.ssh/github_rsa
EOF
mv known_hosts /root/.ssh/known_hosts
volumes:
- name: 'ssh'
path: /root/.ssh
- id: 'Clone charts'
name: 'gcr.io/cloud-builders/git'
args: ['clone','[email protected]:EOSLaoMao/Charts.git']
volumes:
- name: 'ssh'
path: /root/.ssh
- id: 'Init helm'
name: 'gcr.io/$PROJECT_ID/helm'
args: ['init']
env:
- 'CLOUDSDK_COMPUTE_ZONE=asia-northeast1'
- 'CLOUDSDK_CONTAINER_CLUSTER=laomao'
- 'KUBECONFIG=/workspace/.kube/config'
- id: 'Deploy'
name: 'gcr.io/$PROJECT_ID/helm'
args: ['upgrade','--install','-f', '/workspace/Charts/block-producer/charts/watchdog/values.yaml', '--set','image.tag=$TAG_NAME','block-producer','/workspace/Charts/block-producer/charts/watchdog']
env:
- 'CLOUDSDK_COMPUTE_ZONE=asia-northeast1'
- 'CLOUDSDK_CONTAINER_CLUSTER=laomao'
- 'KUBECONFIG=/workspace/.kube/config'