|
1 | 1 | steps:
|
2 |
| -- id: 'build image' |
| 2 | +- id: 'Build image' |
3 | 3 | name: 'gcr.io/cloud-builders/docker'
|
4 | 4 | args: ['build', '-t', 'gcr.io/laomaojp/github.com/eoslaomao/watchdog:$TAG_NAME', '.']
|
5 |
| - |
6 |
| -- id: 'push image' |
| 5 | + |
| 6 | +- id: 'Push image' |
7 | 7 | name: 'gcr.io/cloud-builders/docker'
|
8 | 8 | 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 | + |
0 commit comments