Skip to content

Commit 3675886

Browse files
committed
finally maybe....
1 parent c3a2936 commit 3675886

5 files changed

Lines changed: 65 additions & 4 deletions

File tree

.github/workflows/build-release-latest.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,23 @@ jobs:
2626
- run: docker pull ${{ steps.get_image.outputs.IMAGE }} || docker build -t ${{ steps.get_image.outputs.IMAGE }} -f dockerfiles/checkmk/Dockerfile .
2727
- run: docker push ${{ steps.get_image.outputs.IMAGE }}
2828

29+
build-package-ci:
30+
runs-on: ubuntu-latest
31+
needs: build-image
32+
container:
33+
image: ${{ needs.build-image.outputs.image }}
34+
env:
35+
CMK: /omd/sites/cmk
36+
SU: su - cmk -c
37+
steps:
38+
- uses: actions/checkout@v4
39+
- run: build-mkp.sh
40+
# upload results
41+
- uses: actions/upload-artifact@v4
42+
with:
43+
path: ./mkp/*.mkp
44+
retention-days: 1
45+
2946
build-package:
3047
runs-on: ubuntu-latest
3148
needs: build-image
@@ -59,8 +76,7 @@ jobs:
5976
retention-days: 1
6077

6178
github-release:
62-
#runs-on: ubuntu-latest
63-
runs-on: self-hosted
79+
runs-on: ubuntu-latest
6480
needs: build-package
6581
steps:
6682
- uses: actions/download-artifact@v4

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,11 @@ container a **client** container is running, which can be used for testing.
2020
### 📃 Logging of bakery jobs
2121

2222
When debugging inside the container **checkmk**: `tail -f /omd/sites/cmk/var/log/ui-job-scheduler/*`
23+
24+
### 🏗️ Building
25+
26+
To build the package manually, run:
27+
28+
```bash
29+
docker run -it --rm --volume $PWD:/source --workdir /source checkmk-yum build-mkp.sh
30+
```

dockerfiles/checkmk/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ RUN apt -y update && \
1717
# scripts used need to be executable
1818
COPY dockerfiles/checkmk/modify-extension.py /usr/local/bin
1919
RUN chmod +x /usr/local/bin/modify-extension.py
20+
COPY dockerfiles/checkmk/build-mkp.sh /usr/local/bin
21+
RUN chmod +x /usr/local/bin/build-mkp.sh
2022

2123
# Create site 'cmk'
2224
RUN omd create --admin-password "${CMK_PASSWORD}" "${CMK_SITE_ID}"

dockerfiles/checkmk/build-mkp.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
CMK="/omd/sites/cmk"
5+
SU="su - cmk -c"
6+
WORKDIR="${PWD:-$(pwd)}"
7+
8+
# Copy local extension sources into the Check_MK local directory
9+
cp -r mkp/local/* "${CMK}/local"
10+
11+
# Create temporary directory as the cmk user
12+
$SU "mkdir -p ${CMK}/tmp/check_mk"
13+
14+
# Create mkp template (runs as cmk user)
15+
$SU "mkp template yum"
16+
17+
# Mark repo safe for git (needed when running as different user)
18+
git config --global --add safe.directory "${WORKDIR}"
19+
20+
# Run the extension modifier script to produce a manifest template
21+
modify-extension.py "${WORKDIR}" "${CMK}/tmp/check_mk/yum.manifest.temp"
22+
23+
# Fix permissions to avoid Permission denied during mkp package
24+
chmod go+rw "${CMK}/local/lib/python3/cmk/base/cee/plugins/bakery"
25+
chmod go+rw "${CMK}/local/lib/python3/cmk_addons/plugins/yum/agent_based"
26+
chmod go+rw "${CMK}/local/lib/python3/cmk_addons/plugins/yum/checkman"
27+
chmod go+rw "${CMK}/local/lib/python3/cmk_addons/plugins/yum/rulesets"
28+
29+
# Show generated manifest and build the mkp package (runs as cmk user)
30+
cat "${CMK}/tmp/check_mk/yum.manifest.temp"
31+
$SU "mkp package ${CMK}/tmp/check_mk/yum.manifest.temp"
32+
33+
# Copy created mkp back to the workspace
34+
mkdir -p "${WORKDIR}/mkp"
35+
cp "${CMK}/var/check_mk/packages_local/"*.mkp "${WORKDIR}/mkp/"

mkp/local/lib/python3/cmk/base/cee/plugins/bakery/yum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def get_yum_files(conf: Any) -> FileGenerator:
1111
"""
1212
Simple bakery plugin generator for yum
1313
14-
conf looks like: {'deployment': ('deploy', {'interval': 18060.0})}
15-
mind the tuple!
14+
conf looks like: ('deploy', {'interval': 18060.0})
15+
1616
"""
1717

1818
# debugging

0 commit comments

Comments
 (0)