-
Notifications
You must be signed in to change notification settings - Fork 1
/
eos-dm.cb.yaml
212 lines (192 loc) · 5.58 KB
/
eos-dm.cb.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
### Commit and push those values in!
substitutions:
_REPOSITORY: "[email protected]:dfuse-io/eos.git"
_BRANCH: v2.0.12-dm-12.0 # Can be either a tag or a branch, branch can be used when "testing" stuff out
_VERSION: v2.0.12-dm.12.0
_IMAGE_TAG: ubuntu-18.04
_OS: ubuntu-18.04
_PKGTYPE: deb
steps:
# Download SSH encrypted private key and SSH known hosts file
- id: download-ssh-files
name: 'gcr.io/cloud-builders/gsutil'
entrypoint: 'bash'
args:
- '-ce'
- |
gsutil cp gs://${PROJECT_ID}_cloudbuild/github_id_rsa.enc /root/.ssh/github_id_rsa.enc
gsutil cp gs://${PROJECT_ID}_cloudbuild/github_known_hosts /root/.ssh/known_hosts
volumes:
- name: 'ssh'
path: /root/.ssh
# Decrypting SSH encrypted private key
- id: decrypt-ssh-encrypted-private-key
name: 'gcr.io/cloud-builders/gcloud'
args:
- kms
- decrypt
- --project=eoscanada-public
- --ciphertext-file=/root/.ssh/github_id_rsa.enc
- --plaintext-file=/root/.ssh/id_rsa
- --location=global
- --keyring=github-keys
- --key=github-key
volumes:
- name: 'ssh'
path: /root/.ssh
# Initializing Git with SSH credentials and URL transformation
- id: configure-git-for-private-repositories-access
name: 'gcr.io/cloud-builders/git'
entrypoint: 'bash'
args:
- '-ce'
- |
chmod 600 /root/.ssh/id_rsa
cat <<EOF >/root/.ssh/config
Hostname github.com
IdentityFile /root/.ssh/id_rsa
EOF
git config --global --add url."[email protected]:dfuse-io/".insteadOf "https://github.com/dfuse-io/"
git config --global --add url."[email protected]:eoscanada/".insteadOf "https://github.com/eoscanada/"
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'git_home'
path: /root/.git
- id: cloning source code
name: gcr.io/cloud-builders/git
args: [
'clone',
'--branch=${_BRANCH}',
# '--depth=1', # this prevents the 'describe' command from finding the tag
'--recursive',
'${_REPOSITORY}',
'/git',
]
volumes:
- name: 'git'
path: '/git'
- name: 'ssh'
path: /root/.ssh
- name: 'git_home'
path: /root/.git
- id: building source code
name: gcr.io/cloud-builders/docker
entrypoint: 'bash'
env:
# The ARGS is used for `docker run <ARGS>` part, and in CloudBuild, the source mount volume must be the volume name not the path! See `volumes`
- ARGS=--rm --init -v git:/eos
- PLATFORM_TYPE=pinned
- IMAGE_TAG=${_IMAGE_TAG}-pinned
# Supports for both <= 2.0.7 and >= 2.0.8
- IMAGE_NAME=gcr.io/${PROJECT_ID}/eosio-ci # Used by <= 2.0.7
- MIRROR_REGISTRY=gcr.io/${PROJECT_ID}/eosio-ci # Used by >= 2.0.8
args:
- '-cxe'
- |
env
# FIXME: Building <= 2.0.7 does not work anymore due to require `ARGS=--rm --init -v git:/workdir`
# We should probably make it conditional here if we require to fix it.
cd /git
./.cicd/build.sh
volumes:
- name: 'git'
path: '/git'
- id: package distribution
name: gcr.io/cloud-builders/docker
entrypoint: 'bash'
env:
# The ARGS is used for `docker run <ARGS>` part, and in CloudBuild, the source mount volume must be the volume name not the path! See `volumes`
- ARGS=--rm --init -v git:/eos
- PLATFORM_TYPE=pinned
- IMAGE_TAG=${_IMAGE_TAG}-pinned
- OS=${_OS}
- PKGTYPE=${_PKGTYPE}
# Supports for both <= 2.0.7 and >= 2.0.8
- IMAGE_NAME=gcr.io/${PROJECT_ID}/eosio-ci # Used by <= 2.0.7
- MIRROR_REGISTRY=gcr.io/${PROJECT_ID}/eosio-ci # Used by >= 2.0.8
args:
- '-cxe'
- |
env
# FIXME: Building <= 2.0.7 does not work anymore due to require `ARGS=--rm --init -v git:/workdir`
# We should probably make it conditional here if we require to fix it.
cd /git
./.cicd/package.sh
volumes:
- name: 'git'
path: '/git'
- id: docker-build-prod
name: gcr.io/cloud-builders/docker
args: [
'build',
'-t', 'gcr.io/$PROJECT_ID/eosio-eos-prod:${_VERSION}-${_OS}',
'-f', 'eos-${_IMAGE_TAG}.dockerfile',
'--build-arg', 'VERSION=${_VERSION}',
'/git/build/packages'
]
volumes:
- name: 'git'
path: '/git'
- id: docker-tag-untested
name: gcr.io/cloud-builders/docker
args: [
'tag',
'gcr.io/$PROJECT_ID/eosio-eos-prod:${_VERSION}-${_OS}',
'gcr.io/$PROJECT_ID/eosio-eos-prod:${_VERSION}-${_OS}-untested',
]
volumes:
- name: 'git'
path: '/git'
- id: docker-push-untested
name: gcr.io/cloud-builders/docker
args: [
'push',
'gcr.io/$PROJECT_ID/eosio-eos-prod:${_VERSION}-${_OS}-untested',
]
volumes:
- name: 'git'
path: '/git'
- id: deep-mind-nodeos-tests
name: gcr.io/$PROJECT_ID/eosio-eos-prod:${_VERSION}-${_OS}
entrypoint: bash
args:
- '-cxe'
- |
if [[ "${_VERSION}" =~ "dm" && ! "${_VERSION}" =~ "dm.13" && ! "${_VERSION}" =~ "v2.1." ]]; then
cd /workspace/deep-mind/compare
RUN_MODE=only_generate ./run.sh eos-2.x /usr/bin/nodeos
fi
- id: deep-mind-go-tests
name: gcr.io/cloud-builders/go:debian
entrypoint: 'bash'
env:
- CGO_ENABLED=1
- GOPRIVATE=github.com/eoscanada/*,github.com/dfuse-io/*
args:
- '-cxe'
- |
if [[ "${_VERSION}" =~ "dm" && ! "${_VERSION}" =~ "dm.13" && ! "${_VERSION}" =~ "v2.1." ]]; then
cd /workspace/deep-mind/compare
RUN_MODE=only_compare ./run.sh eos-2.x
fi
volumes:
- name: 'ssh'
path: /root/.ssh
- name: 'git_home'
path: /root/.git
- id: package copy to bucket
name: gcr.io/cloud-builders/gsutil
args: [
'cp',
'/git/build/packages/*.${_PKGTYPE}',
'gs://eoscanada-shared-services_cloudbuild/packages/eos/${_OS}/',
]
volumes:
- name: 'git'
path: '/git'
options:
machineType: 'N1_HIGHCPU_32'
images:
- gcr.io/$PROJECT_ID/eosio-eos-prod:${_VERSION}-${_OS}
timeout: 1h