Skip to content

Commit b9f2596

Browse files
datudouiCell
authored andcommitted
add cloudbuild.yml
1 parent 4082ee5 commit b9f2596

File tree

3 files changed

+69
-3
lines changed

3 files changed

+69
-3
lines changed

cloudbuild.yaml

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,73 @@
11
steps:
2-
- id: 'build image'
2+
- id: 'Build image'
33
name: 'gcr.io/cloud-builders/docker'
44
args: ['build', '-t', 'gcr.io/laomaojp/github.com/eoslaomao/watchdog:$TAG_NAME', '.']
5-
6-
- id: 'push image'
5+
6+
- id: 'Push image'
77
name: 'gcr.io/cloud-builders/docker'
88
args: ['push', 'gcr.io/laomaojp/github.com/eoslaomao/watchdog:$TAG_NAME']
9+
10+
- id: 'make sure kubectl can work'
11+
name: 'gcr.io/cloud-builders/kubectl'
12+
env:
13+
- 'CLOUDSDK_COMPUTE_ZONE=asia-northeast1'
14+
- 'CLOUDSDK_CONTAINER_CLUSTER=laomao'
15+
- 'KUBECONFIG=/workspace/.kube/config'
16+
args: ['cluster-info']
17+
18+
19+
# Decrypt the file containing the key
20+
- name: 'gcr.io/cloud-builders/gcloud'
21+
args:
22+
- kms
23+
- decrypt
24+
- --ciphertext-file=github_rsa.enc
25+
- --plaintext-file=/root/.ssh/github_rsa
26+
- --location=global
27+
- --keyring=laomaojp
28+
- --key=github-key
29+
- --project=laomaojp
30+
volumes:
31+
- name: 'ssh'
32+
path: /root/.ssh
33+
34+
# Set up git with key and domain
35+
- name: 'gcr.io/cloud-builders/git'
36+
entrypoint: 'bash'
37+
args:
38+
- '-c'
39+
- |
40+
chmod 600 /root/.ssh/github_rsa
41+
cat <<EOF >/root/.ssh/config
42+
Hostname github.com
43+
IdentityFile /root/.ssh/github_rsa
44+
EOF
45+
mv known_hosts /root/.ssh/known_hosts
46+
volumes:
47+
- name: 'ssh'
48+
path: /root/.ssh
49+
50+
- id: 'Clone charts'
51+
name: 'gcr.io/cloud-builders/git'
52+
args: ['clone','[email protected]:EOSLaoMao/Charts.git']
53+
volumes:
54+
- name: 'ssh'
55+
path: /root/.ssh
56+
57+
- id: 'Init helm'
58+
name: 'gcr.io/$PROJECT_ID/helm'
59+
args: ['init']
60+
env:
61+
- 'CLOUDSDK_COMPUTE_ZONE=asia-northeast1'
62+
- 'CLOUDSDK_CONTAINER_CLUSTER=laomao'
63+
- 'KUBECONFIG=/workspace/.kube/config'
64+
65+
- id: 'Deploy'
66+
name: 'gcr.io/$PROJECT_ID/helm'
67+
args: ['upgrade','-f', '/workspace/Charts/block-producer/charts/watchdog/values.yaml', 'block-producer','/workspace/Charts/block-producer/charts/watchdog']
68+
env:
69+
- 'CLOUDSDK_COMPUTE_ZONE=asia-northeast1'
70+
- 'CLOUDSDK_CONTAINER_CLUSTER=laomao'
71+
- 'KUBECONFIG=/workspace/.kube/config'
72+
73+

github_rsa.enc

1.88 KB
Binary file not shown.

known_hosts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==

0 commit comments

Comments
 (0)