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
531
532
533
534
535
536
537
538
|
---
# Ci code for building release artifacts.
name: Build
on:
push: # Master branch checks only validate the build and generate artifacts for testing.
branches:
- master
pull_request: null # PR checks only validate the build and generate artifacts for testing.
workflow_dispatch: # Dispatch runs build and validate, then push to the appropriate storage location.
inputs:
type:
description: Build Type
default: nightly
required: true
version:
description: Version Tag
default: nightly
required: true
concurrency: # This keeps multiple instances of the job from running concurrently for the same ref and event type.
group: release-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
build-dist: # Build the distribution tarball and store it as an artifact.
name: Build Distribution Tarball
runs-on: ubuntu-latest
outputs:
distfile: ${{ steps.build.outputs.distfile }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Mark Stable
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly'
run: |
sed -i 's/^RELEASE_CHANNEL="nightly" *#/RELEASE_CHANNEL="stable" #/' netdata-installer.sh
- name: Build
id: build
run: |
mkdir -p artifacts
./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
autoreconf -ivf
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--libexecdir=/usr/libexec \
--with-zlib \
--with-math \
--with-user=netdata
make dist
echo "::set-output name=distfile::$(find . -name 'netdata-*.tar.gz')"
cp netdata-*.tar.gz artifacts/
- name: Store
uses: actions/upload-artifact@v2
with:
name: dist-tarball
path: artifacts/*.tar.gz
retention-days: 30
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_FOOTER: ''
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Distribution tarball build failed:'
SLACK_USERNAME: 'GitHub Actions'
SLACK_MESSAGE: "Distribution tarball build failed."
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: >-
${{
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
}}
build-static: # Build the static binary archives, and store them as artifacts.
name: Build Static
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- 'x86_64'
- 'armv7l'
- 'aarch64'
- 'ppc64le'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Mark Stable
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly'
run: |
sed -i 's/^RELEASE_CHANNEL="nightly" *#/RELEASE_CHANNEL="stable" #/' netdata-installer.sh packaging/makeself/install-or-update.sh
- name: Build
run: .github/scripts/build-static.sh ${{ matrix.arch }}
- name: Store
uses: actions/upload-artifact@v2
with:
name: static-archive
path: artifacts/*.gz.run
retention-days: 30
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_FOOTER: ''
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Static build for ${{ matrix.arch }} failed:'
SLACK_USERNAME: 'GitHub Actions'
SLACK_MESSAGE: "Static build for ${{ matrix.arch }} failed."
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: >-
${{
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
}}
matrix: # Generate the shared build matrix for our build tests.
name: Prepare Build Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare tools
run: |
sudo apt-get update && sudo apt-get install -y jq
- name: Read build matrix
id: set-matrix
run: |
TASKS="$(jq -c . .github/data/build-matrix.json)"
echo "Generated Matrix: $TASKS"
echo "::set-output name=matrix::$TASKS"
prepare-test-images: # Prepare the test environments for our build checks. This also checks dependency handling code for each tested environment.
name: Prepare Test Environments
runs-on: ubuntu-latest
needs:
- matrix
strategy:
# Unlike the actal build tests, this completes _very_ fast (average of about 3 minutes for each job), so we
# just run everything in parallel instead lof limiting job concurrency.
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
steps:
- name: Git clone repository
uses: actions/checkout@v2
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
- name: Build test environment
uses: docker/build-push-action@v2
with:
push: false
load: false
file: .github/dockerfiles/Dockerfile.build_test
build-args: |
BASE=${{ matrix.distro }}
PRE=${{ matrix.pre }}
RMJSONC=${{ matrix.rmjsonc }}
outputs: type=oci,dest=/tmp/image.tar
tags: test:${{ matrix.artifact_key }}
- name: Upload image artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact_key }}-test-env
path: /tmp/image.tar
retention-days: 30
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_FOOTER: ''
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Test environment preparation for ${{ matrix.distro }} failed:'
SLACK_USERNAME: 'GitHub Actions'
SLACK_MESSAGE: "Test environment preparation for ${{ matrix.distro }} failed."
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: >-
${{
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
}}
source-build: # Test various source build arrangements.
name: Test Source Build
runs-on: ubuntu-latest
needs:
- matrix
- prepare-test-images
strategy:
fail-fast: false
max-parallel: 8
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
steps:
- name: Git clone repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Fetch test environment
uses: actions/download-artifact@v2
with:
name: ${{ matrix.artifact_key }}-test-env
- name: Load test environment
id: load
run: |
docker load --input image.tar | tee image-info.txt
echo "::set-output name=image::$(cut -d ':' -f 3 image-info.txt)"
- name: Regular build on ${{ matrix.distro }}
run: |
docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
/bin/sh -c 'autoreconf -ivf && ./configure && make -j2'
- name: netdata-installer on ${{ matrix.distro }}, disable cloud
run: |
docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
/bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --disable-cloud'
- name: netdata-installer on ${{ matrix.distro }}, require cloud
run: |
docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
/bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --require-cloud'
- name: netdata-installer on ${{ matrix.distro }}, require cloud, require ACLK-NG
run: |
docker run --security-opt seccomp=unconfined -w /netdata -e NETDATA_CONFIGURE_OPTIONS='--with-aclk-ng' \
sha256:${{ steps.load.outputs.image }} /bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --require-cloud'
- name: netdata-installer on ${{ matrix.distro }}, require cloud, no JSON-C
if: matrix.rmjsonc != ''
run: |
docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
/bin/sh -c '/rmjsonc.sh && ./netdata-installer.sh --dont-wait --dont-start-it --require-cloud'
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_FOOTER: ''
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Build tests for ${{ matrix.distro }} failed:'
SLACK_USERNAME: 'GitHub Actions'
SLACK_MESSAGE: "Build tests for ${{ matrix.distro }} failed."
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: >-
${{
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
}}
updater-check: # Test the generated dist archive using the updater code.
name: Test Generated Distfile and Updater Code
runs-on: ubuntu-latest
needs:
- build-dist
- matrix
- prepare-test-images
strategy:
fail-fast: false
max-parallel: 8
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
services:
apache: # This gets used to serve the dist tarball for the updater script.
image: httpd:2.4
ports:
- 8080:80
volumes:
- ${{ github.workspace }}:/usr/local/apache2/htdocs/
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch dist tarball artifacts
uses: actions/download-artifact@v2
with:
name: dist-tarball
path: dist-tarball
- name: Prepare artifact directory
run: |
mkdir -p artifacts || exit 1
echo "9999.0.0-0" > artifacts/latest-version.txt || exit 1
cp dist-tarball/* artifacts || exit 1
cd artifacts || exit 1
ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
sha256sum -b ./* > "sha256sums.txt" || exit 1
cat sha256sums.txt
- name: Fetch test environment
uses: actions/download-artifact@v2
with:
name: ${{ matrix.artifact_key }}-test-env
- name: Load test environment
id: load
run: |
docker load --input image.tar | tee image-info.txt
echo "::set-output name=image::$(cut -d ':' -f 3 image-info.txt)"
- name: Install netdata and run the updater on ${{ matrix.distro }}
run: |
docker run --security-opt seccomp=unconfined -e DO_NOT_TRACK=1 --network host -w /netdata sha256:${{ steps.load.outputs.image }} \
/netdata/.github/scripts/run-updater-check.sh
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_FOOTER: ''
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Updater checks for ${{ matrix.distro }} failed:'
SLACK_USERNAME: 'GitHub Actions'
SLACK_MESSAGE: "Updater checks for ${{ matrix.distro }} failed."
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: >-
${{
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
}}
prepare-upload: # Consolidate the artifacts for uploading or releasing.
name: Prepare Artifacts
runs-on: ubuntu-latest
needs:
- build-dist
- build-static
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare Environment
run: mkdir -p artifacts
- name: Retrieve Dist Tarball
uses: actions/download-artifact@v2
with:
name: dist-tarball
path: dist-tarball
- name: Retrieve Static Build Artifacts
uses: actions/download-artifact@v2
with:
name: static-archive
path: static-archive
- name: Prepare Artifacts
working-directory: ./artifacts/
run: |
mv ../dist-tarball/* . || exit 1
mv ../static-archive/* . || exit 1
ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
cp ../packaging/version ./latest-version.txt || exit 1
sha256sum -b ./* > sha256sums.txt || exit 1
cat sha256sums.txt
- name: Store Artifacts
uses: actions/upload-artifact@v2
with:
name: final-artifacts
path: artifacts/*
retention-days: 30
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_FOOTER: ''
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Failed to prepare release artifacts for upload:'
SLACK_USERNAME: 'GitHub Actions'
SLACK_MESSAGE: "Failed to prepare release artifacts for upload."
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: >-
${{
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
}}
artifact-verification-dist: # Verify the regular installer works with the consolidated artifacts.
name: Test Consolidated Artifacts (Source)
runs-on: ubuntu-latest
needs:
- prepare-upload
services:
apache: # This gets used to serve the dist tarball for the updater script.
image: httpd:2.4
ports:
- 8080:80
volumes:
- ${{ github.workspace }}:/usr/local/apache2/htdocs/
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch artifacts
uses: actions/download-artifact@v2
with:
name: final-artifacts
path: artifacts
- name: Verify that artifacts work with installer
env:
NETDATA_TARBALL_BASEURL: http://localhost:8080/artifacts
run: packaging/installer/kickstart.sh --dont-start-it --disable-telemetry --dont-wait
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_FOOTER: ''
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Artifact verification for source tarball failed.'
SLACK_USERNAME: 'GitHub Actions'
SLACK_MESSAGE: "Artifact verification for source tarball failed."
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: >-
${{
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
}}
artifact-verification-static: # Verify the static installer works with the consolidated artifacts.
name: Test Consolidated Artifacts (Static)
runs-on: ubuntu-latest
needs:
- prepare-upload
services:
apache: # This gets used to serve the static archives.
image: httpd:2.4
ports:
- 8080:80
volumes:
- ${{ github.workspace }}:/usr/local/apache2/htdocs/
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch artifacts
uses: actions/download-artifact@v2
with:
name: final-artifacts
path: artifacts
- name: Verify that artifacts work with installer
env:
NETDATA_TARBALL_BASEURL: http://localhost:8080/artifacts
run: packaging/installer/kickstart-static64.sh --dont-start-it --disable-telemetry --dont-wait
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_FOOTER: ''
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Artifact verification for static build failed.'
SLACK_USERNAME: 'GitHub Actions'
SLACK_MESSAGE: "Artifact verification for static build failed."
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: >-
${{
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
}}
upload-nightly: # Upload the nightly build artifacts to GCS.
name: Upload Nightly Artifacts
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly'
needs:
- updater-check
- source-build
- artifact-verification-dist
- artifact-verification-static
steps:
- name: Retrieve Artifacts
uses: actions/download-artifact@v2
with:
name: final-artifacts
path: final-artifacts
- name: Setup Gcloud
uses: google-github-actions/setup-gcloud@v0.3
with:
project_id: ${{ secrets.GCP_NIGHTLY_STORAGE_PROJECT }}
service_account_key: ${{ secrets.GCP_STORAGE_SERVICE_ACCOUNT_KEY }}
export_default_credentials: true
- name: Upload Artifacts
uses: google-github-actions/upload-cloud-storage@v0.5.0
with:
destination: ${{ secrets.GCP_NIGHTLY_STORAGE_BUCKET }}
gzip: false
path: ./final-artifacts
parent: false
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_FOOTER: ''
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Failed to upload nightly release artifacts:'
SLACK_USERNAME: 'GitHub Actions'
SLACK_MESSAGE: "Failed to upload nightly release artifacts."
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: >-
${{
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name != 'pull_request'
}}
upload-release: # Create the draft release and upload the build artifacts.
name: Create Release Draft
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release'
needs:
- updater-check
- source-build
- artifact-verification-dist
- artifact-verification-static
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Retrieve Artifacts
uses: actions/download-artifact@v2
with:
name: final-artifacts
path: final-artifacts
- name: Create Release
uses: ncipollo/release-action@v1
with:
allowUpdates: false
artifactErrorsFailBuild: true
artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run'
draft: true
tag: ${{ github.event.inputs.version }}
token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: 'danger'
SLACK_FOOTER: ''
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Failed to draft release:'
SLACK_USERNAME: 'GitHub Actions'
SLACK_MESSAGE: "Failed to draft release."
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
if: >-
${{
failure()
&& startsWith(github.ref, 'refs/heads/master')
&& github.event_name == 'workflow_dispatch'
}}
|