@@ -26,13 +26,20 @@ executors:
26
26
resource_class : windows.medium
27
27
shell : bash.exe -eo pipefail
28
28
29
+
30
+ release_filter : &release_filter
31
+ filters :
32
+ tags :
33
+ only : /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
34
+ branches :
35
+ ignore : /.*/
36
+
29
37
workflows :
30
38
version : 2
31
39
build-and-test :
32
40
jobs :
33
41
- lint
34
42
- check-openapi
35
- - build-all
36
43
- test-race :
37
44
name : test-linux-amd64
38
45
- test-build :
@@ -70,6 +77,24 @@ workflows:
70
77
arch : amd64
71
78
requires :
72
79
- test-build-amd64-windows
80
+ - build :
81
+ name : build-<< matrix.os >>-<< matrix.arch >>
82
+ matrix :
83
+ parameters :
84
+ os : [ linux, darwin, windows ]
85
+ arch : [ amd64, arm64 ]
86
+ exclude :
87
+ - os : darwin
88
+ arch : arm64
89
+ - os : windows
90
+ arch : arm64
91
+ - build-packages :
92
+ sign : false
93
+ requires :
94
+ - build-darwin-amd64
95
+ - build-linux-amd64
96
+ - build-linux-arm64
97
+ - build-windows-amd64
73
98
release-nightly :
74
99
triggers :
75
100
- schedule :
@@ -119,6 +144,24 @@ workflows:
119
144
arch : amd64
120
145
requires :
121
146
- test-build-amd64-windows
147
+ - build :
148
+ name : build-<< matrix.os >>-<< matrix.arch >>
149
+ matrix :
150
+ parameters :
151
+ os : [ linux, darwin, windows ]
152
+ arch : [ amd64, arm64 ]
153
+ exclude :
154
+ - os : darwin
155
+ arch : arm64
156
+ - os : windows
157
+ arch : arm64
158
+ - build-packages :
159
+ sign : true
160
+ requires :
161
+ - build-darwin-amd64
162
+ - build-linux-amd64
163
+ - build-linux-arm64
164
+ - build-windows-amd64
122
165
- release :
123
166
is-nightly : true
124
167
requires :
@@ -129,39 +172,20 @@ workflows:
129
172
- test-linux-arm64
130
173
- test-mac
131
174
- test-windows
175
+ - build-packages
132
176
release-tag :
133
177
jobs :
134
178
- changelog :
135
- filters :
136
- branches :
137
- ignore : /.*/
138
- tags :
139
- only : /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
179
+ << : *release_filter
140
180
- lint :
141
- filters :
142
- branches :
143
- ignore : /.*/
144
- tags :
145
- only : /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
181
+ << : *release_filter
146
182
- check-openapi :
147
- filters :
148
- branches :
149
- ignore : /.*/
150
- tags :
151
- only : /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
183
+ << : *release_filter
152
184
- test-race :
153
185
name : test-linux-amd64
154
- filters :
155
- branches :
156
- ignore : /.*/
157
- tags :
158
- only : /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
186
+ << : *release_filter
159
187
- test-build :
160
- filters :
161
- branches :
162
- ignore : /.*/
163
- tags :
164
- only : /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
188
+ << : *release_filter
165
189
matrix :
166
190
parameters :
167
191
os : [ linux, darwin, windows ]
@@ -176,47 +200,51 @@ workflows:
176
200
- os : linux
177
201
arch : amd64
178
202
- test-prebuilt :
203
+ << : *release_filter
179
204
name : test-linux-arm64
180
- filters :
181
- branches :
182
- ignore : /.*/
183
- tags :
184
- only : /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
185
205
executor : linux-arm64
186
206
os : linux
187
207
arch : arm64
188
208
requires :
189
209
- test-build-arm64-linux
190
210
- test-prebuilt :
211
+ << : *release_filter
191
212
name : test-mac
192
- filters :
193
- branches :
194
- ignore : /.*/
195
- tags :
196
- only : /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
197
213
executor : mac
198
214
os : darwin
199
215
arch : amd64
200
216
requires :
201
217
- test-build-amd64-darwin
202
218
- test-prebuilt :
219
+ << : *release_filter
203
220
name : test-windows
204
- filters :
205
- branches :
206
- ignore : /.*/
207
- tags :
208
- only : /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
209
221
executor : windows
210
222
os : windows
211
223
arch : amd64
212
224
requires :
213
225
- test-build-amd64-windows
226
+ - build :
227
+ << : *release_filter
228
+ name : build-<< matrix.os >>-<< matrix.arch >>
229
+ matrix :
230
+ parameters :
231
+ os : [ linux, darwin, windows ]
232
+ arch : [ amd64, arm64 ]
233
+ exclude :
234
+ - os : darwin
235
+ arch : arm64
236
+ - os : windows
237
+ arch : arm64
238
+ - build-packages :
239
+ << : *release_filter
240
+ sign : true
241
+ requires :
242
+ - build-darwin-amd64
243
+ - build-linux-amd64
244
+ - build-linux-arm64
245
+ - build-windows-amd64
214
246
- release :
215
- filters :
216
- branches :
217
- ignore : /.*/
218
- tags :
219
- only : /^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|alpha|beta)[0-9]+)?$/
247
+ << : *release_filter
220
248
is-nightly : false
221
249
requires :
222
250
- changelog
@@ -226,6 +254,7 @@ workflows:
226
254
- test-linux-arm64
227
255
- test-mac
228
256
- test-windows
257
+ - build-packages
229
258
230
259
commands :
231
260
setup :
@@ -247,11 +276,6 @@ commands:
247
276
echo 'export PATH=${GOPATH}/bin:${PATH}' >> $BASH_ENV
248
277
mkdir -p ${HOME}/.cache
249
278
echo 'export GOCACHE=${HOME}/.cache' >> $BASH_ENV
250
- install-goreleaser :
251
- steps :
252
- - run :
253
- name : Install goreleaser
254
- command : ./scripts/ci/download-goreleaser.sh v1.14.0
255
279
256
280
jobs :
257
281
lint :
@@ -289,23 +313,6 @@ jobs:
289
313
command : git submodule update --init --recursive
290
314
- run : make checkopenapi
291
315
292
- build-all :
293
- executor : linux-amd64
294
- steps :
295
- - checkout
296
- - setup
297
- - install-goreleaser
298
- - run :
299
- name : Make a pseudo-tag for the snapshot build
300
- command : |
301
- latest_tag=$(git describe --tags --abbrev=0)
302
- git tag ${latest_tag}+SNAPSHOT.$(git rev-parse --short HEAD)
303
- - run :
304
- name : Cross-build all targets
305
- command : IS_SNAPSHOT=1 goreleaser release --rm-dist --skip-publish --skip-sign --skip-validate
306
- - store_artifacts :
307
- path : dist
308
-
309
316
release :
310
317
parameters :
311
318
is-nightly :
@@ -315,38 +322,25 @@ jobs:
315
322
- checkout
316
323
- attach_workspace :
317
324
at : .
318
- - setup
319
325
- run :
320
- name : Import GPG key
321
326
command : |
322
- echo -e "$GPG_PRIVATE_KEY" > private.key
323
- gpg --batch --import private.key
324
- - install-goreleaser
327
+ export DEBIAN_FRONTEND=noninteractive
328
+ sudo apt-get update -y
329
+ sudo apt-get install -y awscli gnupg
330
+
331
+ gpg --import --batch \<<<"${GPG_PRIVATE_KEY//$'\\n'/$'\n'}"
325
332
- when :
326
333
condition : << parameters.is-nightly >>
327
334
steps :
328
335
- run :
329
- name : Make a pseudo-tag for the nightly build
330
- command : |
331
- latest_tag=$(git describe --tags --abbrev=0)
332
- git tag ${latest_tag}+nightly.$(date +%Y.%m.%d)
333
- - run :
334
- name : Publish nightly snapshot release
335
- command : IS_NIGHTLY=1 goreleaser release --rm-dist
336
+ command : .circleci/scripts/upload-artifacts nightly
336
337
- unless :
337
338
condition : << parameters.is-nightly >>
338
339
steps :
339
340
- run :
340
- name : Publish tagged release
341
- command : goreleaser release --rm-dist
342
- - run :
343
- command : |
344
- export DEBIAN_FRONTEND=noninteractive
345
- sudo apt-get update
346
- sudo apt-get install awscli
347
- .circleci/scripts/upload-latest-artifacts
341
+ command : .circleci/scripts/upload-artifacts release
348
342
- store_artifacts :
349
- path : dist
343
+ path : packages
350
344
351
345
test-build :
352
346
executor : cross-builder
@@ -403,6 +397,68 @@ jobs:
403
397
- store_test_results :
404
398
path : ./test-results
405
399
400
+ build :
401
+ executor : cross-builder
402
+ parameters :
403
+ os :
404
+ type : string
405
+ arch :
406
+ type : string
407
+ steps :
408
+ - checkout
409
+ - run :
410
+ name : Build Binaries
411
+ command : |
412
+ GOOS=<<parameters.os>> GOARCH=<<parameters.arch>> make
413
+ - store_artifacts :
414
+ path : bin
415
+ - persist_to_workspace :
416
+ root : .
417
+ paths : bin
418
+
419
+ build-packages :
420
+ docker :
421
+ - image : ubuntu:latest
422
+ resource_class : small
423
+ parameters :
424
+ sign :
425
+ type : boolean
426
+ steps :
427
+ - attach_workspace :
428
+ at : /tmp/workspace
429
+ - checkout
430
+ - run :
431
+ name : Build Packages
432
+ command : |
433
+ export DEBIAN_FRONTEND=noninteractive
434
+ apt-get update
435
+ apt-get install --yes \
436
+ build-essential \
437
+ git \
438
+ gnupg \
439
+ rpm \
440
+ ruby-dev
441
+ gem install fpm
442
+
443
+ if [[ "<< parameters.sign >>" == "true" ]]
444
+ then
445
+ gpg --import --batch \<<<"${GPG_PRIVATE_KEY//$'\\n'/$'\n'}"
446
+
447
+ export SIGN_PACKAGES=1
448
+ fi
449
+
450
+ mkdir -p packages
451
+ OS=darwin ARCH=amd64 scripts/ci/build-packages /tmp/workspace/bin/darwin/amd64/influx "${PWD}/packages"
452
+ OS=linux ARCH=amd64 scripts/ci/build-packages /tmp/workspace/bin/linux/amd64/influx "${PWD}/packages"
453
+ OS=linux ARCH=arm64 scripts/ci/build-packages /tmp/workspace/bin/linux/arm64/influx "${PWD}/packages"
454
+ OS=windows ARCH=amd64 scripts/ci/build-packages /tmp/workspace/bin/windows/amd64/influx "${PWD}/packages"
455
+ - store_artifacts :
456
+ path : packages/
457
+ - persist_to_workspace :
458
+ root : .
459
+ paths :
460
+ - packages
461
+
406
462
changelog :
407
463
docker :
408
464
- image : quay.io/influxdb/changelogger:a20523cf8594eb93920e74d0189d6602a76a6146
0 commit comments