summaryrefslogtreecommitdiffstats
path: root/.github/workflows/build.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/build.yml')
-rw-r--r--.github/workflows/build.yml100
1 files changed, 38 insertions, 62 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 53f1590f8..c3924fb0c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -57,7 +57,7 @@ jobs:
--with-math \
--with-user=netdata
make dist
- echo "::set-output name=distfile::$(find . -name 'netdata-*.tar.gz')"
+ echo "distfile=$(find . -name 'netdata-*.tar.gz')" >> "${GITHUB_OUTPUT}"
cp netdata-*.tar.gz artifacts/
- name: Store
id: store
@@ -171,6 +171,7 @@ jobs:
matrix: # Generate the shared build matrix for our build tests.
name: Prepare Build Matrix
runs-on: ubuntu-latest
+ if: github.event_name != 'workflow_dispatch'
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
@@ -183,39 +184,10 @@ jobs:
sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
- name: Read build matrix
id: set-matrix
- shell: python3 {0}
run: |
- from ruamel.yaml import YAML
- import json
- yaml = YAML(typ='safe')
- entries = list()
-
- with open('.github/data/distros.yml') as f:
- data = yaml.load(f)
-
- for i, v in enumerate(data['include']):
- e = {
- 'artifact_key': v['distro'] + str(v['version']).replace('.', ''),
- 'version': v['version'],
- }
-
- if 'base_image' in v:
- e['distro'] = ':'.join([v['base_image'], str(v['version'])])
- else:
- e['distro'] = ':'.join([v['distro'], str(v['version'])])
-
- if 'env_prep' in v:
- e['env_prep'] = v['env_prep']
-
- if 'jsonc_removal' in v:
- e['jsonc_removal'] = v['jsonc_removal']
-
- entries.append(e)
-
- entries.sort(key=lambda k: k['distro'])
- matrix = json.dumps({'include': entries}, sort_keys=True)
- print('Generated Matrix: ' + matrix)
- print('::set-output name=matrix::' + matrix)
+ matrix="$(.github/scripts/gen-matrix-build.py)"
+ echo "Generated matrix: ${matrix}"
+ echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env:
@@ -241,12 +213,13 @@ jobs:
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
+ if: github.event_name != 'workflow_dispatch'
needs:
- matrix
env:
RETRY_DELAY: 300
strategy:
- # Unlike the actal build tests, this completes _very_ fast (average of about 3 minutes for each job), so we
+ # Unlike the actual 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) }}
@@ -269,7 +242,7 @@ jobs:
BASE=${{ matrix.distro }}
PRE=${{ matrix.env_prep }}
RMJSONC=${{ matrix.jsonc_removal }}
- outputs: type=oci,dest=/tmp/image.tar
+ outputs: type=docker,dest=/tmp/image.tar
tags: test:${{ matrix.artifact_key }}
- name: Retry delay
if: ${{ steps.build1.outcome == 'failure' }}
@@ -287,7 +260,7 @@ jobs:
BASE=${{ matrix.distro }}
PRE=${{ matrix.env_prep }}
RMJSONC=${{ matrix.jsonc_removal }}
- outputs: type=oci,dest=/tmp/image.tar
+ outputs: type=docker,dest=/tmp/image.tar
tags: test:${{ matrix.artifact_key }}
- name: Retry delay
if: ${{ steps.build1.outcome == 'failure' && steps.build2.outcome == 'failure' }}
@@ -304,7 +277,7 @@ jobs:
BASE=${{ matrix.distro }}
PRE=${{ matrix.env_prep }}
RMJSONC=${{ matrix.jsonc_removal }}
- outputs: type=oci,dest=/tmp/image.tar
+ outputs: type=docker,dest=/tmp/image.tar
tags: test:${{ matrix.artifact_key }}
- name: Upload image artifact
id: upload
@@ -341,6 +314,7 @@ jobs:
source-build: # Test various source build arrangements.
name: Test Source Build
runs-on: ubuntu-latest
+ if: github.event_name != 'workflow_dispatch'
needs:
- matrix
- prepare-test-images
@@ -361,29 +335,27 @@ jobs:
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)"
+ run: docker load --input image.tar
- name: Regular build on ${{ matrix.distro }}
id: build-basic
run: |
- docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
+ docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
/bin/sh -c 'autoreconf -ivf && ./configure --disable-dependency-tracking && make -j2'
- name: netdata-installer on ${{ matrix.distro }}, disable cloud
id: build-no-cloud
run: |
- docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
+ docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
/bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --disable-cloud --one-time-build'
- name: netdata-installer on ${{ matrix.distro }}, require cloud
id: build-cloud
run: |
- docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
+ docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
/bin/sh -c './netdata-installer.sh --dont-wait --dont-start-it --require-cloud --one-time-build'
- name: netdata-installer on ${{ matrix.distro }}, require cloud, no JSON-C
id: build-no-jsonc
if: matrix.jsonc_removal != ''
run: |
- docker run --security-opt seccomp=unconfined -w /netdata sha256:${{ steps.load.outputs.image }} \
+ docker run --security-opt seccomp=unconfined -w /netdata test:${{ matrix.artifact_key }} \
/bin/sh -c '/rmjsonc.sh && ./netdata-installer.sh --dont-wait --dont-start-it --require-cloud --one-time-build'
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
@@ -414,6 +386,7 @@ jobs:
updater-check: # Test the generated dist archive using the updater code.
name: Test Generated Distfile and Updater Code
runs-on: ubuntu-latest
+ if: github.event_name != 'workflow_dispatch'
needs:
- build-dist
- matrix
@@ -442,10 +415,10 @@ jobs:
- name: Prepare artifact directory
id: prepare
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
+ mkdir -p artifacts/download/latest || exit 1
+ echo "9999.0.0-0" > artifacts/download/latest/latest-version.txt || exit 1
+ cp dist-tarball/* artifacts/download/latest || exit 1
+ cd artifacts/download/latest || exit 1
ln -s ${{ needs.build-dist.outputs.distfile }} netdata-latest.tar.gz || exit 1
sha256sum -b ./* > "sha256sums.txt" || exit 1
cat sha256sums.txt
@@ -456,13 +429,11 @@ jobs:
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)"
+ run: docker load --input image.tar
- name: Install netdata and run the updater on ${{ matrix.distro }}
id: updater-check
run: |
- docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --network host -w /netdata sha256:${{ steps.load.outputs.image }} \
+ docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --network host -w /netdata test:${{ matrix.artifact_key }} \
/netdata/.github/scripts/run-updater-check.sh
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
@@ -578,10 +549,15 @@ jobs:
with:
name: final-artifacts
path: artifacts
+ - name: Prepare artifacts directory
+ id: prepare
+ run: |
+ mkdir -p download/latest
+ mv artifacts/* download/latest
- name: Verify that artifacts work with installer
id: verify
env:
- NETDATA_TARBALL_BASEURL: http://localhost:8080/artifacts
+ NETDATA_TARBALL_BASEURL: http://localhost:8080/
run: packaging/installer/kickstart.sh --build-only --dont-start-it --disable-telemetry --dont-wait
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
@@ -627,10 +603,15 @@ jobs:
with:
name: final-artifacts
path: artifacts
+ - name: Prepare artifacts directory
+ id: prepare
+ run: |
+ mkdir -p download/latest
+ mv artifacts/* download/latest
- name: Verify that artifacts work with installer
id: verify
env:
- NETDATA_TARBALL_BASEURL: http://localhost:8080/artifacts
+ NETDATA_TARBALL_BASEURL: http://localhost:8080/
run: packaging/installer/kickstart.sh --static-only --dont-start-it --disable-telemetry
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
@@ -659,8 +640,6 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
needs:
- - updater-check
- - source-build
- artifact-verification-dist
- artifact-verification-static
steps:
@@ -714,8 +693,6 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
needs:
- - updater-check
- - source-build
- artifact-verification-dist
- artifact-verification-static
steps:
@@ -755,6 +732,7 @@ jobs:
repo: netdata-nightlies
body: Netdata nightly build for ${{ steps.version.outputs.date }}.
commit: ${{ steps.version.outputs.commit }}
+ makeLatest: true
tag: ${{ steps.version.outputs.version }}
token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
- name: Failure Notification
@@ -790,9 +768,9 @@ jobs:
id: tag
run: |
if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
- echo "::set-output name=tag::v${{ github.event.inputs.version }}"
+ echo "tag=v${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
else
- echo "::set-output name=tag::${{ github.event.inputs.version }}"
+ echo "tag=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
fi
upload-release: # Create the draft release and upload the build artifacts.
@@ -800,8 +778,6 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release' && github.repository == 'netdata/netdata'
needs:
- - updater-check
- - source-build
- artifact-verification-dist
- artifact-verification-static
- normalize-tag