609
&& needs.file-check.outputs.run == 'true'
610
}}
611
612
+ artifact-verification-updater: # Test the generated dist archive using the updater code.
613
+ name: Test Consolidated Artifacts (Updater)
614
+ runs-on: ubuntu-latest
615
+ needs:
616
+ - prepare-upload
617
+ - file-check
618
+ services:
619
+ apache: # This gets used to serve the dist tarball for the updater script.
620
+ image: httpd:2.4
621
+ ports:
622
+ - 8080:80
623
+ volumes:
624
+ - ${{ github.workspace }}:/usr/local/apache2/htdocs/
625
+ steps:
626
+ - name: Skip Check
627
+ id: skip
628
+ if: needs.file-check.outputs.run != 'true'
629
+ run: echo "SKIPPED"
630
+ - name: Checkout
631
+ id: checkout
632
+ if: needs.file-check.outputs.run == 'true'
633
+ uses: actions/checkout@v4
634
+ - name: Fetch artifacts
635
+ id: fetch-artifacts
636
+ if: needs.file-check.outputs.run == 'true'
637
+ uses: Wandalen/wretry.action@v3
638
+ with:
639
+ action: actions/download-artifact@v4
640
+ with: |
641
+ name: final-artifacts
642
+ path: artifacts
643
+ attempt_limit: 3
644
+ attempt_delay: 2000
645
+ - name: Prepare artifacts directory
646
+ id: prepare
647
+ if: needs.file-check.outputs.run == 'true'
648
+ run: |
649
+ mkdir -p download/latest
650
+ mv artifacts/* download/latest
651
+ ls -al download/latest
652
+ - name: Run Updater Check
653
+ id: check
654
+ if: needs.file-check.outputs.run == 'true'
655
+ run: |
656
+ docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --network host \
657
+ -v $PWD:/netdata -w /netdata \
658
+ ubuntu:latest /bin/sh -x /netdata/.github/scripts/run-updater-check.sh
659
+ - name: Failure Notification
660
+ uses: rtCamp/action-slack-notify@v2
661
+ env:
662
+ SLACK_COLOR: 'danger'
663
+ SLACK_FOOTER: ''
664
+ SLACK_ICON_EMOJI: ':github-actions:'
665
+ SLACK_TITLE: 'Updater checks for ${{ matrix.distro }} failed:'
666
+ SLACK_USERNAME: 'GitHub Actions'
667
+ SLACK_MESSAGE: |-
668
+ ${{ github.repository }}: Updater checks for ${{ matrix.distro }} failed.
669
+ Checkout: ${{ steps.checkout.outcome }}
670
+ Fetch artifacts: ${{ steps.fetch-artifacts.outcome }}
671
+ Prepare artifact directory: ${{ steps.prepare.outcome }}
672
+ Updater check: ${{ steps.check.outcome }}
673
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
674
+ if: >-
675
+ ${{
676
+ failure()
677
+ && startsWith(github.ref, 'refs/heads/master')
678
+ && github.event_name != 'pull_request'
679
+ && github.repository == 'netdata/netdata'
680
+ && needs.file-check.outputs.run == 'true'
681
+ }}
682
+
683
create-nightly: # Create a nightly build release in netdata/netdata-nightlies
684
name: Create Nightly Release
685
runs-on: ubuntu-latest
926
&& github.repository == 'netdata/netdata'
927
}}
928
858
- prepare-test-images: # Prepare the test environments for our build checks. This also checks dependency handling code for each tested environment.
859
- name: Prepare Test Environments
860
- runs-on: ubuntu-latest
861
- if: github.event_name != 'workflow_dispatch'
862
- needs:
863
- - matrix
864
- env:
865
- RETRY_DELAY: 300
866
- strategy:
867
- # Unlike the actual build tests, this completes _very_ fast (average of about 3 minutes for each job), so we
868
- # just run everything in parallel instead lof limiting job concurrency.
869
- fail-fast: false
870
- matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
871
- steps:
872
- - name: Checkout
873
- id: checkout
874
- uses: actions/checkout@v4
875
- - name: Setup Buildx
876
- id: buildx
877
- uses: docker/setup-buildx-action@v3
878
- - name: Build test environment
879
- id: build1
880
- uses: docker/build-push-action@v6
881
- continue-on-error: true # We retry 3 times at 5 minute intervals if there is a failure here.
882
- with:
883
- push: false
884
- load: false
885
- file: .github/dockerfiles/Dockerfile.build_test
886
- build-args: |
887
- BASE=${{ matrix.distro }}
888
- PRE=${{ matrix.env_prep }}
889
- RMJSONC=${{ matrix.jsonc_removal }}
890
- outputs: type=docker,dest=/tmp/image.tar
891
- tags: test:${{ matrix.artifact_key }}
892
- - name: Retry delay
893
- if: ${{ steps.build1.outcome == 'failure' }}
894
- run: sleep "${RETRY_DELAY}"
895
- - name: Build test environment (attempt 2)
896
- if: ${{ steps.build1.outcome == 'failure' }}
897
- id: build2
898
- uses: docker/build-push-action@v6
899
- continue-on-error: true # We retry 3 times at 5 minute intervals if there is a failure here.
900
- with:
901
- push: false
902
- load: false
903
- file: .github/dockerfiles/Dockerfile.build_test
904
- build-args: |
905
- BASE=${{ matrix.distro }}
906
- PRE=${{ matrix.env_prep }}
907
- RMJSONC=${{ matrix.jsonc_removal }}
908
- outputs: type=docker,dest=/tmp/image.tar
909
- tags: test:${{ matrix.artifact_key }}
910
- - name: Retry delay
911
- if: ${{ steps.build1.outcome == 'failure' && steps.build2.outcome == 'failure' }}
912
- run: sleep "${RETRY_DELAY}"
913
- - name: Build test environment (attempt 3)
914
- if: ${{ steps.build1.outcome == 'failure' && steps.build2.outcome == 'failure' }}
915
- id: build3
916
- uses: docker/build-push-action@v6
917
- with:
918
- push: false
919
- load: false
920
- file: .github/dockerfiles/Dockerfile.build_test
921
- build-args: |
922
- BASE=${{ matrix.distro }}
923
- PRE=${{ matrix.env_prep }}
924
- RMJSONC=${{ matrix.jsonc_removal }}
925
- outputs: type=docker,dest=/tmp/image.tar
926
- tags: test:${{ matrix.artifact_key }}
927
- - name: Upload image artifact
928
- id: upload
929
- uses: actions/upload-artifact@v4.4.2
930
- with:
931
- name: ${{ matrix.artifact_key }}-test-env
932
- path: /tmp/image.tar
933
- retention-days: 30
934
- - name: Failure Notification
935
- uses: rtCamp/action-slack-notify@v2
936
- env:
937
- SLACK_COLOR: 'danger'
938
- SLACK_FOOTER: ''
939
- SLACK_ICON_EMOJI: ':github-actions:'
940
- SLACK_TITLE: 'Test environment preparation for ${{ matrix.distro }} failed:'
941
- SLACK_USERNAME: 'GitHub Actions'
942
- SLACK_MESSAGE: |-
943
- ${{ github.repository }}: Test environment preparation for ${{ matrix.distro }} failed.
944
- Checkout: ${{ steps.checkout.outcome }}
945
- Set up Buildx: ${{ steps.buildx.outcome }}
946
- Build test environment: ${{ steps.build1.outcome }}
947
- Build test environment (attempt 2): ${{ steps.build2.outcome }}
948
- Build test environment (attempt 3): ${{ steps.build3.outcome }}
949
- Upload: ${{ steps.upload.outcome }}
950
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
951
- if: >-
952
- ${{
953
- failure()
954
- && startsWith(github.ref, 'refs/heads/master')
955
- && github.event_name != 'pull_request'
956
- && github.repository == 'netdata/netdata'
957
- }}
958
-
929
source-build: # Test various source build arrangements.
930
name: Test Source Build
931
runs-on: ubuntu-latest
932
if: github.event_name != 'workflow_dispatch'
933
needs:
934
- matrix
965
- - prepare-test-images
935
- file-check
936
strategy:
937
fail-fast: false
948
uses: actions/checkout@v4
949
with:
950
submodules: recursive
982
- - name: Fetch test environment
983
- id: fetch
984
- if: needs.file-check.outputs.run == 'true'
951
+ - name: Setup Buildx
952
+ id: buildx
953
+ uses: docker/setup-buildx-action@v3
954
+ - name: Build test environment
955
+ id: build
956
uses: Wandalen/wretry.action@v3
957
with:
987
- action: actions/download-artifact@v4
958
+ action: docker/build-push-action@v6
959
with: |
989
- name: ${{ matrix.artifact_key }}-test-env
990
- path: .
960
+ push: false
961
+ load: true
962
+ file: .github/dockerfiles/Dockerfile.build_test
963
+ build-args: |
964
+ BASE=${{ matrix.distro }}
965
+ PRE=${{ matrix.env_prep }}
966
+ RMJSONC=${{ matrix.jsonc_removal }}
967
+ tags: test:${{ matrix.artifact_key }}
968
attempt_limit: 3
992
- attempt_delay: 2000
993
- - name: Load test environment
994
- id: load
995
- if: needs.file-check.outputs.run == 'true'
996
- run: docker load --input image.tar
997
- - name: netdata-installer on ${{ matrix.distro }}, require cloud
969
+ attempt_delay: 15000
970
+ - name: netdata-installer on ${{ matrix.distro }}
971
id: build-cloud
972
if: needs.file-check.outputs.run == 'true'
973
run: |
974
docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
975
/bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --one-time-build ${{ needs.file-check.outputs.skip-go }}'
1003
- - name: netdata-installer on ${{ matrix.distro }}, require cloud, no JSON-C
1004
- id: build-no-jsonc
1005
- if: matrix.jsonc_removal != '' && needs.file-check.outputs.run == 'true'
1006
- run: |
1007
- docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
1008
- /bin/sh -c '/rmjsonc.sh && ./netdata-installer.sh --dont-wait --dont-start-it --one-time-build ${{ needs.file-check.outputs.skip-go }}'
976
- name: Failure Notification
977
uses: rtCamp/action-slack-notify@v2
978
env:
984
SLACK_MESSAGE: |-
985
${{ github.repository }}: Build tests for ${{ matrix.distro }} failed.
986
Checkout: ${{ steps.checkout.outcome }}
1020
- Fetch test environment: ${{ steps.fetch.outcome }}
1021
- Load test environment: ${{ steps.load.outcome }}
987
+ Set up Buildx: ${{ steps.buildx.outcome }}
988
+ Build test environment: ${{ steps.build1.outcome }}
989
netdata-installer: ${{ steps.build-cloud.outcome }}
1023
- netdata-installer, no JSON-C: ${{ steps.build-no-jsonc.outcome }}
990
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
991
if: >-
992
${{
1068
&& github.event_name != 'pull_request'
1069
&& github.repository == 'netdata/netdata'
1070
}}
1105
-
1106
- updater-check: # Test the generated dist archive using the updater code.
1107
- name: Test Generated Distfile and Updater Code
1108
- runs-on: ubuntu-latest
1109
- if: github.event_name != 'workflow_dispatch'
1110
- needs:
1111
- - build-dist
1112
- - matrix
1113
- - prepare-test-images
1114
- - file-check
1115
- strategy:
1116
- fail-fast: false
1117
- max-parallel: 8
1118
- matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
1119
- services:
1120
- apache: # This gets used to serve the dist tarball for the updater script.
1121
- image: httpd:2.4
1122
- ports:
1123
- - 8080:80
1124
- volumes:
1125
- - ${{ github.workspace }}:/usr/local/apache2/htdocs/
1126
- steps:
1127
- - name: Skip Check
1128
- id: skip
1129
- if: needs.file-check.outputs.run != 'true'
1130
- run: echo "SKIPPED"
1131
- - name: Checkout
1132
- id: checkout
1133
- if: needs.file-check.outputs.run == 'true'
1134
- uses: actions/checkout@v4
1135
- - name: Fetch dist tarball artifacts
1136
- id: fetch-tarball
1137
- if: needs.file-check.outputs.run == 'true'
1138
- uses: Wandalen/wretry.action@v3
1139
- with:
1140
- action: actions/download-artifact@v4
1141
- with: |
1142
- name: dist-tarball
1143
- path: dist-tarball
1144
- attempt_limit: 3
1145
- attempt_delay: 2000
1146
- - name: Prepare artifact directory
1147
- id: prepare
1148
- if: needs.file-check.outputs.run == 'true'
1149
- run: |
1150
- mkdir -p artifacts/download/v9999.0.0 || exit 1
1151
- mkdir -p artifacts/latest || exit 1
1152
- echo "v9999.0.0" > artifacts/latest/latest-version.txt || exit 1
1153
- cp dist-tarball/* artifacts/download/v9999.0.0 || exit 1
1154
- cd artifacts/download/v9999.0.0 || exit 1
1155
- ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
1156
- ls -lFh
1157
- sha256sum -b ./* > "sha256sums.txt" || exit 1
1158
- cat sha256sums.txt
1159
- cd ../.. || exit 1
1160
- ls -lR
1161
- - name: Fetch test environment
1162
- id: fetch-test-environment
1163
- if: needs.file-check.outputs.run == 'true'
1164
- uses: Wandalen/wretry.action@v3
1165
- with:
1166
- action: actions/download-artifact@v4
1167
- with: |
1168
- name: ${{ matrix.artifact_key }}-test-env
1169
- path: .
1170
- attempt_limit: 3
1171
- attempt_delay: 2000
1172
- - name: Load test environment
1173
- id: load
1174
- if: needs.file-check.outputs.run == 'true'
1175
- run: docker load --input image.tar
1176
- - name: Install netdata and run the updater on ${{ matrix.distro }}
1177
- id: updater-check
1178
- if: needs.file-check.outputs.run == 'true'
1179
- run: |
1180
- docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --network host -w /netdata \
1181
- -e EXTRA_INSTALL_FLAGS=${{ needs.file-check.outputs.skip-go }} \
1182
- test:${{ matrix.artifact_key }} /netdata/.github/scripts/run-updater-check.sh
1183
- - name: Failure Notification
1184
- uses: rtCamp/action-slack-notify@v2
1185
- env:
1186
- SLACK_COLOR: 'danger'
1187
- SLACK_FOOTER: ''
1188
- SLACK_ICON_EMOJI: ':github-actions:'
1189
- SLACK_TITLE: 'Updater checks for ${{ matrix.distro }} failed:'
1190
- SLACK_USERNAME: 'GitHub Actions'
1191
- SLACK_MESSAGE: |-
1192
- ${{ github.repository }}: Updater checks for ${{ matrix.distro }} failed.
1193
- Checkout: ${{ steps.checkout.outcome }}
1194
- Fetch dist tarball: ${{ steps.fetch-tarball.outcome }}
1195
- Prepare artifact directory: ${{ steps.prepare.outcome }}
1196
- Fetch test environment: ${{ steps.fetch-test-environment.outcome }}
1197
- Load test environment: ${{ steps.load.outcome }}
1198
- Updater check: ${{ steps.updater-check.outcome }}
1199
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
1200
- if: >-
1201
- ${{
1202
- failure()
1203
- && startsWith(github.ref, 'refs/heads/master')
1204
- && github.event_name != 'pull_request'
1205
- && github.repository == 'netdata/netdata'
1206
- && needs.file-check.outputs.run == 'true'
1207
- }}
1208
-
1209
- gitignore-check: # Verify that the build process does not make any changes to the source tree.
1210
- name: .gitignore
1211
- needs:
1212
- - file-check
1213
- runs-on: ubuntu-latest
1214
- steps:
1215
- - name: Skip Check
1216
- id: skip
1217
- if: needs.file-check.outputs.run != 'true'
1218
- run: echo "SKIPPED"
1219
- - name: Checkout
1220
- if: needs.file-check.outputs.run == 'true'
1221
- uses: actions/checkout@v4
1222
- with:
1223
- submodules: recursive
1224
- - name: Prepare environment
1225
- if: needs.file-check.outputs.run == 'true'
1226
- run: ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata
1227
- - name: Build netdata
1228
- if: needs.file-check.outputs.run == 'true'
1229
- run: ./netdata-installer.sh --dont-start-it --disable-telemetry --dont-wait --install-prefix /tmp/install --one-time-build ${{ needs.file-check.outputs.skip-go }}
1230
- - name: Check that repo is clean
1231
- if: needs.file-check.outputs.run == 'true'
1232
- run: |
1233
- git status --porcelain=v1 > /tmp/porcelain
1234
- if [ -s /tmp/porcelain ]; then
1235
- cat /tmp/porcelain
1236
- exit 1
1237
- fi