Skip to content

01a - Compile and build the packages for Linux #30

01a - Compile and build the packages for Linux

01a - Compile and build the packages for Linux #30

Workflow file for this run

name: '01a - Compile and build the packages for Linux'
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
tags:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
package-version:
description: 'The version to give to the packages. Defaults to the current tag.'
required: false
default: ''
lib-repo-ref:
description: 'The branch, tag or SHA to checkout (lib repo). Defaults to the current tag.'
required: false
default: ''
package-iteration:
description: 'The iteration to give to the package. RPM calls this the ‘release’. FreeBSD calls it ‘PORTREVISION’. Debian calls this ‘debian_revision’'
required: false
default: '1'
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'
- name: 'checkout the lib repo'
uses: 'actions/checkout@v4'
with:
repository: 'Linuxfabrik/lib'
ref: '${{ inputs.lib-repo-ref || github.ref_name }}'
path: '${{ env.BASE_DIR }}/repos/lib'
- name: 'mkdir ${{ env.BASE_DIR }}/build'
run: 'mkdir ${{ env.BASE_DIR }}/build'
# Debian
build-debian10:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/build/debian10'
run: 'mkdir ${{ env.BASE_DIR }}/build/debian10'
- name: 'Build for Debian 10'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/build/debian10,destination=/build,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
docker.io/library/debian:buster /bin/bash -x /repos/monitoring-plugins/build/debian10/build.sh ${{ inputs.package-version || github.ref_name }} ${{ inputs.package-iteration || '1' }}
build-debian11:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/build/debian11'
run: 'mkdir ${{ env.BASE_DIR }}/build/debian11'
- name: 'Build for Debian 11'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/build/debian11,destination=/build,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
docker.io/library/debian:bullseye /bin/bash -x /repos/monitoring-plugins/build/debian11/build.sh ${{ inputs.package-version || github.ref_name }} ${{ inputs.package-iteration || '1' }}
build-debian12:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/build/debian12'
run: 'mkdir ${{ env.BASE_DIR }}/build/debian12'
- name: 'Build for Debian 12'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/build/debian12,destination=/build,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
docker.io/library/debian:bookworm /bin/bash -x /repos/monitoring-plugins/build/debian12/build.sh ${{ inputs.package-version || github.ref_name }} ${{ inputs.package-iteration || '1' }}
# RHEL
build-rhel7:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/build/rhel7'
run: 'mkdir ${{ env.BASE_DIR }}/build/rhel7'
- name: 'Build for RHEL7'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/build/rhel7,destination=/build,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
registry.access.redhat.com/ubi7/ubi /bin/bash -x /repos/monitoring-plugins/build/rhel7/build.sh ${{ inputs.package-version || github.ref_name }} ${{ inputs.package-iteration || '1' }}
build-rhel8:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/build/rhel8'
run: 'mkdir ${{ env.BASE_DIR }}/build/rhel8'
- name: 'Build for RHEL8'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/build/rhel8,destination=/build,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
registry.access.redhat.com/ubi8/ubi /bin/bash -x /repos/monitoring-plugins/build/rhel8/build.sh ${{ inputs.package-version || github.ref_name }} ${{ inputs.package-iteration || '1' }}
build-rhel9:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/build/rhel9'
run: 'mkdir ${{ env.BASE_DIR }}/build/rhel9'
- name: 'Build for RHEL9'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/build/rhel9,destination=/build,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
registry.access.redhat.com/ubi9/ubi /bin/bash -x /repos/monitoring-plugins/build/rhel9/build.sh ${{ inputs.package-version || github.ref_name }} ${{ inputs.package-iteration || '1' }}
# Ubuntu
build-ubuntu1804:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu1804'
run: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu1804'
- name: 'Build for Ubuntu 18.04'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/build/ubuntu1804,destination=/build,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
docker.io/library/ubuntu:18.04 /bin/bash -x /repos/monitoring-plugins/build/ubuntu1804/build.sh ${{ inputs.package-version || github.ref_name }} ${{ inputs.package-iteration || '1' }}
build-ubuntu2004:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2004'
run: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2004'
- name: 'Build for Ubuntu 20.04'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/build/ubuntu2004,destination=/build,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
docker.io/library/ubuntu:20.04 /bin/bash -x /repos/monitoring-plugins/build/ubuntu2004/build.sh ${{ inputs.package-version || github.ref_name }} ${{ inputs.package-iteration || '1' }}
build-ubuntu2204:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2204'
run: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2204'
- name: 'Build for Ubuntu 22.04'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/build/ubuntu2204,destination=/build,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
docker.io/library/ubuntu:22.04 /bin/bash -x /repos/monitoring-plugins/build/ubuntu2204/build.sh ${{ inputs.package-version || github.ref_name }} ${{ inputs.package-iteration || '1' }}
build-ubuntu2404:
runs-on:
- 'rhel8'
- 'self-hosted'
needs:
- 'prepare'
steps:
- name: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2404'
run: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2404'
- name: 'Build for Ubuntu 24.04'
run: |-
podman run --interactive --rm \
--mount type=bind,source=${{ env.BASE_DIR }}/build/ubuntu2404,destination=/build,relabel=private \
--mount type=bind,source=${{ env.BASE_DIR }}/repos,destination=/repos,relabel=shared,ro=true \
docker.io/library/ubuntu:24.04 /bin/bash -x /repos/monitoring-plugins/build/ubuntu2404/build.sh ${{ inputs.package-version || github.ref_name }} ${{ inputs.package-iteration || '1' }}
# 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
- 'build-debian10'
- 'build-debian11'
- 'build-debian12'
- 'build-rhel7'
- 'build-rhel8'
- 'build-rhel9'
- 'build-ubuntu1804'
- 'build-ubuntu2004'
- 'build-ubuntu2204'
- 'build-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-linux-packages'
uses: 'actions/upload-artifact@v4'
with:
name: 'monitoring-plugins-linux-packages'
path: '${{ env.BASE_DIR }}/build/'
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 }}'