Skip to content

Commit

Permalink
github actions: add ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
NavidSassan committed Dec 6, 2023
1 parent 9f70db6 commit cf9c542
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,67 @@ jobs:
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' }}
# 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:
Expand All @@ -191,6 +252,9 @@ jobs:
- 'build-rhel7'
- 'build-rhel8'
- 'build-rhel9'
- 'build-ubuntu1804'
- 'build-ubuntu2004'
- 'build-ubuntu2204'
if: '${{ always() }}' # however, we want to upload the artifacts even if one of the job fails

steps:
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/linux-test-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,70 @@ jobs:
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
# 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:
Expand All @@ -182,6 +246,9 @@ jobs:
- 'test-rhel7'
- 'test-rhel8'
- 'test-rhel9'
- 'test-ubuntu1804'
- 'test-ubuntu2004'
- 'test-ubuntu2204'
if: '${{ always() }}' # however, we want to upload the artifacts even if one of the job fails

steps:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions testing/ubuntu/run-all
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash


apt install -y /packages/linuxfabrik-monitoring-plugins*.deb

mkdir -p output
for dir in /repos/monitoring-plugins/check-plugins/*; do
check="$(basename "$dir")"
if [ "$check" != "example" ]; then
"/usr/lib64/nagios/plugins/$check" 1> "/tmp/$check.stdout" 2> "/tmp/$check.stderr"
echo $? > "/tmp/$check.retc"

# make a nice summary file
cat > "output/$check" << EOF
--------------------------------------------------------------------------------
# $check. Retc: $(cat "/tmp/$check.retc")
--------------------------------------------------------------------------------
## STDOUT
$(cat "/tmp/$check.stdout")
----------------------------------------
## STDERR
$(cat "/tmp/$check.stderr")
----------------------------------------
EOF

fi
done

0 comments on commit cf9c542

Please sign in to comment.