Skip to content

02a - Basic testing for the Linux packages #34

02a - Basic testing for the Linux packages

02a - Basic testing for the Linux packages #34

name: '02a - Basic testing for the Linux packages'
# Controls when the workflow will run
on:
workflow_run:
workflows:
- '01a - Compile and build the packages for Linux'
types:
- 'completed'
env:
# we use `${{ github.sha }}-${{ github.run_id }}_${{ github.run_attempt }}` so we get a (mostly) unique directory, to avoid folder collisions when multiple workflows are running
BASE_DIR: '${{ github.sha }}-${{ github.run_id }}_${{ github.run_attempt }}'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
prepare:
runs-on:
- 'rhel8'
- 'self-hosted'
steps:
- name: 'checkout the monitoring-plugins repo'
uses: 'actions/checkout@v4'
with:
path: '${{ env.BASE_DIR }}/repos/monitoring-plugins'
ref: '${{ github.event.workflow_run.head_sha }}'
# using this instead of the official `download-artifact` action since this allows cross-workflow
- name: 'download the monitoring-plugins-linux-packages artifact'
id: 'download-artifact'
uses: 'dawidd6/action-download-artifact@v2'
with:
workflow: 'linux-build.yml'
workflow_conclusion: 'success'
path: '${{ env.BASE_DIR }}/'
- name: 'mkdir ${{ env.BASE_DIR }}/output'
run: 'mkdir ${{ env.BASE_DIR }}/output'
# Debian
test-debian10:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/output/debian10'
run: 'mkdir ${{ env.BASE_DIR }}/output/debian10'
- name: 'Test on Debian 10'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/output/debian10,destination=/output,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
--mount type=bind,source=${{ env.BASE_DIR }}/monitoring-plugins-linux-packages/debian10,destination=/packages,relabel=shared,ro=true \
docker.io/library/debian:buster /bin/bash -x /repos/monitoring-plugins/testing/debian/run-all
test-debian11:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/output/debian11'
run: 'mkdir ${{ env.BASE_DIR }}/output/debian11'
- name: 'Test on Debian 11'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/output/debian11,destination=/output,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
--mount type=bind,source=${{ env.BASE_DIR }}/monitoring-plugins-linux-packages/debian11,destination=/packages,relabel=shared,ro=true \
docker.io/library/debian:bullseye /bin/bash -x /repos/monitoring-plugins/testing/debian/run-all
test-debian12:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/output/debian12'
run: 'mkdir ${{ env.BASE_DIR }}/output/debian12'
- name: 'Test on RHEL8'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/output/debian12,destination=/output,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
--mount type=bind,source=${{ env.BASE_DIR }}/monitoring-plugins-linux-packages/debian12,destination=/packages,relabel=shared,ro=true \
docker.io/library/debian:bookworm /bin/bash -x /repos/monitoring-plugins/testing/debian/run-all
# RHEL
test-rhel7:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/output/rhel7'
run: 'mkdir ${{ env.BASE_DIR }}/output/rhel7'
- name: 'Test on RHEL8'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/output/rhel7,destination=/output,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
--mount type=bind,source=${{ env.BASE_DIR }}/monitoring-plugins-linux-packages/rhel7,destination=/packages,relabel=shared,ro=true \
registry.access.redhat.com/ubi7/ubi /bin/bash -x /repos/monitoring-plugins/testing/rhel/run-all
test-rhel8:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/output/rhel8'
run: 'mkdir ${{ env.BASE_DIR }}/output/rhel8'
- name: 'Test on RHEL8'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/output/rhel8,destination=/output,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
--mount type=bind,source=${{ env.BASE_DIR }}/monitoring-plugins-linux-packages/rhel8,destination=/packages,relabel=shared,ro=true \
registry.access.redhat.com/ubi8/ubi /bin/bash -x /repos/monitoring-plugins/testing/rhel/run-all
test-rhel9:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/output/rhel9'
run: 'mkdir ${{ env.BASE_DIR }}/output/rhel9'
- name: 'Test on RHEL8'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/output/rhel9,destination=/output,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
--mount type=bind,source=${{ env.BASE_DIR }}/monitoring-plugins-linux-packages/rhel9,destination=/packages,relabel=shared,ro=true \
registry.access.redhat.com/ubi9/ubi /bin/bash -x /repos/monitoring-plugins/testing/rhel/run-all
# Ubuntu
test-ubuntu1804:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/output/ubuntu1804'
run: 'mkdir ${{ env.BASE_DIR }}/output/ubuntu1804'
- name: 'Test on Ubuntu 18.04'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/output/ubuntu1804,destination=/output,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
--mount type=bind,source=${{ env.BASE_DIR }}/monitoring-plugins-linux-packages/ubuntu1804,destination=/packages,relabel=shared,ro=true \
docker.io/library/ubuntu:18.04 /bin/bash -x /repos/monitoring-plugins/testing/ubuntu/run-all
test-ubuntu2004:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/output/ubuntu2004'
run: 'mkdir ${{ env.BASE_DIR }}/output/ubuntu2004'
- name: 'Test on Ubuntu 20.04'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/output/ubuntu2004,destination=/output,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
--mount type=bind,source=${{ env.BASE_DIR }}/monitoring-plugins-linux-packages/ubuntu2004,destination=/packages,relabel=shared,ro=true \
docker.io/library/ubuntu:20.04 /bin/bash -x /repos/monitoring-plugins/testing/ubuntu/run-all
test-ubuntu2204:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/output/ubuntu2204'
run: 'mkdir ${{ env.BASE_DIR }}/output/ubuntu2204'
- name: 'Test on Ubuntu 22.04'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/output/ubuntu2204,destination=/output,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
--mount type=bind,source=${{ env.BASE_DIR }}/monitoring-plugins-linux-packages/ubuntu2204,destination=/packages,relabel=shared,ro=true \
docker.io/library/ubuntu:22.04 /bin/bash -x /repos/monitoring-plugins/testing/ubuntu/run-all
test-ubuntu2404:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/output/ubuntu2404'
run: 'mkdir ${{ env.BASE_DIR }}/output/ubuntu2404'
- name: 'Test on Ubuntu 24.04'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/output/ubuntu2404,destination=/output,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
--mount type=bind,source=${{ env.BASE_DIR }}/monitoring-plugins-linux-packages/ubuntu2404,destination=/packages,relabel=shared,ro=true \
docker.io/library/ubuntu:24.04 /bin/bash -x /repos/monitoring-plugins/testing/ubuntu/run-all
# this would not work on the GitHub-hosted runners, as each job is isolated there,
# but works when self-hosted (since there are no parallel jobs)
upload-outputs:
runs-on:
- 'rhel8'
- 'self-hosted'
needs: # we want this to run after the above jobs
- 'test-debian10'
- 'test-debian11'
- 'test-debian12'
- 'test-rhel7'
- 'test-rhel8'
- 'test-rhel9'
- 'test-ubuntu1804'
- 'test-ubuntu2004'
- 'test-ubuntu2204'
- 'test-ubuntu2404'
if: '${{ always() }}' # however, we want to upload the artifacts even if one of the job fails
steps:
- name: 'upload the output as monitoring-plugins-test-output'
uses: 'actions/upload-artifact@v4'
with:
name: 'monitoring-plugins-test-output'
path: '${{ env.BASE_DIR }}/output/'
cleanup:
runs-on:
- 'rhel8'
- 'self-hosted'
needs: # we want this to run after the above jobs
- 'upload-outputs'
steps:
- name: 'rm -rf ${{ env.BASE_DIR }}'
run: 'rm -rf ${{ env.BASE_DIR }}'