forked from SumoLogic/sumologic-otel-collector
-
Notifications
You must be signed in to change notification settings - Fork 1
530 lines (431 loc) · 17.8 KB
/
release_builds.yml
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
name: Releases
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-sumo-[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-sumo-[0-9]+-alpha.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-sumo-[0-9]+-beta.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-sumo-[0-9]+-rc.[0-9]+'
defaults:
run:
shell: bash
jobs:
build:
name: Build
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
include:
- arch_os: linux_amd64
runs_on: ubuntu-20.04
- arch_os: linux_arm64
runs_on: ubuntu-20.04
- arch_os: windows_amd64
runs_on: windows-2022
builder_bin_path: '${RUNNER_TEMP}\bin'
builder_bin_ext: .exe
steps:
- uses: actions/checkout@v3
- name: Fetch current branch
run: ./ci/fetch_current_branch.sh
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.19'
# As described in
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
- uses: actions/cache@v3
with:
path: |
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
/c/Users/runneradmin/go/pkg/mod
/c/Users/runneradmin/AppData/Local/go-build
key: ${{matrix.arch_os}}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{matrix.arch_os}}-go-
- name: Set default BUILDER_BIN_PATH
run: echo "BUILDER_BIN_PATH=${HOME}/bin" >> $GITHUB_ENV
- name: Override BUILDER_BIN_PATH if set in matrix
run: echo "BUILDER_BIN_PATH=${{matrix.builder_bin_path}}" >> $GITHUB_ENV
if: matrix.builder_bin_path != ''
- name: Extract tag
id: extract_tag
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/v})"
- name: Print tag
run: echo "${{ steps.extract_tag.outputs.tag }}"
- name: Add opentelemetry-collector-builder installation dir to PATH
run: echo "$BUILDER_BIN_PATH" >> $GITHUB_PATH
- name: Install opentelemetry-collector-builder
run: make install-builder
working-directory: ./otelcolbuilder
- name: Prepare tags in otelcolbuilder's config
run: make prepare-tag TAG=${{ steps.extract_tag.outputs.tag }}
- name: Build
run: make otelcol-sumo-${{matrix.arch_os}}
working-directory: ./otelcolbuilder
- name: Set filename
id: set_filename
run: echo "::set-output name=filename::$(echo otelcol-sumo-${{ steps.extract_tag.outputs.tag }}-${{matrix.arch_os}})${{matrix.builder_bin_ext}}"
- name: Rename to include tag in filename
run: cp otelcol-sumo-${{matrix.arch_os}}${{matrix.builder_bin_ext}} ${{ steps.set_filename.outputs.filename }}
working-directory: ./otelcolbuilder/cmd
- name: Show included modules
working-directory: ./otelcolbuilder/cmd
run: |
go version -m ${{ steps.set_filename.outputs.filename }} | \
grep -E "/(receiver|exporter|processor|extension)/" | \
tee otelcol-sumo-${{matrix.arch_os}}_modules.txt
- name: Sign Windows binary
if: runner.os == 'Windows'
uses: skymatic/code-sign-action@v2
with:
certificate: '${{ secrets.MICROSOFT_CERTIFICATE }}'
password: '${{ secrets.MICROSOFT_CERTIFICATE_PASSWORD }}'
certificatesha1: '${{ secrets.MICROSOFT_CERTHASH }}'
certificatename: '${{ secrets.MICROSOFT_CERTNAME }}'
description: '${{ secrets.MICROSOFT_DESCRIPTION }}'
folder: ./otelcolbuilder/cmd
- name: Store binary as action artifact
uses: actions/upload-artifact@v3
with:
name: ${{matrix.arch_os}}
path: ./otelcolbuilder/cmd/${{ steps.set_filename.outputs.filename }}
if-no-files-found: error
build-darwin:
name: Build darwin
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
include:
- arch_os: darwin_amd64
runs_on: macos-latest
- arch_os: darwin_arm64
runs_on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Fetch current branch
run: ./ci/fetch_current_branch.sh
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.19'
# As described in
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
- uses: actions/cache@v3
with:
path: |
/Users/runner/go/pkg/mod
/Users/runner/Library/Caches/go-build
key: ${{matrix.arch_os}}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{matrix.arch_os}}-go-
- name: Extract tag
id: extract_tag
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/v})"
- name: Add opentelemetry-collector-builder installation dir to PATH
run: echo "$HOME/bin" >> $GITHUB_PATH
- name: Install opentelemetry-collector-builder
run: make install-builder
working-directory: ./otelcolbuilder
- name: Prepare tags in otelcolbuilder's config
run: make prepare-tag TAG=${{ steps.extract_tag.outputs.tag }}
- name: Build
run: make otelcol-sumo-${{matrix.arch_os}}
working-directory: ./otelcolbuilder
- name: Set filename
id: set_filename
run: echo "::set-output name=filename::$(echo otelcol-sumo-${{ steps.extract_tag.outputs.tag }}-${{matrix.arch_os}})"
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
# The certificates in a PKCS12 file encoded as a base64 string
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
# The password used to import the PKCS12 file.
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
# NOTE: gon's brew tap (as many others) has stopped working for some reason.
# Related issue: https://github.com/mitchellh/gon/issues/56
# - name: Install gon via HomeBrew for code signing and app notarization
# run: |
# brew tap mitchellh/gon
# brew install mitchellh/gon/gon
- name: Install gon for code signing and app notarization
run: |
curl -Lo gon.dmg https://github.com/mitchellh/gon/releases/download/v0.2.3/gon_macos.dmg
sudo hdiutil attach gon.dmg
cp /Volumes/gon/gon "$HOME/bin"
- name: Sign the mac binaries with Gon
env:
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
working-directory: ./otelcolbuilder/
run: make ${{matrix.arch_os}}-sign
- name: Rename .dmg to include tag in filename
run: cp otelcol-sumo-${{matrix.arch_os}}.dmg ${{ steps.set_filename.outputs.filename }}.dmg
working-directory: ./otelcolbuilder/cmd
- name: Rename binary to include tag in filename
run: cp otelcol-sumo-${{matrix.arch_os}} ${{ steps.set_filename.outputs.filename }}
working-directory: ./otelcolbuilder/cmd
- name: Show included modules
working-directory: ./otelcolbuilder/cmd
run: |
go version -m ${{ steps.set_filename.outputs.filename }} | \
grep -E "/(receiver|exporter|processor|extension)/" | \
tee otelcol-sumo-${{matrix.arch_os}}_modules.txt
# Store binary and .dmg into pipeline artifacts after they have been signed
- name: Store .dmg as action artifact
uses: actions/upload-artifact@v3
with:
name: ${{matrix.arch_os}}.dmg
path: ./otelcolbuilder/cmd/${{ steps.set_filename.outputs.filename }}.dmg
if-no-files-found: error
- name: Store binary as action artifact
uses: actions/upload-artifact@v3
with:
name: ${{matrix.arch_os}}
path: ./otelcolbuilder/cmd/${{ steps.set_filename.outputs.filename }}
if-no-files-found: error
# pipeline to build FIPS compliance binary on Go+BoringCrypto
build-fips:
name: Build
runs-on: ubuntu-20.04
strategy:
matrix:
go: [ '1.18.7b7' ]
arch_os: [ 'linux_amd64' ]
steps:
- uses: actions/checkout@v3
- name: Fetch current branch
run: ./ci/fetch_current_branch.sh
- name: Install Go+BoringCrypto
run: |
curl -LJ "https://go-boringcrypto.storage.googleapis.com/go${{ matrix.go }}.linux-amd64.tar.gz" -o go.linux-amd64.tar.gz \
&& sudo rm -rf /usr/local/go \
&& sudo tar -C /usr/local -xzf go.linux-amd64.tar.gz \
&& sudo rm go.linux-amd64.tar.gz \
&& sudo ln -s /usr/local/go/bin/go /usr/local/bin
# As described in
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
- uses: actions/cache@v3
with:
path: |
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Extract tag
id: extract_tag
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/v})"
- name: Add opentelemetry-collector-builder installation dir to PATH
run: echo "$HOME/bin" >> $GITHUB_PATH
- name: Install opentelemetry-collector-builder
run: make install-builder
working-directory: ./otelcolbuilder
- name: Prepare tags in otelcolbuilder's config
run: make prepare-tag TAG=${{ steps.extract_tag.outputs.tag }}
- name: Build
run: make otelcol-sumo-${{matrix.arch_os}} FIPS_SUFFIX="-fips" CGO_ENABLED=1
working-directory: ./otelcolbuilder
- name: Set filename
id: set_filename
run: echo "::set-output name=filename::$(echo otelcol-sumo-${{ steps.extract_tag.outputs.tag }}-fips-${{matrix.arch_os}})"
- name: Rename to include tag in filename
run: cp otelcol-sumo-fips-${{matrix.arch_os}} ${{ steps.set_filename.outputs.filename }}
working-directory: ./otelcolbuilder/cmd
- name: Show BoringSSL symbols
working-directory: ./otelcolbuilder/cmd
run: |
go tool nm ${{ steps.set_filename.outputs.filename }} | \
grep "_Cfunc__goboringcrypto_"
- name: Show included modules
working-directory: ./otelcolbuilder/cmd
run: |
go version -m ${{ steps.set_filename.outputs.filename }} | \
grep -E "/(receiver|exporter|processor|extension)/" | \
tee otelcol-sumo-fips-${{matrix.arch_os}}_modules.txt
- name: Store binary as action artifact
uses: actions/upload-artifact@v3
with:
name: ${{matrix.arch_os}}
path: ./otelcolbuilder/cmd/${{ steps.set_filename.outputs.filename }}
if-no-files-found: error
build-container-images:
name: Build container
runs-on: ubuntu-20.04
needs:
- build
- build-fips
strategy:
matrix:
arch_os: [ 'linux_amd64', 'linux_arm64']
steps:
- uses: actions/checkout@v3
- name: Extract tag
id: extract_tag
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/v})"
- name: Print tag
run: echo "${{ steps.extract_tag.outputs.tag }}"
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Buildx
id: buildx
uses: docker/[email protected]
- name: Show Buildx platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Set filename
id: set_filename
run: echo "::set-output name=filename::$(echo otelcol-sumo-${{ steps.extract_tag.outputs.tag }}-${{matrix.arch_os}})"
- name: Set filename for FIPS
id: set_filename_fips
run: echo "::set-output name=filename_fips::$(echo otelcol-sumo-${{ steps.extract_tag.outputs.tag }}-fips-${{matrix.arch_os}})"
- name: Login to Open Source ECR
run: make login
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Download binary action artifact from build phase (regular binary and FIPS binary)
uses: actions/download-artifact@v3
with:
name: ${{matrix.arch_os}}
path: artifacts/
- name: Build and push FIPS image to Open Source ECR
if: matrix.arch_os == 'linux_amd64'
run: |
cp artifacts/${{ steps.set_filename_fips.outputs.filename_fips }} otelcol-sumo
make build-push-container-multiplatform \
BUILD_TAG=${{ steps.extract_tag.outputs.tag }}-fips \
PLATFORM=${{ matrix.arch_os }} \
LATEST_TAG_FIPS_SUFFIX="-fips"
- name: Build and push image to Open Source ECR
run: |
cp artifacts/${{ steps.set_filename.outputs.filename }} otelcol-sumo
make build-push-container-multiplatform \
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \
PLATFORM=${{ matrix.arch_os }}
push-docker-manifest:
name: Push joint container manifest
runs-on: ubuntu-20.04
needs:
# Require darwin build to succeed to prevent pushing container images
# when darwin build fails.
- build-darwin
- build-container-images
steps:
- uses: actions/checkout@v3
- name: Extract tag
id: extract_tag
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/v})"
- name: Print tag
run: echo "${{ steps.extract_tag.outputs.tag }}"
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Buildx
id: buildx
uses: docker/[email protected]
- name: Show Buildx platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login to Open Source ECR
run: make login
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Push joint FIPS container manifest for all platforms to Open Source ECR
run: |
make push-container-manifest \
BUILD_TAG=${{ steps.extract_tag.outputs.tag }}-fips \
PLATFORMS="linux/amd64" \
LATEST_TAG_FIPS_SUFFIX="-fips"
- name: Push joint container manifest for all platforms to Open Source ECR
run: |
make push-container-manifest \
BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \
PLATFORMS="linux/amd64 linux/arm64"
package-msi:
name: Package MSI
runs-on: windows-2019
needs:
- build
steps:
- uses: actions/checkout@v3
- name: Fetch current branch
run: ./ci/fetch_current_branch.sh
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Fetch binary artifact for windows/amd64
uses: actions/download-artifact@v3
with:
name: windows_amd64
path: ./otelcolbuilder/cmd
- name: Rename binary for windows/amd64
working-directory: ./otelcolbuilder/cmd
run: mv otelcol-sumo-*-sumo-*-windows_amd64.exe otelcol-sumo-windows_amd64.exe
- name: Set VERSION_TAG
run: echo "VERSION_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Set PRODUCT_VERSION
run: echo "PRODUCT_VERSION=$(./ci/get_productversion.sh)" >> $GITHUB_ENV
- name: Build MSI for windows/amd64
working-directory: ./packaging/msi/wix
run: msbuild.exe -p:Configuration=Release -p:Platform=x64 -p:ProductVersion=$PRODUCT_VERSION -Restore
- name: Sign MSI
uses: skymatic/code-sign-action@v2
with:
certificate: '${{ secrets.MICROSOFT_CERTIFICATE }}'
password: '${{ secrets.MICROSOFT_CERTIFICATE_PASSWORD }}'
certificatesha1: '${{ secrets.MICROSOFT_CERTHASH }}'
certificatename: '${{ secrets.MICROSOFT_CERTNAME }}'
description: '${{ secrets.MICROSOFT_DESCRIPTION }}'
folder: ./packaging/msi/wix/bin/x64/en-US
- name: Store MSI as action artifact for windows/amd64
uses: actions/upload-artifact@v3
with:
name: windows_amd64_msi
path: ./packaging/msi/wix/bin/x64/en-US/*.msi
if-no-files-found: error
create-release:
name: Create Github release
runs-on: ubuntu-20.04
needs:
- build
- build-darwin
- build-fips
- build-container-images
- push-docker-manifest
- package-msi
steps:
- name: Extract tag
id: extract_tag
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/v})"
- name: Print tag
run: echo "v${{ steps.extract_tag.outputs.tag }}"
- name: Download all binaries stored as artifact
uses: actions/download-artifact@v3
with:
path: artifacts/
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: false
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
body: |
## v${{ steps.extract_tag.outputs.tag }}
**TODO**
### Upstream releases
** TODO: Add upstream versions in the links below**
Core: https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v
Contrib: https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v
### Changelog
**TODO**
### Container images:
```
docker pull public.ecr.aws/sumologic/sumologic-otel-collector:${{ steps.extract_tag.outputs.tag }}
```
artifacts: "artifacts/*/*"
artifactErrorsFailBuild: true
replacesArtifacts: true