build.yml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. ---
  2. # Ci code for building release artifacts.
  3. name: Build
  4. on:
  5. push: # Master branch checks only validate the build and generate artifacts for testing.
  6. branches:
  7. - master
  8. pull_request: null # PR checks only validate the build and generate artifacts for testing.
  9. workflow_dispatch: # Dispatch runs build and validate, then push to the appropriate storage location.
  10. inputs:
  11. type:
  12. description: Build Type
  13. default: nightly
  14. required: true
  15. version:
  16. description: Version Tag
  17. default: nightly
  18. required: true
  19. concurrency: # This keeps multiple instances of the job from running concurrently for the same ref and event type.
  20. group: build-${{ github.ref }}-${{ github.event_name }}
  21. cancel-in-progress: true
  22. jobs:
  23. build-dist: # Build the distribution tarball and store it as an artifact.
  24. name: Build Distribution Tarball
  25. runs-on: ubuntu-latest
  26. outputs:
  27. distfile: ${{ steps.build.outputs.distfile }}
  28. steps:
  29. - name: Checkout
  30. id: checkout
  31. uses: actions/checkout@v3
  32. with:
  33. fetch-depth: 0
  34. submodules: recursive
  35. - name: Mark Stable
  36. id: channel
  37. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly'
  38. run: |
  39. sed -i 's/^RELEASE_CHANNEL="nightly" *#/RELEASE_CHANNEL="stable" #/' netdata-installer.sh
  40. - name: Build
  41. id: build
  42. run: |
  43. mkdir -p artifacts
  44. ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
  45. autoreconf -ivf
  46. ./configure --prefix=/usr \
  47. --sysconfdir=/etc \
  48. --localstatedir=/var \
  49. --libexecdir=/usr/libexec \
  50. --with-zlib \
  51. --with-math \
  52. --with-user=netdata
  53. make dist
  54. echo "::set-output name=distfile::$(find . -name 'netdata-*.tar.gz')"
  55. cp netdata-*.tar.gz artifacts/
  56. - name: Store
  57. id: store
  58. uses: actions/upload-artifact@v3
  59. with:
  60. name: dist-tarball
  61. path: artifacts/*.tar.gz
  62. retention-days: 30
  63. - name: Failure Notification
  64. uses: rtCamp/action-slack-notify@v2
  65. env:
  66. SLACK_COLOR: 'danger'
  67. SLACK_FOOTER: ''
  68. SLACK_ICON_EMOJI: ':github-actions:'
  69. SLACK_TITLE: 'Distribution tarball creation failed:'
  70. SLACK_USERNAME: 'GitHub Actions'
  71. SLACK_MESSAGE: |-
  72. ${{ github.repository }}: Failed to create source tarball for distribution.
  73. Checkout: ${{ steps.checkout.outcome }}
  74. Mark stable: ${{ steps.channel.outcome }}
  75. Build: ${{ steps.build.outcome }}
  76. Store: ${{ steps.store.outcome }}
  77. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  78. if: >-
  79. ${{
  80. failure()
  81. && startsWith(github.ref, 'refs/heads/master')
  82. && github.event_name != 'pull_request'
  83. }}
  84. build-static: # Build the static binary archives, and store them as artifacts.
  85. name: Build Static
  86. runs-on: ubuntu-latest
  87. strategy:
  88. matrix:
  89. arch:
  90. - 'x86_64'
  91. - 'armv7l'
  92. - 'aarch64'
  93. - 'ppc64le'
  94. steps:
  95. - name: Checkout
  96. id: checkout
  97. uses: actions/checkout@v3
  98. with:
  99. fetch-depth: 0
  100. submodules: recursive
  101. - name: Mark Stable
  102. id: channel
  103. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly'
  104. run: |
  105. sed -i 's/^RELEASE_CHANNEL="nightly" *#/RELEASE_CHANNEL="stable" #/' netdata-installer.sh packaging/makeself/install-or-update.sh
  106. - name: Build
  107. id: build
  108. run: .github/scripts/build-static.sh ${{ matrix.arch }}
  109. - name: Store
  110. id: store
  111. uses: actions/upload-artifact@v3
  112. with:
  113. name: static-archive
  114. path: artifacts/*.gz.run
  115. retention-days: 30
  116. - name: Failure Notification
  117. uses: rtCamp/action-slack-notify@v2
  118. env:
  119. SLACK_COLOR: 'danger'
  120. SLACK_FOOTER: ''
  121. SLACK_ICON_EMOJI: ':github-actions:'
  122. SLACK_TITLE: 'Static build failed:'
  123. SLACK_USERNAME: 'GitHub Actions'
  124. SLACK_MESSAGE: |-
  125. ${{ github.repository }}: Failed to create static installer archive for ${{ matrix.arch }}.
  126. Checkout: ${{ steps.checkout.outcome }}
  127. Mark stable: ${{ steps.channel.outcome }}
  128. Build: ${{ steps.build.outcome }}
  129. Store: ${{ steps.store.outcome }}
  130. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  131. if: >-
  132. ${{
  133. failure()
  134. && startsWith(github.ref, 'refs/heads/master')
  135. && github.event_name != 'pull_request'
  136. }}
  137. matrix: # Generate the shared build matrix for our build tests.
  138. name: Prepare Build Matrix
  139. runs-on: ubuntu-latest
  140. outputs:
  141. matrix: ${{ steps.set-matrix.outputs.matrix }}
  142. steps:
  143. - name: Checkout
  144. id: checkout
  145. uses: actions/checkout@v3
  146. - name: Prepare tools
  147. id: prepare
  148. run: |
  149. sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
  150. - name: Read build matrix
  151. id: set-matrix
  152. shell: python3 {0}
  153. run: |
  154. from ruamel.yaml import YAML
  155. import json
  156. yaml = YAML(typ='safe')
  157. with open('.github/data/distros.yml') as f:
  158. data = yaml.load(f)
  159. del data['platform_map']
  160. for i, v in enumerate(data['include']):
  161. data['include'][i]['artifact_key'] = data['include'][i]['distro'] + str(data['include'][i]['version']).replace('.', '')
  162. if 'packages' in data['include'][i]:
  163. del data['include'][i]['packages']
  164. if 'base_image' in data['include'][i]:
  165. data['include'][i]['distro'] = data['include'][i]['base_image']
  166. del data['include'][i]['base_image']
  167. data['include'][i]['distro'] = ':'.join([data['include'][i]['distro'], str(data['include'][i]['version'])])
  168. del data['include'][i]['version']
  169. matrix = json.dumps(data, sort_keys=True)
  170. print('Generated Matrix: ' + matrix)
  171. print('::set-output name=matrix::' + matrix)
  172. - name: Failure Notification
  173. uses: rtCamp/action-slack-notify@v2
  174. env:
  175. SLACK_COLOR: 'danger'
  176. SLACK_FOOTER: ''
  177. SLACK_ICON_EMOJI: ':github-actions:'
  178. SLACK_TITLE: 'Build matrix preparation failed:'
  179. SLACK_USERNAME: 'GitHub Actions'
  180. SLACK_MESSAGE: |-
  181. ${{ github.repository }}: Failed to prepare build matrix for build checks.
  182. Checkout: ${{ steps.checkout.outcome }}
  183. Prepare tools: ${{ steps.prepare.outcome }}
  184. Read build matrix: ${{ steps.set-matrix.outcome }}
  185. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  186. if: >-
  187. ${{
  188. failure()
  189. && startsWith(github.ref, 'refs/heads/master')
  190. && github.event_name != 'pull_request'
  191. }}
  192. prepare-test-images: # Prepare the test environments for our build checks. This also checks dependency handling code for each tested environment.
  193. name: Prepare Test Environments
  194. runs-on: ubuntu-latest
  195. needs:
  196. - matrix
  197. env:
  198. RETRY_DELAY: 300
  199. strategy:
  200. # Unlike the actal build tests, this completes _very_ fast (average of about 3 minutes for each job), so we
  201. # just run everything in parallel instead lof limiting job concurrency.
  202. fail-fast: false
  203. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  204. steps:
  205. - name: Checkout
  206. id: checkout
  207. uses: actions/checkout@v3
  208. - name: Setup Buildx
  209. id: buildx
  210. uses: docker/setup-buildx-action@v1
  211. - name: Build test environment
  212. id: build1
  213. uses: docker/build-push-action@v2
  214. continue-on-error: true # We retry 3 times at 5 minute intervals if there is a failure here.
  215. with:
  216. push: false
  217. load: false
  218. file: .github/dockerfiles/Dockerfile.build_test
  219. build-args: |
  220. BASE=${{ matrix.distro }}
  221. PRE=${{ matrix.env_prep }}
  222. RMJSONC=${{ matrix.jsonc_removal }}
  223. outputs: type=oci,dest=/tmp/image.tar
  224. tags: test:${{ matrix.artifact_key }}
  225. - name: Retry delay
  226. if: ${{ steps.build1.outcome }} == 'failure'
  227. run: sleep "${RETRY_DELAY}"
  228. - name: Build test environment (attempt 2)
  229. if: ${{ steps.build1.outcome }} == 'failure'
  230. id: build2
  231. uses: docker/build-push-action@v2
  232. continue-on-error: true # We retry 3 times at 5 minute intervals if there is a failure here.
  233. with:
  234. push: false
  235. load: false
  236. file: .github/dockerfiles/Dockerfile.build_test
  237. build-args: |
  238. BASE=${{ matrix.distro }}
  239. PRE=${{ matrix.env_prep }}
  240. RMJSONC=${{ matrix.jsonc_removal }}
  241. outputs: type=oci,dest=/tmp/image.tar
  242. tags: test:${{ matrix.artifact_key }}
  243. - name: Retry delay
  244. if: ${{ steps.build1.outcome }} == 'failure' && ${{ steps.build2.outcome }} == 'failure'
  245. run: sleep "${RETRY_DELAY}"
  246. - name: Build test environment (attempt 3)
  247. if: ${{ steps.build1.outcome }} == 'failure' && ${{ steps.build2.outcome }} == 'failure'
  248. id: build3
  249. uses: docker/build-push-action@v2
  250. with:
  251. push: false
  252. load: false
  253. file: .github/dockerfiles/Dockerfile.build_test
  254. build-args: |
  255. BASE=${{ matrix.distro }}
  256. PRE=${{ matrix.env_prep }}
  257. RMJSONC=${{ matrix.jsonc_removal }}
  258. outputs: type=oci,dest=/tmp/image.tar
  259. tags: test:${{ matrix.artifact_key }}
  260. - name: Upload image artifact
  261. id: upload
  262. uses: actions/upload-artifact@v3
  263. with:
  264. name: ${{ matrix.artifact_key }}-test-env
  265. path: /tmp/image.tar
  266. retention-days: 30
  267. - name: Failure Notification
  268. uses: rtCamp/action-slack-notify@v2
  269. env:
  270. SLACK_COLOR: 'danger'
  271. SLACK_FOOTER: ''
  272. SLACK_ICON_EMOJI: ':github-actions:'
  273. SLACK_TITLE: 'Test environment preparation for ${{ matrix.distro }} failed:'
  274. SLACK_USERNAME: 'GitHub Actions'
  275. SLACK_MESSAGE: |-
  276. ${{ github.repository }}: Test environment preparation for ${{ matrix.distro }} failed.
  277. Checkout: ${{ steps.checkout.outcome }}
  278. Set up Buildx: ${{ steps.buildx.outcome }}
  279. Build test environment: ${{ steps.build1.outcome }}
  280. Build test environment (attempt 2): ${{ steps.build2.outcome }}
  281. Build test environment (attempt 3): ${{ steps.build3.outcome }}
  282. Upload: ${{ steps.upload.outcome }}
  283. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  284. if: >-
  285. ${{
  286. failure()
  287. && startsWith(github.ref, 'refs/heads/master')
  288. && github.event_name != 'pull_request'
  289. }}
  290. source-build: # Test various source build arrangements.
  291. name: Test Source Build
  292. runs-on: ubuntu-latest
  293. needs:
  294. - matrix
  295. - prepare-test-images
  296. strategy:
  297. fail-fast: false
  298. max-parallel: 8
  299. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  300. steps:
  301. - name: Checkout
  302. id: checkout
  303. uses: actions/checkout@v3
  304. with:
  305. submodules: recursive
  306. - name: Fetch test environment
  307. id: fetch
  308. uses: actions/download-artifact@v3
  309. with:
  310. name: ${{ matrix.artifact_key }}-test-env
  311. - name: Load test environment
  312. id: load
  313. run: |
  314. docker load --input image.tar | tee image-info.txt
  315. echo "::set-output name=image::$(cut -d ':' -f 3 image-info.txt)"
  316. - name: Regular build on ${{ matrix.distro }}
  317. id: build-basic
  318. run: |
  319. docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
  320. /bin/sh -c 'autoreconf -ivf && ./configure && make -j2'
  321. - name: netdata-installer on ${{ matrix.distro }}, disable cloud
  322. id: build-no-cloud
  323. run: |
  324. docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
  325. /bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --disable-cloud'
  326. - name: netdata-installer on ${{ matrix.distro }}, require cloud
  327. id: build-cloud
  328. run: |
  329. docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
  330. /bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --require-cloud'
  331. - name: netdata-installer on ${{ matrix.distro }}, require cloud, no JSON-C
  332. id: build-no-jsonc
  333. if: matrix.jsonc_removal != ''
  334. run: |
  335. docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
  336. /bin/sh -c '/rmjsonc.sh && ./netdata-installer.sh --dont-wait --dont-start-it --require-cloud'
  337. - name: Failure Notification
  338. uses: rtCamp/action-slack-notify@v2
  339. env:
  340. SLACK_COLOR: 'danger'
  341. SLACK_FOOTER: ''
  342. SLACK_ICON_EMOJI: ':github-actions:'
  343. SLACK_TITLE: 'Build tests for ${{ matrix.distro }} failed:'
  344. SLACK_USERNAME: 'GitHub Actions'
  345. SLACK_MESSAGE: |-
  346. ${{ github.repository }}: Build tests for ${{ matrix.distro }} failed.
  347. Checkout: ${{ steps.checkout.outcome }}
  348. Fetch test environment: ${{ steps.fetch.outcome }}
  349. Load test environment: ${{ steps.load.outcome }}
  350. Regular build: ${{ steps.build-basic.outcome }}
  351. netdata-installer, disable cloud: ${{ steps.build-no-cloud.outcome }}
  352. netdata-installer, require cloud: ${{ steps.build-cloud.outcome }}
  353. netdata-installer, no JSON-C: ${{ steps.build-no-jsonc.outcome }}
  354. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  355. if: >-
  356. ${{
  357. failure()
  358. && startsWith(github.ref, 'refs/heads/master')
  359. && github.event_name != 'pull_request'
  360. }}
  361. updater-check: # Test the generated dist archive using the updater code.
  362. name: Test Generated Distfile and Updater Code
  363. runs-on: ubuntu-latest
  364. needs:
  365. - build-dist
  366. - matrix
  367. - prepare-test-images
  368. strategy:
  369. fail-fast: false
  370. max-parallel: 8
  371. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  372. services:
  373. apache: # This gets used to serve the dist tarball for the updater script.
  374. image: httpd:2.4
  375. ports:
  376. - 8080:80
  377. volumes:
  378. - ${{ github.workspace }}:/usr/local/apache2/htdocs/
  379. steps:
  380. - name: Checkout
  381. id: checkout
  382. uses: actions/checkout@v3
  383. - name: Fetch dist tarball artifacts
  384. id: fetch-tarball
  385. uses: actions/download-artifact@v3
  386. with:
  387. name: dist-tarball
  388. path: dist-tarball
  389. - name: Prepare artifact directory
  390. id: prepare
  391. run: |
  392. mkdir -p artifacts || exit 1
  393. echo "9999.0.0-0" > artifacts/latest-version.txt || exit 1
  394. cp dist-tarball/* artifacts || exit 1
  395. cd artifacts || exit 1
  396. ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
  397. sha256sum -b ./* > "sha256sums.txt" || exit 1
  398. cat sha256sums.txt
  399. - name: Fetch test environment
  400. id: fetch-test-environment
  401. uses: actions/download-artifact@v3
  402. with:
  403. name: ${{ matrix.artifact_key }}-test-env
  404. - name: Load test environment
  405. id: load
  406. run: |
  407. docker load --input image.tar | tee image-info.txt
  408. echo "::set-output name=image::$(cut -d ':' -f 3 image-info.txt)"
  409. - name: Install netdata and run the updater on ${{ matrix.distro }}
  410. id: updater-check
  411. run: |
  412. docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --network host -w /netdata sha256:${{ steps.load.outputs.image }} \
  413. /netdata/.github/scripts/run-updater-check.sh
  414. - name: Failure Notification
  415. uses: rtCamp/action-slack-notify@v2
  416. env:
  417. SLACK_COLOR: 'danger'
  418. SLACK_FOOTER: ''
  419. SLACK_ICON_EMOJI: ':github-actions:'
  420. SLACK_TITLE: 'Updater checks for ${{ matrix.distro }} failed:'
  421. SLACK_USERNAME: 'GitHub Actions'
  422. SLACK_MESSAGE: |-
  423. ${{ github.repository }}: Updater checks for ${{ matrix.distro }} failed.
  424. Checkout: ${{ steps.checkout.outcome }}
  425. Fetch dist tarball: ${{ steps.fetch-tarball.outcome }}
  426. Prepare artifact directory: ${{ steps.prepare.outcome }}
  427. Fetch test environment: ${{ steps.fetch-test-environment.outcome }}
  428. Load test environment: ${{ steps.load.outcome }}
  429. Updater check: ${{ steps.updater-check.outcome }}
  430. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  431. if: >-
  432. ${{
  433. failure()
  434. && startsWith(github.ref, 'refs/heads/master')
  435. && github.event_name != 'pull_request'
  436. }}
  437. prepare-upload: # Consolidate the artifacts for uploading or releasing.
  438. name: Prepare Artifacts
  439. runs-on: ubuntu-latest
  440. needs:
  441. - build-dist
  442. - build-static
  443. steps:
  444. - name: Checkout
  445. id: checkout
  446. uses: actions/checkout@v3
  447. - name: Prepare Environment
  448. id: prepare
  449. run: mkdir -p artifacts
  450. - name: Retrieve Dist Tarball
  451. id: fetch-dist
  452. uses: actions/download-artifact@v3
  453. with:
  454. name: dist-tarball
  455. path: dist-tarball
  456. - name: Retrieve Static Build Artifacts
  457. id: fetch-static
  458. uses: actions/download-artifact@v3
  459. with:
  460. name: static-archive
  461. path: static-archive
  462. - name: Prepare Artifacts
  463. id: consolidate
  464. working-directory: ./artifacts/
  465. run: |
  466. mv ../dist-tarball/* . || exit 1
  467. mv ../static-archive/* . || exit 1
  468. ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
  469. cp ../packaging/version ./latest-version.txt || exit 1
  470. sha256sum -b ./* > sha256sums.txt || exit 1
  471. cat sha256sums.txt
  472. - name: Store Artifacts
  473. id: store
  474. uses: actions/upload-artifact@v3
  475. with:
  476. name: final-artifacts
  477. path: artifacts/*
  478. retention-days: 30
  479. - name: Failure Notification
  480. uses: rtCamp/action-slack-notify@v2
  481. env:
  482. SLACK_COLOR: 'danger'
  483. SLACK_FOOTER: ''
  484. SLACK_ICON_EMOJI: ':github-actions:'
  485. SLACK_TITLE: 'Failed to prepare release artifacts for upload:'
  486. SLACK_USERNAME: 'GitHub Actions'
  487. SLACK_MESSAGE: |-
  488. ${{ github.repository }}: Failed to prepare release artifacts for upload.
  489. CHeckout: ${{ steps.checkout.outcome }}
  490. Prepare environment: ${{ steps.prepare.outcome }}
  491. Fetch dist tarball: ${{ steps.fetch-dist.outcome }}
  492. Fetch static builds: ${{ steps.fetch-static.outcome }}
  493. Consolidate artifacts: ${{ steps.consolidate.outcome }}
  494. Store: ${{ steps.store.outcome }}
  495. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  496. if: >-
  497. ${{
  498. failure()
  499. && startsWith(github.ref, 'refs/heads/master')
  500. && github.event_name != 'pull_request'
  501. }}
  502. artifact-verification-dist: # Verify the regular installer works with the consolidated artifacts.
  503. name: Test Consolidated Artifacts (Source)
  504. runs-on: ubuntu-latest
  505. needs:
  506. - prepare-upload
  507. services:
  508. apache: # This gets used to serve the dist tarball for the updater script.
  509. image: httpd:2.4
  510. ports:
  511. - 8080:80
  512. volumes:
  513. - ${{ github.workspace }}:/usr/local/apache2/htdocs/
  514. steps:
  515. - name: Checkout
  516. id: checkout
  517. uses: actions/checkout@v3
  518. - name: Fetch artifacts
  519. id: fetch
  520. uses: actions/download-artifact@v3
  521. with:
  522. name: final-artifacts
  523. path: artifacts
  524. - name: Verify that artifacts work with installer
  525. id: verify
  526. env:
  527. NETDATA_TARBALL_BASEURL: http://localhost:8080/artifacts
  528. run: packaging/installer/kickstart.sh --build-only --dont-start-it --disable-telemetry --dont-wait
  529. - name: Failure Notification
  530. uses: rtCamp/action-slack-notify@v2
  531. env:
  532. SLACK_COLOR: 'danger'
  533. SLACK_FOOTER: ''
  534. SLACK_ICON_EMOJI: ':github-actions:'
  535. SLACK_TITLE: 'Artifact verification for source tarball failed.'
  536. SLACK_USERNAME: 'GitHub Actions'
  537. SLACK_MESSAGE: |-
  538. ${{ github.repository }}: Artifact verification for source tarball failed.
  539. Checkout: ${{ steps.checkout.outcome }}
  540. Fetch artifacts: ${{ steps.fetch.outcome }}
  541. Verify artifacts: ${{ steps.verify.outcome }}
  542. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  543. if: >-
  544. ${{
  545. failure()
  546. && startsWith(github.ref, 'refs/heads/master')
  547. && github.event_name != 'pull_request'
  548. }}
  549. artifact-verification-static: # Verify the static installer works with the consolidated artifacts.
  550. name: Test Consolidated Artifacts (Static)
  551. runs-on: ubuntu-latest
  552. needs:
  553. - prepare-upload
  554. services:
  555. apache: # This gets used to serve the static archives.
  556. image: httpd:2.4
  557. ports:
  558. - 8080:80
  559. volumes:
  560. - ${{ github.workspace }}:/usr/local/apache2/htdocs/
  561. steps:
  562. - name: Checkout
  563. id: checkout
  564. uses: actions/checkout@v3
  565. - name: Fetch artifacts
  566. id: fetch-artifacts
  567. uses: actions/download-artifact@v3
  568. with:
  569. name: final-artifacts
  570. path: artifacts
  571. - name: Verify that artifacts work with installer
  572. id: verify
  573. env:
  574. NETDATA_TARBALL_BASEURL: http://localhost:8080/artifacts
  575. run: packaging/installer/kickstart.sh --static-only --dont-start-it --disable-telemetry
  576. - name: Failure Notification
  577. uses: rtCamp/action-slack-notify@v2
  578. env:
  579. SLACK_COLOR: 'danger'
  580. SLACK_FOOTER: ''
  581. SLACK_ICON_EMOJI: ':github-actions:'
  582. SLACK_TITLE: 'Artifact verification for static build failed.'
  583. SLACK_USERNAME: 'GitHub Actions'
  584. SLACK_MESSAGE: |-
  585. ${{ github.repository }}: Artifact verification for static build failed.
  586. Checkout: ${{ steps.checkout.outcome }}
  587. Fetch artifacts: ${{ steps.fetch-artifacts.outcome }}
  588. Verify artifacts: ${{ steps.verify.outcome }}
  589. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  590. if: >-
  591. ${{
  592. failure()
  593. && startsWith(github.ref, 'refs/heads/master')
  594. && github.event_name != 'pull_request'
  595. }}
  596. upload-nightly: # Upload the nightly build artifacts to GCS.
  597. name: Upload Nightly Artifacts
  598. runs-on: ubuntu-latest
  599. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly'
  600. needs:
  601. - updater-check
  602. - source-build
  603. - artifact-verification-dist
  604. - artifact-verification-static
  605. steps:
  606. - name: Retrieve Artifacts
  607. id: fetch
  608. uses: actions/download-artifact@v3
  609. with:
  610. name: final-artifacts
  611. path: final-artifacts
  612. - name: Setup Gcloud
  613. id: gcloud
  614. uses: google-github-actions/setup-gcloud@v0.6.0
  615. with:
  616. project_id: ${{ secrets.GCP_NIGHTLY_STORAGE_PROJECT }}
  617. service_account_key: ${{ secrets.GCP_STORAGE_SERVICE_ACCOUNT_KEY }}
  618. export_default_credentials: true
  619. - name: Upload Artifacts
  620. id: upload
  621. uses: google-github-actions/upload-cloud-storage@v0.9.0
  622. with:
  623. destination: ${{ secrets.GCP_NIGHTLY_STORAGE_BUCKET }}
  624. gzip: false
  625. path: ./final-artifacts
  626. parent: false
  627. - name: Failure Notification
  628. uses: rtCamp/action-slack-notify@v2
  629. env:
  630. SLACK_COLOR: 'danger'
  631. SLACK_FOOTER: ''
  632. SLACK_ICON_EMOJI: ':github-actions:'
  633. SLACK_TITLE: 'Failed to upload nightly release artifacts:'
  634. SLACK_USERNAME: 'GitHub Actions'
  635. SLACK_MESSAGE: |-
  636. ${{ github.repository }}: Failed to upload nightly release artifacts.
  637. Fetch artifacts: ${{ steps.fetch.outcome }}
  638. Setup GCloud: ${{ steps.gcloud.outcome }}
  639. Upload artifacts: ${{ steps.upload.outcome }}
  640. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  641. if: >-
  642. ${{
  643. failure()
  644. && startsWith(github.ref, 'refs/heads/master')
  645. && github.event_name != 'pull_request'
  646. }}
  647. normalize-tag: # Fix the release tag if needed
  648. name: Normalize Release Tag
  649. runs-on: ubuntu-latest
  650. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release'
  651. outputs:
  652. tag: ${{ steps.tag.outputs.tag }}
  653. steps:
  654. - name: Normalize Tag
  655. id: tag
  656. run: |
  657. if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
  658. echo "::set-output name=tag::v${{ github.event.inputs.version }}"
  659. else
  660. echo "::set-output name=tag::${{ github.event.inputs.version }}"
  661. fi
  662. upload-release: # Create the draft release and upload the build artifacts.
  663. name: Create Release Draft
  664. runs-on: ubuntu-latest
  665. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release'
  666. needs:
  667. - updater-check
  668. - source-build
  669. - artifact-verification-dist
  670. - artifact-verification-static
  671. - normalize-tag
  672. steps:
  673. - name: Checkout
  674. id: checkout
  675. uses: actions/checkout@v3
  676. - name: Retrieve Artifacts
  677. id: fetch
  678. uses: actions/download-artifact@v3
  679. with:
  680. name: final-artifacts
  681. path: final-artifacts
  682. - name: Create Release
  683. id: create-release
  684. uses: ncipollo/release-action@v1
  685. with:
  686. allowUpdates: false
  687. artifactErrorsFailBuild: true
  688. artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run'
  689. draft: true
  690. tag: ${{ needs.normalize-tag.outputs.tag }}
  691. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  692. - name: Failure Notification
  693. uses: rtCamp/action-slack-notify@v2
  694. env:
  695. SLACK_COLOR: 'danger'
  696. SLACK_FOOTER: ''
  697. SLACK_ICON_EMOJI: ':github-actions:'
  698. SLACK_TITLE: 'Failed to draft release:'
  699. SLACK_USERNAME: 'GitHub Actions'
  700. SLACK_MESSAGE: |-
  701. ${{ github.repository }}: Failed to create draft release or attach artifacts.
  702. Checkout: ${{ steps.checkout.outcome }}
  703. Fetch artifacts: ${{ steps.fetch.outcome }}
  704. Create draft release: ${{ steps.create-release.outcome }}
  705. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  706. if: >-
  707. ${{
  708. failure()
  709. && github.event_name == 'workflow_dispatch'
  710. }}
  711. - name: Success Notification
  712. uses: rtCamp/action-slack-notify@v2
  713. env:
  714. SLACK_COLOR: 'good'
  715. SLACK_FOOTER: ''
  716. SLACK_ICON_EMOJI: ':github-actions:'
  717. SLACK_TITLE: 'Created agent draft release:'
  718. SLACK_USERNAME: 'GitHub Actions'
  719. SLACK_MESSAGE: "${{ github.repository }}: ${{ steps.create-release.outputs.html_url }}"
  720. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  721. if: >-
  722. ${{
  723. success()
  724. && github.event_name == 'workflow_dispatch'
  725. }}