build.yml 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  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 does limited validation, then pushes 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: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
  21. cancel-in-progress: true
  22. jobs:
  23. file-check: # Check what files changed if we’re being run in a PR or on a push.
  24. name: Check Modified Files
  25. runs-on: ubuntu-latest
  26. outputs:
  27. run: ${{ steps.check-run.outputs.run }}
  28. skip-go: ${{ steps.check-go.outputs.skip-go }}
  29. steps:
  30. - name: Checkout
  31. id: checkout
  32. uses: actions/checkout@v4
  33. with:
  34. fetch-depth: 0
  35. submodules: recursive
  36. - name: Check source files
  37. id: check-source-files
  38. uses: tj-actions/changed-files@v44
  39. with:
  40. since_last_remote_commit: ${{ github.event_name != 'pull_request' }}
  41. files: |
  42. **/*.c
  43. **/*.cc
  44. **/*.h
  45. **/*.hh
  46. **/*.in
  47. **/*.patch
  48. src/aclk/aclk-schemas/
  49. src/ml/dlib/
  50. src/fluent-bit/
  51. src/web/server/h2o/libh2o/
  52. files_ignore: |
  53. netdata.spec.in
  54. **/*.md
  55. - name: Check build files
  56. id: check-build-files
  57. uses: tj-actions/changed-files@v44
  58. with:
  59. since_last_remote_commit: ${{ github.event_name != 'pull_request' }}
  60. files: |
  61. **/*.cmake
  62. CMakeLists.txt
  63. netdata-installer.sh
  64. .github/data/distros.yml
  65. .github/workflows/build.yml
  66. .github/scripts/build-static.sh
  67. .github/scripts/get-static-cache-key.sh
  68. .github/scripts/gen-matrix-build.py
  69. .github/scripts/run-updater-check.sh
  70. packaging/cmake/
  71. packaging/makeself/
  72. packaging/installer/
  73. packaging/*.sh
  74. packaging/*.version
  75. packaging/*.checksums
  76. files_ignore: |
  77. **/*.md
  78. packaging/repoconfig/
  79. - name: List all changed files in pattern
  80. continue-on-error: true
  81. env:
  82. CHANGED_SOURCE_FILES: ${{ steps.check-source-files.outputs.all_changed_files }}
  83. CHANGED_BUILD_FILES: ${{ steps.check-build-files.outputs.all_changed_files }}
  84. run: |
  85. for file in ${CHANGED_SOURCE_FILES} ${CHANGED_BUILD_FILES} ; do
  86. echo "$file was changed"
  87. done
  88. - name: Check Run
  89. id: check-run
  90. run: |
  91. if [ "${{ steps.check-source-files.outputs.any_modified }}" == "true" ] || [ "${{ steps.check-build-files.outputs.any_modified }}" == "true" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
  92. echo 'run=true' >> "${GITHUB_OUTPUT}"
  93. else
  94. echo 'run=false' >> "${GITHUB_OUTPUT}"
  95. fi
  96. - name: Check Go
  97. id: check-go
  98. env:
  99. OTHER_CHANGED_FILES: ${{ steps.check-source-files.outputs.other_changed_files }}
  100. run: |
  101. if [ '${{ github.event_name }}' == 'pull_request' ]; then
  102. if echo "${OTHER_CHANGED_FILES}" | grep -q '.*/(.*\.go|go\.mod|go\.sum)$' || [ "${{ steps.check-build-files.outputs.any_modified }}" == "true" ]; then
  103. echo 'skip-go=' >> "${GITHUB_OUTPUT}"
  104. else
  105. echo 'skip-go=--disable-go' >> "${GITHUB_OUTPUT}"
  106. fi
  107. else
  108. echo 'skip-go=' >> "${GITHUB_OUTPUT}"
  109. fi
  110. build-dist: # Build the distribution tarball and store it as an artifact.
  111. name: Build Distribution Tarball
  112. runs-on: ubuntu-latest
  113. needs:
  114. - file-check
  115. outputs:
  116. distfile: ${{ steps.build.outputs.distfile }}
  117. steps:
  118. - name: Skip Check
  119. id: skip
  120. if: needs.file-check.outputs.run != 'true'
  121. run: echo "SKIPPED"
  122. - name: Checkout
  123. id: checkout
  124. if: needs.file-check.outputs.run == 'true'
  125. uses: actions/checkout@v4
  126. with:
  127. fetch-depth: 0
  128. submodules: recursive
  129. - name: Fix tags
  130. id: fix-tags
  131. if: github.event_name != 'push' && needs.file-check.outputs.run == 'true'
  132. run: |
  133. git fetch --tags --force
  134. - name: Mark Stable
  135. id: channel
  136. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly' && needs.file-check.outputs.run == 'true'
  137. run: |
  138. sed -i 's/^RELEASE_CHANNEL="nightly"/RELEASE_CHANNEL="stable"/' netdata-installer.sh
  139. - name: Build
  140. id: build
  141. if: needs.file-check.outputs.run == 'true'
  142. run: |
  143. mkdir -p artifacts/
  144. tar --create --file "artifacts/netdata-$(git describe).tar.gz" \
  145. --sort=name --posix --auto-compress --exclude=artifacts/ --exclude=.git \
  146. --exclude=.gitignore --exclude=.gitattributes --exclude=.gitmodules \
  147. --transform "s/^\\.\\//netdata-$(git describe)\\//" --verbose .
  148. cd artifacts/
  149. echo "distfile=$(find . -name 'netdata-*.tar.gz')" >> "${GITHUB_OUTPUT}"
  150. - name: Store
  151. id: store
  152. if: needs.file-check.outputs.run == 'true'
  153. uses: actions/upload-artifact@v4
  154. with:
  155. name: dist-tarball
  156. path: artifacts/*.tar.gz
  157. retention-days: 30
  158. - name: Failure Notification
  159. uses: rtCamp/action-slack-notify@v2
  160. env:
  161. SLACK_COLOR: 'danger'
  162. SLACK_FOOTER: ''
  163. SLACK_ICON_EMOJI: ':github-actions:'
  164. SLACK_TITLE: 'Distribution tarball creation failed:'
  165. SLACK_USERNAME: 'GitHub Actions'
  166. SLACK_MESSAGE: |-
  167. ${{ github.repository }}: Failed to create source tarball for distribution.
  168. Checkout: ${{ steps.checkout.outcome }}
  169. Fix Tags: ${{ steps.fix-tags.outcome }}
  170. Mark stable: ${{ steps.channel.outcome }}
  171. Build: ${{ steps.build.outcome }}
  172. Store: ${{ steps.store.outcome }}
  173. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  174. if: >-
  175. ${{
  176. failure()
  177. && startsWith(github.ref, 'refs/heads/master')
  178. && github.event_name != 'pull_request'
  179. && github.repository == 'netdata/netdata'
  180. && needs.file-check.outputs.run == 'true'
  181. }}
  182. build-static: # Build the static binary archives, and store them as artifacts.
  183. name: Build Static
  184. runs-on: ubuntu-latest
  185. needs:
  186. - file-check
  187. strategy:
  188. matrix:
  189. arch:
  190. - x86_64
  191. - armv6l
  192. - armv7l
  193. - aarch64
  194. - ppc64le
  195. steps:
  196. - name: Skip Check
  197. id: skip
  198. if: needs.file-check.outputs.run != 'true'
  199. run: echo "SKIPPED"
  200. - name: Checkout
  201. id: checkout
  202. if: needs.file-check.outputs.run == 'true'
  203. uses: actions/checkout@v4
  204. with:
  205. fetch-depth: 0
  206. submodules: recursive
  207. - name: Fix tags
  208. id: fix-tags
  209. if: github.event_name != 'push' && needs.file-check.outputs.run == 'true'
  210. run: |
  211. git fetch --tags --force
  212. - name: Mark Stable
  213. id: channel
  214. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly' && needs.file-check.outputs.run == 'true'
  215. run: |
  216. sed -i 's/^RELEASE_CHANNEL="nightly"/RELEASE_CHANNEL="stable"/' netdata-installer.sh packaging/makeself/install-or-update.sh
  217. - name: Get Cache Key
  218. if: (github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'run-ci/no-cache')) && needs.file-check.outputs.run == 'true'
  219. id: cache-key
  220. run: .github/scripts/get-static-cache-key.sh ${{ matrix.arch }} "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/no-cache') }}"
  221. - name: Cache
  222. if: (github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'run-ci/no-cache')) && needs.file-check.outputs.run == 'true'
  223. id: cache
  224. uses: actions/cache@v4
  225. with:
  226. path: artifacts/cache
  227. key: ${{ steps.cache-key.outputs.key }}
  228. - name: Build
  229. if: github.event_name != 'workflow_dispatch' && needs.file-check.outputs.run == 'true' # Don’t use retries on PRs.
  230. run: |
  231. export EXTRA_INSTALL_FLAGS=${{ needs.file-check.outputs.skip-go }}
  232. .github/scripts/build-static.sh ${{ matrix.arch }}
  233. - name: Build
  234. if: github.event_name == 'workflow_dispatch' && needs.file-check.outputs.run == 'true'
  235. id: build
  236. uses: nick-fields/retry@v3
  237. with:
  238. timeout_minutes: 180
  239. max_attempts: 3
  240. command: |
  241. export EXTRA_INSTALL_FLAGS=${{ needs.file-check.outputs.skip-go }}
  242. .github/scripts/build-static.sh ${{ matrix.arch }}
  243. - name: Store
  244. id: store
  245. if: needs.file-check.outputs.run == 'true'
  246. uses: actions/upload-artifact@v4
  247. with:
  248. name: dist-static-${{ matrix.arch }}
  249. path: artifacts/*.gz.run
  250. retention-days: 30
  251. - name: Failure Notification
  252. uses: rtCamp/action-slack-notify@v2
  253. env:
  254. SLACK_COLOR: 'danger'
  255. SLACK_FOOTER: ''
  256. SLACK_ICON_EMOJI: ':github-actions:'
  257. SLACK_TITLE: 'Static build failed:'
  258. SLACK_USERNAME: 'GitHub Actions'
  259. SLACK_MESSAGE: |-
  260. ${{ github.repository }}: Failed to create static installer archive for ${{ matrix.arch }}.
  261. Checkout: ${{ steps.checkout.outcome }}
  262. Fix Tags: ${{ steps.fix-tags.outcome }}
  263. Mark stable: ${{ steps.channel.outcome }}
  264. Build: ${{ steps.build.outcome }}
  265. Store: ${{ steps.store.outcome }}
  266. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  267. if: >-
  268. ${{
  269. failure()
  270. && startsWith(github.ref, 'refs/heads/master')
  271. && github.event_name != 'pull_request'
  272. && github.repository == 'netdata/netdata'
  273. && needs.file-check.outputs.run == 'true'
  274. }}
  275. prepare-upload: # Consolidate the artifacts for uploading or releasing.
  276. name: Prepare Artifacts
  277. runs-on: ubuntu-latest
  278. needs:
  279. - build-dist
  280. - build-static
  281. - file-check
  282. steps:
  283. - name: Skip Check
  284. id: skip
  285. if: needs.file-check.outputs.run != 'true'
  286. run: echo "SKIPPED"
  287. - name: Checkout
  288. id: checkout
  289. if: needs.file-check.outputs.run == 'true'
  290. uses: actions/checkout@v4
  291. - name: Prepare Environment
  292. id: prepare
  293. if: needs.file-check.outputs.run == 'true'
  294. run: mkdir -p artifacts
  295. - name: Retrieve Build Artifacts
  296. id: fetch-dist
  297. if: needs.file-check.outputs.run == 'true'
  298. uses: Wandalen/wretry.action@v3
  299. with:
  300. action: actions/download-artifact@v4
  301. with: |
  302. pattern: dist-*
  303. path: dist-artifacts
  304. merge-multiple: true
  305. attempt_limit: 3
  306. attempt_delay: 2000
  307. - name: Prepare Artifacts
  308. id: consolidate
  309. if: needs.file-check.outputs.run == 'true'
  310. working-directory: ./artifacts/
  311. run: |
  312. mv ../dist-artifacts/* . || exit 1
  313. ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
  314. cp ../packaging/version ./latest-version.txt || exit 1
  315. cp ../integrations/integrations.js ./integrations.js || exit 1
  316. sha256sum -b ./* > sha256sums.txt || exit 1
  317. cat sha256sums.txt
  318. - name: Store Artifacts
  319. id: store
  320. if: needs.file-check.outputs.run == 'true'
  321. uses: actions/upload-artifact@v4
  322. with:
  323. name: final-artifacts
  324. path: artifacts/*
  325. retention-days: 30
  326. - name: Failure Notification
  327. uses: rtCamp/action-slack-notify@v2
  328. env:
  329. SLACK_COLOR: 'danger'
  330. SLACK_FOOTER: ''
  331. SLACK_ICON_EMOJI: ':github-actions:'
  332. SLACK_TITLE: 'Failed to prepare release artifacts for upload:'
  333. SLACK_USERNAME: 'GitHub Actions'
  334. SLACK_MESSAGE: |-
  335. ${{ github.repository }}: Failed to prepare release artifacts for upload.
  336. Checkout: ${{ steps.checkout.outcome }}
  337. Prepare environment: ${{ steps.prepare.outcome }}
  338. Fetch dist tarball: ${{ steps.fetch-dist.outcome }}
  339. Consolidate artifacts: ${{ steps.consolidate.outcome }}
  340. Store: ${{ steps.store.outcome }}
  341. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  342. if: >-
  343. ${{
  344. failure()
  345. && startsWith(github.ref, 'refs/heads/master')
  346. && github.event_name != 'pull_request'
  347. && github.repository == 'netdata/netdata'
  348. && needs.file-check.outputs.run == 'true'
  349. }}
  350. artifact-verification-dist: # Verify the regular installer works with the consolidated artifacts.
  351. name: Test Consolidated Artifacts (Source)
  352. runs-on: ubuntu-latest
  353. needs:
  354. - prepare-upload
  355. - file-check
  356. services:
  357. apache: # This gets used to serve the dist tarball for the updater script.
  358. image: httpd:2.4
  359. ports:
  360. - 8080:80
  361. volumes:
  362. - ${{ github.workspace }}:/usr/local/apache2/htdocs/
  363. steps:
  364. - name: Skip Check
  365. id: skip
  366. if: needs.file-check.outputs.run != 'true'
  367. run: echo "SKIPPED"
  368. - name: Checkout
  369. id: checkout
  370. if: needs.file-check.outputs.run == 'true'
  371. uses: actions/checkout@v4
  372. - name: Fetch artifacts
  373. id: fetch
  374. if: needs.file-check.outputs.run == 'true'
  375. uses: Wandalen/wretry.action@v3
  376. with:
  377. action: actions/download-artifact@v4
  378. with: |
  379. name: final-artifacts
  380. path: artifacts
  381. attempt_limit: 3
  382. attempt_delay: 2000
  383. - name: Prepare artifacts directory
  384. id: prepare
  385. if: needs.file-check.outputs.run == 'true'
  386. run: |
  387. mkdir -p download/latest
  388. mv artifacts/* download/latest
  389. ls -al download/latest
  390. - name: Verify that artifacts work with installer
  391. id: verify
  392. if: needs.file-check.outputs.run == 'true'
  393. env:
  394. NETDATA_TARBALL_BASEURL: http://localhost:8080/
  395. run: packaging/installer/kickstart.sh --build-only --dont-start-it --disable-telemetry --dont-wait
  396. - name: Failure Notification
  397. uses: rtCamp/action-slack-notify@v2
  398. env:
  399. SLACK_COLOR: 'danger'
  400. SLACK_FOOTER: ''
  401. SLACK_ICON_EMOJI: ':github-actions:'
  402. SLACK_TITLE: 'Artifact verification for source tarball failed.'
  403. SLACK_USERNAME: 'GitHub Actions'
  404. SLACK_MESSAGE: |-
  405. ${{ github.repository }}: Artifact verification for source tarball failed.
  406. Checkout: ${{ steps.checkout.outcome }}
  407. Fetch artifacts: ${{ steps.fetch.outcome }}
  408. Verify artifacts: ${{ steps.verify.outcome }}
  409. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  410. if: >-
  411. ${{
  412. failure()
  413. && startsWith(github.ref, 'refs/heads/master')
  414. && github.event_name != 'pull_request'
  415. && github.repository == 'netdata/netdata'
  416. && needs.file-check.outputs.run == 'true'
  417. }}
  418. artifact-verification-static: # Verify the static installer works with the consolidated artifacts.
  419. name: Test Consolidated Artifacts (Static)
  420. runs-on: ubuntu-latest
  421. needs:
  422. - prepare-upload
  423. - file-check
  424. services:
  425. apache: # This gets used to serve the static archives.
  426. image: httpd:2.4
  427. ports:
  428. - 8080:80
  429. volumes:
  430. - ${{ github.workspace }}:/usr/local/apache2/htdocs/
  431. steps:
  432. - name: Skip Check
  433. id: skip
  434. if: needs.file-check.outputs.run != 'true'
  435. run: echo "SKIPPED"
  436. - name: Checkout
  437. id: checkout
  438. if: needs.file-check.outputs.run == 'true'
  439. uses: actions/checkout@v4
  440. - name: Fetch artifacts
  441. id: fetch-artifacts
  442. if: needs.file-check.outputs.run == 'true'
  443. uses: Wandalen/wretry.action@v3
  444. with:
  445. action: actions/download-artifact@v4
  446. with: |
  447. name: final-artifacts
  448. path: artifacts
  449. attempt_limit: 3
  450. attempt_delay: 2000
  451. - name: Prepare artifacts directory
  452. id: prepare
  453. if: needs.file-check.outputs.run == 'true'
  454. run: |
  455. mkdir -p download/latest
  456. mv artifacts/* download/latest
  457. ls -al download/latest
  458. - name: Verify that artifacts work with installer
  459. id: verify
  460. if: needs.file-check.outputs.run == 'true'
  461. env:
  462. NETDATA_TARBALL_BASEURL: http://localhost:8080/
  463. run: packaging/installer/kickstart.sh --static-only --dont-start-it --disable-telemetry
  464. - name: Failure Notification
  465. uses: rtCamp/action-slack-notify@v2
  466. env:
  467. SLACK_COLOR: 'danger'
  468. SLACK_FOOTER: ''
  469. SLACK_ICON_EMOJI: ':github-actions:'
  470. SLACK_TITLE: 'Artifact verification for static build failed.'
  471. SLACK_USERNAME: 'GitHub Actions'
  472. SLACK_MESSAGE: |-
  473. ${{ github.repository }}: Artifact verification for static build failed.
  474. Checkout: ${{ steps.checkout.outcome }}
  475. Fetch artifacts: ${{ steps.fetch-artifacts.outcome }}
  476. Verify artifacts: ${{ steps.verify.outcome }}
  477. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  478. if: >-
  479. ${{
  480. failure()
  481. && startsWith(github.ref, 'refs/heads/master')
  482. && github.event_name != 'pull_request'
  483. && github.repository == 'netdata/netdata'
  484. && needs.file-check.outputs.run == 'true'
  485. }}
  486. upload-nightly: # Upload the nightly build artifacts to GCS.
  487. name: Upload Nightly Artifacts
  488. runs-on: ubuntu-latest
  489. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
  490. needs:
  491. - artifact-verification-dist
  492. - artifact-verification-static
  493. steps:
  494. - name: Retrieve Artifacts
  495. id: fetch
  496. uses: Wandalen/wretry.action@v3
  497. with:
  498. action: actions/download-artifact@v4
  499. with: |
  500. name: final-artifacts
  501. path: final-artifacts
  502. attempt_limit: 3
  503. attempt_delay: 2000
  504. - name: Authenticate to GCS
  505. id: gcs-auth
  506. uses: google-github-actions/auth@v2
  507. with:
  508. project_id: ${{ secrets.GCP_NIGHTLY_STORAGE_PROJECT }}
  509. credentials_json: ${{ secrets.GCS_STORAGE_SERVICE_KEY_JSON }}
  510. - name: Setup GCS
  511. id: gcs-setup
  512. uses: google-github-actions/setup-gcloud@v2.1.0
  513. - name: Upload Artifacts
  514. id: upload
  515. uses: google-github-actions/upload-cloud-storage@v2.1.0
  516. with:
  517. destination: ${{ secrets.GCP_NIGHTLY_STORAGE_BUCKET }}
  518. gzip: false
  519. path: ./final-artifacts/latest-version.txt
  520. parent: false
  521. - name: Failure Notification
  522. uses: rtCamp/action-slack-notify@v2
  523. env:
  524. SLACK_COLOR: 'danger'
  525. SLACK_FOOTER: ''
  526. SLACK_ICON_EMOJI: ':github-actions:'
  527. SLACK_TITLE: 'Failed to upload nightly release artifacts:'
  528. SLACK_USERNAME: 'GitHub Actions'
  529. SLACK_MESSAGE: |-
  530. ${{ github.repository }}: Failed to upload nightly release artifacts.
  531. Fetch artifacts: ${{ steps.fetch.outcome }}
  532. Authenticatie GCS: ${{ steps.gcs-auth.outcome }}
  533. Setup GCS: ${{ steps.gcs-setup.outcome }}
  534. Upload artifacts: ${{ steps.upload.outcome }}
  535. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  536. if: >-
  537. ${{
  538. failure()
  539. && startsWith(github.ref, 'refs/heads/master')
  540. && github.event_name != 'pull_request'
  541. }}
  542. create-nightly: # Create a nightly build release in netdata/netdata-nightlies
  543. name: Create Nightly Release
  544. runs-on: ubuntu-latest
  545. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
  546. needs:
  547. - artifact-verification-dist
  548. - artifact-verification-static
  549. steps:
  550. - name: Checkout Main Repo
  551. id: checkout-main
  552. uses: actions/checkout@v4
  553. with:
  554. path: main
  555. - name: Checkout Nightly Repo
  556. id: checkout-nightly
  557. uses: actions/checkout@v4
  558. with:
  559. repository: netdata/netdata-nightlies
  560. path: nightlies
  561. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  562. - name: Retrieve Artifacts
  563. id: fetch
  564. uses: Wandalen/wretry.action@v3
  565. with:
  566. action: actions/download-artifact@v4
  567. with: |
  568. name: final-artifacts
  569. path: final-artifacts
  570. attempt_limit: 3
  571. attempt_delay: 2000
  572. - name: Prepare version info
  573. id: version
  574. run: |
  575. # shellcheck disable=SC2129
  576. echo "version=$(cat main/packaging/version)" >> "${GITHUB_OUTPUT}"
  577. echo "commit=$(cd nightlies && git rev-parse HEAD)" >> "${GITHUB_OUTPUT}"
  578. echo "date=$(date +%F)" >> "${GITHUB_OUTPUT}"
  579. - name: Create Release
  580. id: create-release
  581. uses: ncipollo/release-action@v1
  582. with:
  583. allowUpdates: false
  584. artifactErrorsFailBuild: true
  585. artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run,final-artifacts/integrations.js'
  586. owner: netdata
  587. repo: netdata-nightlies
  588. body: Netdata nightly build for ${{ steps.version.outputs.date }}.
  589. commit: ${{ steps.version.outputs.commit }}
  590. makeLatest: true
  591. tag: ${{ steps.version.outputs.version }}
  592. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  593. - name: Checkout netdata main Repo # Checkout back to netdata/netdata repo to the update latest packaged versions
  594. id: checkout-netdata
  595. uses: actions/checkout@v4
  596. with:
  597. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  598. - name: Init python environment for publish release metadata
  599. uses: actions/setup-python@v5
  600. id: init-python
  601. with:
  602. python-version: "3.12"
  603. - name: Setup python environment
  604. id: setup-python
  605. run: |
  606. pip install -r .github/scripts/modules/requirements.txt
  607. - name: Check if the version is latest and published
  608. id: check-latest-version
  609. run: |
  610. python .github/scripts/check_latest_versions.py ${{ steps.version.outputs.version }}
  611. - name: SSH setup
  612. id: ssh-setup
  613. if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && steps.check-latest-version.outputs.versions_needs_update == 'true'
  614. uses: shimataro/ssh-key-action@v2
  615. with:
  616. key: ${{ secrets.NETDATABOT_PACKAGES_SSH_KEY }}
  617. name: id_ecdsa
  618. known_hosts: ${{ secrets.PACKAGES_KNOWN_HOSTS }}
  619. - name: Sync release info to packages.netdata.cloud
  620. id: sync-releases
  621. continue-on-error: true
  622. if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && steps.check-latest-version.outputs.versions_needs_update == 'true'
  623. run: |
  624. .github/scripts/upload-new-version-tags.sh packages.netdata.cloud
  625. - name: Sync release info to packages2.netdata.cloud
  626. id: sync-releases2
  627. if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && steps.check-latest-version.outputs.versions_needs_update == 'true'
  628. run: |
  629. .github/scripts/upload-new-version-tags.sh packages.netdata.cloud
  630. - name: Failure Notification
  631. uses: rtCamp/action-slack-notify@v2
  632. env:
  633. SLACK_COLOR: 'danger'
  634. SLACK_FOOTER: ''
  635. SLACK_ICON_EMOJI: ':github-actions:'
  636. SLACK_TITLE: 'Failed to draft release:'
  637. SLACK_USERNAME: 'GitHub Actions'
  638. SLACK_MESSAGE: |-
  639. ${{ github.repository }}: Failed to create nightly release or attach artifacts.
  640. Checkout netdata/netdata: ${{ steps.checkout-main.outcome }}
  641. Checkout netdata/netdata-nightlies: ${{ steps.checkout-nightly.outcome }}
  642. Fetch artifacts: ${{ steps.fetch.outcome }}
  643. Prepare version info: ${{ steps.version.outcome }}
  644. Create release: ${{ steps.create-release.outcome }}
  645. Checkout back netdata/netdata: ${{ steps.checkout-netdata.outcome }}
  646. Init python environment: ${{ steps.init-python.outcome }}
  647. Setup python environment: ${{ steps.setup-python.outcome }}
  648. Check the nearly published release against the advertised: ${{ steps.check-latest-version.outcome }}
  649. Setup ssh: ${{ steps.ssh-setup.outcome }}
  650. Sync release info to packages.netdata.cloud: ${{ steps.sync-releases.outcome }}
  651. Sync release info to packages2.netdata.cloud: ${{ steps.sync-releases2.outcome }}
  652. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  653. if: >-
  654. ${{
  655. failure()
  656. && github.event_name == 'workflow_dispatch'
  657. }}
  658. normalize-tag: # Fix the release tag if needed
  659. name: Normalize Release Tag
  660. runs-on: ubuntu-latest
  661. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release'
  662. outputs:
  663. tag: ${{ steps.tag.outputs.tag }}
  664. steps:
  665. - name: Normalize Tag
  666. id: tag
  667. run: |
  668. if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
  669. echo "tag=v${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
  670. else
  671. echo "tag=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
  672. fi
  673. upload-release: # Create the draft release and upload the build artifacts.
  674. name: Create Release Draft
  675. runs-on: ubuntu-latest
  676. if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release' && github.repository == 'netdata/netdata'
  677. needs:
  678. - artifact-verification-dist
  679. - artifact-verification-static
  680. - normalize-tag
  681. steps:
  682. - name: Checkout
  683. id: checkout
  684. uses: actions/checkout@v4
  685. - name: Retrieve Artifacts
  686. id: fetch
  687. uses: Wandalen/wretry.action@v3
  688. with:
  689. action: actions/download-artifact@v4
  690. with: |
  691. name: final-artifacts
  692. path: final-artifacts
  693. attempt_limit: 3
  694. attempt_delay: 2000
  695. - name: Create Release
  696. id: create-release
  697. uses: ncipollo/release-action@v1
  698. with:
  699. allowUpdates: false
  700. artifactErrorsFailBuild: true
  701. artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run,final-artifacts/integrations.js'
  702. draft: true
  703. tag: ${{ needs.normalize-tag.outputs.tag }}
  704. token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
  705. - name: Failure Notification
  706. uses: rtCamp/action-slack-notify@v2
  707. env:
  708. SLACK_COLOR: 'danger'
  709. SLACK_FOOTER: ''
  710. SLACK_ICON_EMOJI: ':github-actions:'
  711. SLACK_TITLE: 'Failed to draft release:'
  712. SLACK_USERNAME: 'GitHub Actions'
  713. SLACK_MESSAGE: |-
  714. ${{ github.repository }}: Failed to create draft release or attach artifacts.
  715. Checkout: ${{ steps.checkout.outcome }}
  716. Fetch artifacts: ${{ steps.fetch.outcome }}
  717. Create draft release: ${{ steps.create-release.outcome }}
  718. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  719. if: >-
  720. ${{
  721. failure()
  722. && github.event_name == 'workflow_dispatch'
  723. }}
  724. - name: Success Notification
  725. uses: rtCamp/action-slack-notify@v2
  726. env:
  727. SLACK_COLOR: 'good'
  728. SLACK_FOOTER: ''
  729. SLACK_ICON_EMOJI: ':github-actions:'
  730. SLACK_TITLE: 'Created agent draft release:'
  731. SLACK_USERNAME: 'GitHub Actions'
  732. SLACK_MESSAGE: "${{ github.repository }}: ${{ steps.create-release.outputs.html_url }}"
  733. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  734. if: >-
  735. ${{
  736. success()
  737. && github.event_name == 'workflow_dispatch'
  738. }}
  739. # Remaining jobs are only used for CI checks, and not as part of the release process
  740. matrix: # Generate the shared build matrix for our Linux build tests.
  741. name: Prepare Build Matrix
  742. runs-on: ubuntu-latest
  743. if: github.event_name != 'workflow_dispatch'
  744. outputs:
  745. matrix: ${{ steps.set-matrix.outputs.matrix }}
  746. steps:
  747. - name: Checkout
  748. id: checkout
  749. uses: actions/checkout@v4
  750. - name: Prepare tools
  751. id: prepare
  752. run: |
  753. sudo apt-get update || true
  754. sudo apt-get install -y python3-ruamel.yaml
  755. - name: Read build matrix
  756. id: set-matrix
  757. run: |
  758. matrix="$(.github/scripts/gen-matrix-build.py)"
  759. echo "Generated matrix: ${matrix}"
  760. echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
  761. - name: Failure Notification
  762. uses: rtCamp/action-slack-notify@v2
  763. env:
  764. SLACK_COLOR: 'danger'
  765. SLACK_FOOTER: ''
  766. SLACK_ICON_EMOJI: ':github-actions:'
  767. SLACK_TITLE: 'Build matrix preparation failed:'
  768. SLACK_USERNAME: 'GitHub Actions'
  769. SLACK_MESSAGE: |-
  770. ${{ github.repository }}: Failed to prepare build matrix for build checks.
  771. Checkout: ${{ steps.checkout.outcome }}
  772. Prepare tools: ${{ steps.prepare.outcome }}
  773. Read build matrix: ${{ steps.set-matrix.outcome }}
  774. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  775. if: >-
  776. ${{
  777. failure()
  778. && startsWith(github.ref, 'refs/heads/master')
  779. && github.event_name != 'pull_request'
  780. && github.repository == 'netdata/netdata'
  781. }}
  782. prepare-test-images: # Prepare the test environments for our build checks. This also checks dependency handling code for each tested environment.
  783. name: Prepare Test Environments
  784. runs-on: ubuntu-latest
  785. if: github.event_name != 'workflow_dispatch'
  786. needs:
  787. - matrix
  788. env:
  789. RETRY_DELAY: 300
  790. strategy:
  791. # Unlike the actual build tests, this completes _very_ fast (average of about 3 minutes for each job), so we
  792. # just run everything in parallel instead lof limiting job concurrency.
  793. fail-fast: false
  794. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  795. steps:
  796. - name: Checkout
  797. id: checkout
  798. uses: actions/checkout@v4
  799. - name: Setup Buildx
  800. id: buildx
  801. uses: docker/setup-buildx-action@v3
  802. - name: Build test environment
  803. id: build1
  804. uses: docker/build-push-action@v6
  805. continue-on-error: true # We retry 3 times at 5 minute intervals if there is a failure here.
  806. with:
  807. push: false
  808. load: false
  809. file: .github/dockerfiles/Dockerfile.build_test
  810. build-args: |
  811. BASE=${{ matrix.distro }}
  812. PRE=${{ matrix.env_prep }}
  813. RMJSONC=${{ matrix.jsonc_removal }}
  814. outputs: type=docker,dest=/tmp/image.tar
  815. tags: test:${{ matrix.artifact_key }}
  816. - name: Retry delay
  817. if: ${{ steps.build1.outcome == 'failure' }}
  818. run: sleep "${RETRY_DELAY}"
  819. - name: Build test environment (attempt 2)
  820. if: ${{ steps.build1.outcome == 'failure' }}
  821. id: build2
  822. uses: docker/build-push-action@v6
  823. continue-on-error: true # We retry 3 times at 5 minute intervals if there is a failure here.
  824. with:
  825. push: false
  826. load: false
  827. file: .github/dockerfiles/Dockerfile.build_test
  828. build-args: |
  829. BASE=${{ matrix.distro }}
  830. PRE=${{ matrix.env_prep }}
  831. RMJSONC=${{ matrix.jsonc_removal }}
  832. outputs: type=docker,dest=/tmp/image.tar
  833. tags: test:${{ matrix.artifact_key }}
  834. - name: Retry delay
  835. if: ${{ steps.build1.outcome == 'failure' && steps.build2.outcome == 'failure' }}
  836. run: sleep "${RETRY_DELAY}"
  837. - name: Build test environment (attempt 3)
  838. if: ${{ steps.build1.outcome == 'failure' && steps.build2.outcome == 'failure' }}
  839. id: build3
  840. uses: docker/build-push-action@v6
  841. with:
  842. push: false
  843. load: false
  844. file: .github/dockerfiles/Dockerfile.build_test
  845. build-args: |
  846. BASE=${{ matrix.distro }}
  847. PRE=${{ matrix.env_prep }}
  848. RMJSONC=${{ matrix.jsonc_removal }}
  849. outputs: type=docker,dest=/tmp/image.tar
  850. tags: test:${{ matrix.artifact_key }}
  851. - name: Upload image artifact
  852. id: upload
  853. uses: actions/upload-artifact@v4
  854. with:
  855. name: ${{ matrix.artifact_key }}-test-env
  856. path: /tmp/image.tar
  857. retention-days: 30
  858. - name: Failure Notification
  859. uses: rtCamp/action-slack-notify@v2
  860. env:
  861. SLACK_COLOR: 'danger'
  862. SLACK_FOOTER: ''
  863. SLACK_ICON_EMOJI: ':github-actions:'
  864. SLACK_TITLE: 'Test environment preparation for ${{ matrix.distro }} failed:'
  865. SLACK_USERNAME: 'GitHub Actions'
  866. SLACK_MESSAGE: |-
  867. ${{ github.repository }}: Test environment preparation for ${{ matrix.distro }} failed.
  868. Checkout: ${{ steps.checkout.outcome }}
  869. Set up Buildx: ${{ steps.buildx.outcome }}
  870. Build test environment: ${{ steps.build1.outcome }}
  871. Build test environment (attempt 2): ${{ steps.build2.outcome }}
  872. Build test environment (attempt 3): ${{ steps.build3.outcome }}
  873. Upload: ${{ steps.upload.outcome }}
  874. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  875. if: >-
  876. ${{
  877. failure()
  878. && startsWith(github.ref, 'refs/heads/master')
  879. && github.event_name != 'pull_request'
  880. && github.repository == 'netdata/netdata'
  881. }}
  882. source-build: # Test various source build arrangements.
  883. name: Test Source Build
  884. runs-on: ubuntu-latest
  885. if: github.event_name != 'workflow_dispatch'
  886. needs:
  887. - matrix
  888. - prepare-test-images
  889. - file-check
  890. strategy:
  891. fail-fast: false
  892. max-parallel: 8
  893. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  894. steps:
  895. - name: Skip Check
  896. id: skip
  897. if: needs.file-check.outputs.run != 'true'
  898. run: echo "SKIPPED"
  899. - name: Checkout
  900. id: checkout
  901. if: needs.file-check.outputs.run == 'true'
  902. uses: actions/checkout@v4
  903. with:
  904. submodules: recursive
  905. - name: Fetch test environment
  906. id: fetch
  907. if: needs.file-check.outputs.run == 'true'
  908. uses: Wandalen/wretry.action@v3
  909. with:
  910. action: actions/download-artifact@v4
  911. with: |
  912. name: ${{ matrix.artifact_key }}-test-env
  913. path: .
  914. attempt_limit: 3
  915. attempt_delay: 2000
  916. - name: Load test environment
  917. id: load
  918. if: needs.file-check.outputs.run == 'true'
  919. run: docker load --input image.tar
  920. - name: netdata-installer on ${{ matrix.distro }}, disable cloud
  921. id: build-no-cloud
  922. if: needs.file-check.outputs.run == 'true'
  923. run: |
  924. docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
  925. /bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --disable-cloud --one-time-build ${{ needs.file-check.outputs.skip-go }}'
  926. - name: netdata-installer on ${{ matrix.distro }}, require cloud
  927. id: build-cloud
  928. if: needs.file-check.outputs.run == 'true'
  929. run: |
  930. docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
  931. /bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --require-cloud --one-time-build ${{ needs.file-check.outputs.skip-go }}'
  932. - name: netdata-installer on ${{ matrix.distro }}, require cloud, no JSON-C
  933. id: build-no-jsonc
  934. if: matrix.jsonc_removal != '' && needs.file-check.outputs.run == 'true'
  935. run: |
  936. docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
  937. /bin/sh -c '/rmjsonc.sh && ./netdata-installer.sh --dont-wait --dont-start-it --require-cloud --one-time-build ${{ needs.file-check.outputs.skip-go }}'
  938. - name: Failure Notification
  939. uses: rtCamp/action-slack-notify@v2
  940. env:
  941. SLACK_COLOR: 'danger'
  942. SLACK_FOOTER: ''
  943. SLACK_ICON_EMOJI: ':github-actions:'
  944. SLACK_TITLE: 'Build tests for ${{ matrix.distro }} failed:'
  945. SLACK_USERNAME: 'GitHub Actions'
  946. SLACK_MESSAGE: |-
  947. ${{ github.repository }}: Build tests for ${{ matrix.distro }} failed.
  948. Checkout: ${{ steps.checkout.outcome }}
  949. Fetch test environment: ${{ steps.fetch.outcome }}
  950. Load test environment: ${{ steps.load.outcome }}
  951. netdata-installer, disable cloud: ${{ steps.build-no-cloud.outcome }}
  952. netdata-installer, require cloud: ${{ steps.build-cloud.outcome }}
  953. netdata-installer, no JSON-C: ${{ steps.build-no-jsonc.outcome }}
  954. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  955. if: >-
  956. ${{
  957. failure()
  958. && startsWith(github.ref, 'refs/heads/master')
  959. && github.event_name != 'pull_request'
  960. && github.repository == 'netdata/netdata'
  961. && needs.file-check.outputs.run == 'true'
  962. }}
  963. macos-build: # Test building on macOS
  964. runs-on: ${{ matrix.runner }}
  965. if: github.event_name != 'workflow_dispatch'
  966. needs:
  967. - file-check
  968. strategy:
  969. fail-fast: false
  970. max-parallel: 8
  971. matrix:
  972. include:
  973. - name: macos-12
  974. runner: macos-12
  975. - name: macos-13
  976. runner: macos-13
  977. - name: macos-14-M1
  978. runner: macos-14
  979. steps:
  980. - name: Skip Check
  981. id: skip
  982. if: needs.file-check.outputs.run != 'true'
  983. run: echo "SKIPPED"
  984. - uses: actions/checkout@v4
  985. id: checkout
  986. if: needs.file-check.outputs.run == 'true'
  987. with:
  988. submodules: recursive
  989. - name: Install latest bash
  990. id: install-bash
  991. if: needs.file-check.outputs.run == 'true'
  992. run: |
  993. brew install bash
  994. - name: Install netdata dependencies
  995. id: install-nd-dep
  996. if: needs.file-check.outputs.run == 'true'
  997. run: |
  998. bash ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata-all
  999. - name: Build from source
  1000. id: build-source
  1001. if: needs.file-check.outputs.run == 'true'
  1002. run: |
  1003. sudo bash ./netdata-installer.sh --install-no-prefix /usr/local/netdata --dont-wait --dont-start-it --require-cloud --one-time-build
  1004. - name: Test Agent start up
  1005. id: test-agent
  1006. if: needs.file-check.outputs.run == 'true'
  1007. run: |
  1008. /usr/local/netdata/usr/sbin/netdata -D > ./netdata.log 2>&1 &
  1009. ./packaging/runtime-check.sh
  1010. - name: Failure Notification
  1011. uses: rtCamp/action-slack-notify@v2
  1012. env:
  1013. SLACK_COLOR: 'danger'
  1014. SLACK_FOOTER: ''
  1015. SLACK_ICON_EMOJI: ':github-actions:'
  1016. SLACK_TITLE: 'Build & test from source macOS failed:'
  1017. SLACK_USERNAME: 'GitHub Actions'
  1018. SLACK_MESSAGE: |-
  1019. ${{ github.repository }}: macOS Build and test.
  1020. Checkout: ${{ steps.checkout.outcome }}
  1021. Setup runner: ${{ steps.install-bash.outcome }}
  1022. Install netdata required packages: ${{ steps.install-nd-dep.outcome }}
  1023. Build from source: ${{ steps.build-source.outcome }}
  1024. Test Agent runtime: ${{ steps.test-agent.outcome }}
  1025. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  1026. if: >-
  1027. ${{
  1028. failure()
  1029. && startsWith(github.ref, 'refs/heads/master')
  1030. && github.event_name != 'pull_request'
  1031. && github.repository == 'netdata/netdata'
  1032. }}
  1033. updater-check: # Test the generated dist archive using the updater code.
  1034. name: Test Generated Distfile and Updater Code
  1035. runs-on: ubuntu-latest
  1036. if: github.event_name != 'workflow_dispatch'
  1037. needs:
  1038. - build-dist
  1039. - matrix
  1040. - prepare-test-images
  1041. - file-check
  1042. strategy:
  1043. fail-fast: false
  1044. max-parallel: 8
  1045. matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
  1046. services:
  1047. apache: # This gets used to serve the dist tarball for the updater script.
  1048. image: httpd:2.4
  1049. ports:
  1050. - 8080:80
  1051. volumes:
  1052. - ${{ github.workspace }}:/usr/local/apache2/htdocs/
  1053. steps:
  1054. - name: Skip Check
  1055. id: skip
  1056. if: needs.file-check.outputs.run != 'true'
  1057. run: echo "SKIPPED"
  1058. - name: Checkout
  1059. id: checkout
  1060. if: needs.file-check.outputs.run == 'true'
  1061. uses: actions/checkout@v4
  1062. - name: Fetch dist tarball artifacts
  1063. id: fetch-tarball
  1064. if: needs.file-check.outputs.run == 'true'
  1065. uses: Wandalen/wretry.action@v3
  1066. with:
  1067. action: actions/download-artifact@v4
  1068. with: |
  1069. name: dist-tarball
  1070. path: dist-tarball
  1071. attempt_limit: 3
  1072. attempt_delay: 2000
  1073. - name: Prepare artifact directory
  1074. id: prepare
  1075. if: needs.file-check.outputs.run == 'true'
  1076. run: |
  1077. mkdir -p artifacts/download/v9999.0.0 || exit 1
  1078. mkdir -p artifacts/latest || exit 1
  1079. echo "v9999.0.0" > artifacts/latest/latest-version.txt || exit 1
  1080. cp dist-tarball/* artifacts/download/v9999.0.0 || exit 1
  1081. cd artifacts/download/v9999.0.0 || exit 1
  1082. ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
  1083. ls -lFh
  1084. sha256sum -b ./* > "sha256sums.txt" || exit 1
  1085. cat sha256sums.txt
  1086. cd ../.. || exit 1
  1087. ls -lR
  1088. - name: Fetch test environment
  1089. id: fetch-test-environment
  1090. if: needs.file-check.outputs.run == 'true'
  1091. uses: Wandalen/wretry.action@v3
  1092. with:
  1093. action: actions/download-artifact@v4
  1094. with: |
  1095. name: ${{ matrix.artifact_key }}-test-env
  1096. path: .
  1097. attempt_limit: 3
  1098. attempt_delay: 2000
  1099. - name: Load test environment
  1100. id: load
  1101. if: needs.file-check.outputs.run == 'true'
  1102. run: docker load --input image.tar
  1103. - name: Install netdata and run the updater on ${{ matrix.distro }}
  1104. id: updater-check
  1105. if: needs.file-check.outputs.run == 'true'
  1106. run: |
  1107. docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --network host -w /netdata \
  1108. -e EXTRA_INSTALL_FLAGS=${{ needs.file-check.outputs.skip-go }} \
  1109. test:${{ matrix.artifact_key }} /netdata/.github/scripts/run-updater-check.sh
  1110. - name: Failure Notification
  1111. uses: rtCamp/action-slack-notify@v2
  1112. env:
  1113. SLACK_COLOR: 'danger'
  1114. SLACK_FOOTER: ''
  1115. SLACK_ICON_EMOJI: ':github-actions:'
  1116. SLACK_TITLE: 'Updater checks for ${{ matrix.distro }} failed:'
  1117. SLACK_USERNAME: 'GitHub Actions'
  1118. SLACK_MESSAGE: |-
  1119. ${{ github.repository }}: Updater checks for ${{ matrix.distro }} failed.
  1120. Checkout: ${{ steps.checkout.outcome }}
  1121. Fetch dist tarball: ${{ steps.fetch-tarball.outcome }}
  1122. Prepare artifact directory: ${{ steps.prepare.outcome }}
  1123. Fetch test environment: ${{ steps.fetch-test-environment.outcome }}
  1124. Load test environment: ${{ steps.load.outcome }}
  1125. Updater check: ${{ steps.updater-check.outcome }}
  1126. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
  1127. if: >-
  1128. ${{
  1129. failure()
  1130. && startsWith(github.ref, 'refs/heads/master')
  1131. && github.event_name != 'pull_request'
  1132. && github.repository == 'netdata/netdata'
  1133. && needs.file-check.outputs.run == 'true'
  1134. }}
  1135. gitignore-check: # Verify that the build process does not make any changes to the source tree.
  1136. name: .gitignore
  1137. needs:
  1138. - file-check
  1139. runs-on: ubuntu-latest
  1140. steps:
  1141. - name: Skip Check
  1142. id: skip
  1143. if: needs.file-check.outputs.run != 'true'
  1144. run: echo "SKIPPED"
  1145. - name: Checkout
  1146. if: needs.file-check.outputs.run == 'true'
  1147. uses: actions/checkout@v4
  1148. with:
  1149. submodules: recursive
  1150. - name: Prepare environment
  1151. if: needs.file-check.outputs.run == 'true'
  1152. run: ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
  1153. - name: Build netdata
  1154. if: needs.file-check.outputs.run == 'true'
  1155. run: ./netdata-installer.sh --dont-start-it --disable-telemetry --dont-wait --install-prefix /tmp/install --one-time-build ${{ needs.file-check.outputs.skip-go }}
  1156. - name: Check that repo is clean
  1157. if: needs.file-check.outputs.run == 'true'
  1158. run: |
  1159. git status --porcelain=v1 > /tmp/porcelain
  1160. if [ -s /tmp/porcelain ]; then
  1161. cat /tmp/porcelain
  1162. exit 1
  1163. fi