Linuxfabrik: Build Linux (x86_64) #51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Linuxfabrik: Build Linux (x86_64)' | |
on: | |
workflow_dispatch: | |
inputs: | |
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' | |
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' | |
# 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: 'Debug Inputs' | |
run: > | |
echo | |
check-plugins=${{ inputs.check-plugins }} | |
lib-repo-ref=${{ inputs.lib-repo-ref }} | |
package-iteration=${{ inputs.package-iteration }} | |
distros=${{ inputs.distros }} | |
- 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 lfmp-build-${{ matrix.distro }}' | |
run: > | |
podman build | |
--file "repos/monitoring-plugins/build/containerfiles/${{ matrix.distro }}" | |
--tag "lfmp-build-${{ matrix.distro }}" | |
- name: 'mkdir -p $RUNNER_TEMP/${{ matrix.distro }}/compiled' | |
run: 'mkdir -p $RUNNER_TEMP/${{ matrix.distro }}/compiled' | |
- 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: 'Run the container lfmp-build-${{ matrix.distro }}' | |
run: > | |
podman run | |
--rm | |
--mount type=bind,source=$RUNNER_TEMP/${{ matrix.distro }}/compiled,destination=/compiled,relabel=private | |
--mount type=bind,source=repos,destination=/repos,relabel=shared,ro=true | |
"lfmp-build-${{ matrix.distro }}" | |
/bin/bash | |
"./repos/monitoring-plugins/build/shared/compile-multiple.sh | |
/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' }}" |