Skip to content

Linuxfabrik: Build Linux (x86_64) #44

Linuxfabrik: Build Linux (x86_64)

Linuxfabrik: Build Linux (x86_64) #44

name: 'Linuxfabrik: Build Linux (x86_64)'
on:
workflow_dispatch:
inputs:
lib-repo-ref:
description: 'The branch, tag, or SHA to checkout from the lib repo. Defaults to the current branch or tag.'
required: false
default: ''
package-iteration:
description: 'The iteration to give to the package.'
required: false
default: '1'
check-plugins:
description: 'Comma-separated list of check plugins to compile and package. Leave empty to build all plugins.'
required: false
default: 'cpu-usage,scanrootkit'
distros:
description: 'Comma-separated list of operating systems to build on. Supported: `debian11,debian12,rocky8,rocky9,ubuntu2004,ubuntu2204,ubuntu2404`.'
required: false
default: 'rocky9'
# modify the default permissions granted to the GITHUB_TOKEN
permissions:
contents: 'read'
jobs:
set-matrix:
runs-on:
- 'ubuntu-24.04' # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
outputs:
matrix: '${{ steps.generate-matrix.outputs.matrix }}'
steps:
- name: 'Generate Matrix'
id: 'generate-matrix'
run: |
distros="${{ inputs.distros }}"
matrix=$(echo "$distros" | jq --compact-output --raw-input '{"distros": split(",")}')
echo "matrix=$matrix" >> $GITHUB_OUTPUT
build-packages:
runs-on:
- 'ubuntu-24.04'
needs:
- 'set-matrix'
strategy:
matrix:
distro: '${{ fromJson(needs.set-matrix.outputs.matrix).distros }}'
steps:
- name: 'git checkout https://github.com/Linuxfabrik/monitoring-plugins'
uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' # v4.2.2
with:
path: 'repos/monitoring-plugins'
- name: 'git checkout https://github.com/Linuxfabrik/lib'
uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' # v4.2.2
with:
repository: 'Linuxfabrik/lib'
ref: '${{ inputs.lib-repo-ref || github.ref_name }}'
path: 'repos/lib'
- name: 'Debug Github Environment'
run: >
/bin/bash
./repos/monitoring-plugins/build/shared/debug.sh
- name: '⚙️ apt-get -y install podman'
run: |
sudo apt-get update
sudo apt-get -y install podman
- name: 'Build the container for ${{ matrix.distro }}'
run: >
podman build
--file "repos/monitoring-plugins/build/containerfiles/${{ matrix.distro }}"
--tag "lfmp-build-${{ matrix.distro }}"
- name: 'Run the container for ${{ matrix.distro }}'
run: >
podman run
--detach
--mount type=bind,source=build/containerfiles/${{ matrix.distro }},destination=/build,relabel=private
--mount type=bind,source=repos,destination=/repos,relabel=shared,ro=true
"lfmp-build-${{ matrix.distro }}"
- name: 'Find and Download Latest Version Artifact'
run: >
/bin/bash
./repos/monitoring-plugins/build/shared/get-latest-version.sh
$GITHUB_REPOSITORY
${{ secrets.GITHUB_TOKEN }}
- name: 'Compile the check plugins'
run: >
podman exec
"lfmp-build-${{ matrix.distro }}"
/bin/bash
./repos/monitoring-plugins/build/shared/compile-multiple.sh
$RUNNER_TEMP/compiled
./repos/lib
./repos/monitoring-plugins/check-plugins
${{ inputs.check-plugins }}
# - name: 'Upload build output'
# uses: 'actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08' # v4.6.0
# with:
# path: 'build/'
# name: "lfmp-${{ env.VERSION }}-${{ inputs.package-iteration }}.${{ matrix.distro }}.${{ runner.arch == 'X64' && 'x86_64' || 'aarch64' }}"