-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
111 lines (110 loc) · 2.95 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# References:
# https://github.com/GoogleCloudPlatform/gke-gitops-tutorial-cloudbuild/blob/master/cloudbuild-trigger-cd.yaml
# https://github.com/PimDeWitte/UnityAutoIncrementBuildVersion/issues/1
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args:
- kms
- decrypt
- --ciphertext-file=id_rsa.enc
- --plaintext-file=/root/.ssh/id_rsa
- --location=global
- --keyring=private-keys
- --key=github-key
volumes:
- name: 'ssh'
path: /root/.ssh
id: 'id_rsa'
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- |
chmod 600 /root/.ssh/id_rsa
cat <<EOF >/root/.ssh/config
Hostname github.com
IdentityFile /root/.ssh/id_rsa
EOF
mv known_hosts /root/.ssh/known_hosts
git config --global user.email "[email protected]"
git config --global user.name "Adimpression"
volumes:
- name: 'ssh'
path: /root/.ssh
id: 'known_hosts'
- name: gcr.io/cloud-builders/git
args: ['clone', '--recurse-submodules', 'https://github.com/Adimpression/Dimensions.git']
volumes:
- name: 'ssh'
path: /root/.ssh
waitFor:
- 'id_rsa'
- 'known_hosts'
id: 'repo-Dimensions'
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- |
cd Dimensions && \
git submodule init && \
git submodule update
id: 'submodules_init_repo-Dimensions'
volumes:
- name: 'ssh'
path: /root/.ssh
waitFor:
- 'repo-Dimensions'
- name: gcr.io/cloud-builders/git
args: ['clone', 'https://github.com/Adimpression/Scarcity.git']
id: 'repo-Scarcity'
- name: gcr.io/cloud-builders/git
args: ['clone', '[email protected]:Adimpression/proto.git']
volumes:
- name: 'ssh'
path: /root/.ssh
waitFor:
- 'id_rsa'
- 'known_hosts'
id: 'repo-proto'
- name: maven:3.6.0-jdk-11
entrypoint: 'mvn'
args: ['-Darguments', '-Dmaven.javadoc.skip=true', '-DskipTests=true','-f','Scarcity/pom.xml', 'clean', 'generate-sources']
volumes:
- name: 'ssh'
path: /root/.ssh
id: 'mvn'
waitFor:
- 'id_rsa'
- 'known_hosts'
- 'repo-Scarcity'
- 'repo-Dimensions'
- 'submodules_init_repo-Dimensions'
- 'repo-proto'
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- |
rm -rf ./proto/proto/ && \
cp -Rv ./Scarcity/generator/src/main/proto/* ./proto/
volumes:
- name: 'ssh'
path: /root/.ssh
waitFor:
- 'mvn'
id: 'cp-proto'
- name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-c'
- |
cd ./proto && \
git add -A && git commit -a -m "Generated proto from commit ${COMMIT_SHA}" && \
git push origin master
volumes:
- name: 'ssh'
path: /root/.ssh
waitFor:
- 'cp-proto'
id: 'commit-proto'