summaryrefslogtreecommitdiffstats
path: root/.github/workflows/repoconfig-packages.yml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.github/workflows/repoconfig-packages.yml118
1 files changed, 90 insertions, 28 deletions
diff --git a/.github/workflows/repoconfig-packages.yml b/.github/workflows/repoconfig-packages.yml
index b8d0ff67c..b0600cc0b 100644
--- a/.github/workflows/repoconfig-packages.yml
+++ b/.github/workflows/repoconfig-packages.yml
@@ -14,30 +14,80 @@ on:
- packaging/repoconfig/**
- .github/workflows/repoconfig-packages.yml
env:
- DO_NOT_TRACK: 1
+ DISABLE_TELEMETRY: 1
+ REPO_PREFIX: netdata/netdata
jobs:
+ matrix:
+ name: Prepare Build Matrix
+ runs-on: ubuntu-latest
+ outputs:
+ matrix: ${{ steps.set-matrix.outputs.matrix }}
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v3
+ - name: Prepare tools
+ id: prepare
+ run: |
+ 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']):
+ if 'packages' in data['include'][i]:
+ entries.append({
+ 'distro': data['include'][i]['distro'],
+ 'version': data['include'][i]['version'],
+ 'pkgclouddistro': data['include'][i]['packages']['repo_distro'],
+ 'format': data['include'][i]['packages']['type'],
+ 'base_image': data['include'][i]['base_image'] if 'base_image' in data['include'][i] else data['include'][i]['distro'],
+ 'platform': data['platform_map']['amd64'],
+ 'arch': 'amd64'
+ })
+
+ entries.sort(key=lambda k: (k['arch'], k['distro'], k['version']))
+ matrix = json.dumps({'include': entries}, sort_keys=True)
+ print('Generated Matrix: ' + matrix)
+ print('::set-output name=matrix::' + matrix)
+ - name: Failure Notification
+ uses: rtCamp/action-slack-notify@v2
+ env:
+ SLACK_COLOR: 'danger'
+ SLACK_ICON_EMOJI: ':github-actions:'
+ SLACK_TITLE: 'Repository Package Build matrix generation failed:'
+ SLACK_USERNAME: 'GitHub Actions'
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: Failed to generate build matrix for repository package build.
+ Checkout: ${{ steps.checkout.outcome }}
+ Prepare Tools: ${{ steps.prepare.outcome }}
+ Read Build Matrix: ${{ steps.set-matrix.outcome }}
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
+ if: >-
+ ${{
+ failure()
+ && github.event_name != 'pull_request'
+ && startsWith(github.ref, 'refs/heads/master')
+ }}
+
build:
name: Build
runs-on: ubuntu-latest
env:
- DO_NOT_TRACK: 1
+ DISABLE_TELEMETRY: 1
DOCKER_CLI_EXPERIMENTAL: enabled
+ needs:
+ - matrix
strategy:
- # This needs to be kept in sync with the matrix in packaging.yml, but should only include the AMD64 lines.
- matrix:
- include:
- - {distro: debian, version: "9", pkgclouddistro: debian/stretch, format: deb, base_image: debian, platform: linux/amd64, arch: amd64}
- - {distro: debian, version: "10", pkgclouddistro: debian/buster, format: deb, base_image: debian, platform: linux/amd64, arch: amd64}
- - {distro: debian, version: "11", pkgclouddistro: debian/bullseye, format: deb, base_image: debian, platform: linux/amd64, arch: amd64}
- - {distro: ubuntu, version: "18.04", pkgclouddistro: ubuntu/bionic, format: deb, base_image: ubuntu, platform: linux/amd64, arch: amd64}
- - {distro: ubuntu, version: "20.04", pkgclouddistro: ubuntu/focal, format: deb, base_image: ubuntu, platform: linux/amd64, arch: amd64}
- - {distro: ubuntu, version: "21.10", pkgclouddistro: ubuntu/impish, format: deb, base_image: ubuntu, platform: linux/amd64, arch: amd64}
- - {distro: centos, version: "7", pkgclouddistro: el/7, format: rpm, base_image: centos, platform: linux/amd64, arch: amd64}
- - {distro: rockylinux, version: "8", pkgclouddistro: el/8, format: rpm, base_image: rockylinux/rockylinux, platform: linux/amd64, arch: amd64}
- - {distro: fedora, version: "34", pkgclouddistro: fedora/34, format: rpm, base_image: fedora, platform: linux/amd64, arch: amd64}
- - {distro: fedora, version: "35", pkgclouddistro: fedora/35, format: rpm, base_image: fedora, platform: linux/amd64, arch: amd64}
- - {distro: opensuse, version: "15.3", pkgclouddistro: opensuse/15.3, format: rpm, base_image: opensuse/leap, platform: linux/amd64, arch: amd64}
- - {distro: oraclelinux, version: "8", pkgclouddistro: ol/8, format: rpm, base_image: oraclelinux, platform: linux/amd64, arch: amd64}
+ matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
# We intentiaonally disable the fail-fast behavior so that a
# build failure for one version doesn't prevent us from publishing
# successfully built and tested packages for another version.
@@ -45,9 +95,11 @@ jobs:
max-parallel: 8
steps:
- name: Checkout
- uses: actions/checkout@v2
+ id: checkout
+ uses: actions/checkout@v3
# Unlike normally, we do not need a deep clone or submodules for this.
- name: Fetch base image
+ id: fetch-images
uses: nick-invision/retry@v2
with:
max_attempts: 3
@@ -55,25 +107,30 @@ jobs:
timeout_seconds: 900
command: docker pull --platform ${{ matrix.platform }} ${{ matrix.base_image }}:${{ matrix.version }}
- name: Build Packages
+ id: build
shell: bash
run: |
- docker run --security-opt seccomp=unconfined -e DO_NOT_TRACK=1 --platform ${{ matrix.platform }} \
- -v $PWD:/netdata ${{ matrix.base_image }}:${{ matrix.version }} \
+ docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --platform ${{ matrix.platform }} \
+ -v "$PWD":/netdata ${{ matrix.base_image }}:${{ matrix.version }} \
/netdata/packaging/repoconfig/build-${{ matrix.format }}.sh
- name: Upload Packages
+ id: publish
if: github.event_name != 'pull_request' && github.repository == 'netdata/netdata'
shell: bash
env:
PKG_CLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }}
run: |
- echo "Packages to upload:\n$(ls artifacts/*.${{ matrix.format }})"
+ printf "Packages to upload:\n%s" "$(ls artifacts/*.${{ matrix.format }})"
for pkgfile in artifacts/*.${{ matrix.format }} ; do
- .github/scripts/package_cloud_wrapper.sh yank ${{ secrets.PACKAGE_CLOUD_REPO }}/${{ matrix.pkgclouddistro }} $(basename ${pkgfile}) || true
- .github/scripts/package_cloud_wrapper.sh push ${{ secrets.PACKAGE_CLOUD_REPO }}/${{ matrix.pkgclouddistro }} ${pkgfile}
- .github/scripts/package_cloud_wrapper.sh yank ${{ secrets.PACKAGE_CLOUD_REPO }}-edge/${{ matrix.pkgclouddistro }} $(basename ${pkgfile}) || true
- .github/scripts/package_cloud_wrapper.sh push ${{ secrets.PACKAGE_CLOUD_REPO }}-edge/${{ matrix.pkgclouddistro }} ${pkgfile}
- .github/scripts/package_cloud_wrapper.sh yank ${{ secrets.PACKAGE_CLOUD_REPO }}-repoconfig/${{ matrix.pkgclouddistro }} $(basename ${pkgfile}) || true
- .github/scripts/package_cloud_wrapper.sh push ${{ secrets.PACKAGE_CLOUD_REPO }}-repoconfig/${{ matrix.pkgclouddistro }} ${pkgfile}
+ .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}/${{ matrix.pkgclouddistro }}" \
+ "$(basename "${pkgfile}")" || true
+ .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}/${{ matrix.pkgclouddistro }}" "${pkgfile}"
+ .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}-edge/${{ matrix.pkgclouddistro }}" \
+ "$(basename "${pkgfile}")" || true
+ .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}-edge/${{ matrix.pkgclouddistro }}" "${pkgfile}"
+ .github/scripts/package_cloud_wrapper.sh yank "${REPO_PREFIX}-repoconfig/${{ matrix.pkgclouddistro }}" \
+ "$(basename "${pkgfile}")" || true
+ .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}-repoconfig/${{ matrix.pkgclouddistro }}" "${pkgfile}"
done
- name: Failure Notification
if: ${{ failure() }}
@@ -84,5 +141,10 @@ jobs:
SLACK_ICON_EMOJI: ':github-actions:'
SLACK_TITLE: 'Repository Package Build failed:'
SLACK_USERNAME: 'GitHub Actions'
- SLACK_MESSAGE: "${{ matrix.pkgclouddistro }} ${{ matrix.version }} repository package build failed."
+ SLACK_MESSAGE: |-
+ ${{ github.repository }}: ${{ matrix.pkgclouddistro }} ${{ matrix.version }} repository package build failed.
+ Checkout: ${{ steps.checkout.outcome }}
+ Fetch images: ${{ steps.fetch-images.outcome }}
+ Build: ${{ steps.build.outcome }}
+ Publish: ${{ steps.publish.outcome }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}