Skip to content

Commit b1e6e12

Browse files
authored
Merge pull request #1 from jiuka/cmk23
Checkmk 2.3.0 Support
2 parents 0053dc8 + a3ddc7f commit b1e6e12

File tree

24 files changed

+523
-438
lines changed

24 files changed

+523
-438
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.155.1/containers/ubuntu/.devcontainer/base.Dockerfile
22

3-
# [Choice] CheckMK version: 2.2.0-latest
4-
ARG VARIANT="2.2.0-latest"
3+
# [Choice] CheckMK version: 2.3.0-latest
4+
ARG VARIANT="2.3.0-latest"
55
FROM checkmk/check-mk-raw:${VARIANT}
66

77
RUN /docker-entrypoint.sh /bin/true

.devcontainer/build.sh

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,9 @@
22

33
NAME=$(python3 -c 'print(eval(open("package").read())["name"])')
44
VERSION=$(python3 -c 'print(eval(open("package").read())["version"])')
5-
rm -f $NAME-$VERSION.mkp \
6-
/omd/sites/cmk/var/cat check_mk/packages/${NAME}-*.mkp \
5+
rm /omd/sites/cmk/var/check_mk/packages/${NAME} \
76
/omd/sites/cmk/var/check_mk/packages_local/${NAME}-*.mkp ||:
87

98
mkp -v package package 2>&1 | sed '/Installing$/Q' ||:
109

11-
cp /omd/sites/cmk/var/check_mk/packages_local/$NAME-$VERSION.mkp .
12-
13-
mkp inspect $NAME-$VERSION.mkp
14-
15-
# Set Outputs for GitHub Workflow steps
16-
if [ -n "$GITHUB_WORKSPACE" ]; then
17-
echo "pkgfile=${NAME}-${VERSION}.mkp" >> $GITHUB_OUTPUT
18-
echo "pkgname=${NAME}" >> $GITHUB_OUTPUT
19-
echo "pkgversion=$VERSION" >> $GITHUB_OUTPUT
20-
fi
10+
mkp inspect /omd/sites/cmk/var/check_mk/packages_local/$NAME-$VERSION.mkp

.devcontainer/devcontainer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"build": {
66
"dockerfile": "Dockerfile",
77
// Update 'VARIANT' to pick an Ubuntu version: focal, bionic
8-
"args": { "VARIANT": "2.2.0-latest" }
8+
"args": { "VARIANT": "2.3.0-latest" }
99
},
1010

1111
"customizations": {
@@ -29,7 +29,9 @@
2929
// "forwardPorts": [],
3030

3131
// Use 'postCreateCommand' to run commands after the container is created.
32-
"postCreateCommand": ".devcontainer/symlink.sh",
32+
//"postCreateCommand": ".devcontainer/symlink.sh",
33+
"workspaceMount": "source=${localWorkspaceFolder},target=/omd/sites/cmk/local/lib/python3/cmk_addons/plugins/jb_fls,type=bind,consistency=cached",
34+
"workspaceFolder": "/omd/sites/cmk/local/lib/python3/cmk_addons/plugins/jb_fls",
3335

3436
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
3537
"remoteUser": "cmk",

.devcontainer/symlink.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
buy_me_a_coffee: jiuka

.github/workflows/build-release.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,33 @@ jobs:
1111
name: Build Release Package
1212
runs-on: ubuntu-latest
1313
container:
14-
image: checkmk/check-mk-raw:2.2.0-latest
14+
image: checkmk/check-mk-raw:2.3.0-latest
1515
permissions:
1616
contents: write
1717

18-
env:
19-
OMD_ROOT: /omd/sites/cmk
20-
OMD_SITE: cmk
21-
CMK_SITE_ID: cmk
22-
WORKSPACE: ${{ github.workspace }}
23-
2418
steps:
2519
- name: Initialize Checkmk Site
2620
run: /docker-entrypoint.sh /bin/true
27-
- uses: actions/checkout@v3
28-
- name: Setup links
29-
run: .devcontainer/symlink.sh
30-
- name: Update GITHUB_PATH
31-
run: echo "/omd/sites/cmk/bin" >> $GITHUB_PATH
21+
- uses: actions/checkout@v4
22+
- name: Parse Package File
23+
run: |
24+
NAME=$(python3 -c 'print(eval(open("package").read())["name"])')
25+
VERSION=$(python3 -c 'print(eval(open("package").read())["version"])')
26+
echo "CMKPKG_NAME=$NAME" >> "$GITHUB_ENV"
27+
echo "CMKPKG_VERSION=$VERSION" >> "$GITHUB_ENV"
28+
- name: Install Plugin
29+
run: |
30+
rsync -aC --chown=cmk:cmk $GITHUB_WORKSPACE/ /omd/sites/cmk/local/lib/python3/cmk_addons/plugins/$CMKPKG_NAME/
3231
- name: Build Extension
33-
run: .devcontainer/build.sh
32+
run: |
33+
su -l -c "mkp -v package $GITHUB_WORKSPACE/package" cmk
34+
cp /omd/sites/cmk/var/check_mk/packages_local/${CMKPKG_NAME}-${CMKPKG_VERSION}.mkp .
35+
echo "pkgfile=${CMKPKG_NAME}-${CMKPKG_VERSION}.mkp" >> $GITHUB_OUTPUT
36+
echo "pkgname=${CMKPKG_NAME}" >> $GITHUB_OUTPUT
37+
echo "pkgversion=${CMKPKG_VERSION}" >> $GITHUB_OUTPUT
3438
id: cmkpkg
35-
3639
- name: Create Release
37-
uses: softprops/action-gh-release@v1
40+
uses: softprops/action-gh-release@v2
3841
with:
3942
release_name: Release ${{ github.ref }}
4043
draft: false

.github/workflows/build.yml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,31 @@ jobs:
1313
name: Build Checkmk package
1414
runs-on: ubuntu-latest
1515
container:
16-
image: checkmk/check-mk-raw:2.2.0-latest
17-
18-
env:
19-
OMD_ROOT: /omd/sites/cmk
20-
OMD_SITE: cmk
21-
CMK_SITE_ID: cmk
22-
WORKSPACE: ${{ github.workspace }}
16+
image: checkmk/check-mk-raw:2.3.0-latest
2317

2418
steps:
2519
- name: Initialize Checkmk Site
2620
run: /docker-entrypoint.sh /bin/true
27-
- uses: actions/checkout@v3
28-
- name: Setup links
29-
run: .devcontainer/symlink.sh
30-
- name: Update GITHUB_PATH
31-
run: echo "/omd/sites/cmk/bin" >> $GITHUB_PATH
21+
- uses: actions/checkout@v4
22+
- name: Parse Package File
23+
run: |
24+
NAME=$(python3 -c 'print(eval(open("package").read())["name"])')
25+
VERSION=$(python3 -c 'print(eval(open("package").read())["version"])')
26+
echo "CMKPKG_NAME=$NAME" >> "$GITHUB_ENV"
27+
echo "CMKPKG_VERSION=$VERSION" >> "$GITHUB_ENV"
28+
- name: Install Plugin
29+
run: |
30+
rsync -aC --chown=cmk:cmk $GITHUB_WORKSPACE/ /omd/sites/cmk/local/lib/python3/cmk_addons/plugins/$CMKPKG_NAME/
3231
- name: Build Extension
33-
run: .devcontainer/build.sh
32+
run: |
33+
su -l -c "mkp -v package $GITHUB_WORKSPACE/package" cmk
34+
cp /omd/sites/cmk/var/check_mk/packages_local/${CMKPKG_NAME}-${CMKPKG_VERSION}.mkp .
35+
echo "pkgfile=${CMKPKG_NAME}-${CMKPKG_VERSION}.mkp" >> $GITHUB_OUTPUT
36+
echo "pkgname=${CMKPKG_NAME}" >> $GITHUB_OUTPUT
37+
echo "pkgversion=${CMKPKG_VERSION}" >> $GITHUB_OUTPUT
3438
id: cmkpkg
3539
- name: Upload artifact
36-
uses: actions/upload-artifact@v3
40+
uses: actions/upload-artifact@v4
3741
with:
3842
name: ${{ steps.cmkpkg.outputs.pkgfile }}
3943
path: ${{ steps.cmkpkg.outputs.pkgfile }}

.github/workflows/lint.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ on:
44
push:
55
paths:
66
- '**.py'
7+
- .github/workflows/lint.yml
8+
79

810
jobs:
911
flake8_py3:
1012

1113
runs-on: ubuntu-latest
1214

1315
steps:
14-
- uses: actions/checkout@v3
15-
- name: Set up Python 3.9
16-
uses: actions/setup-python@v4
16+
- uses: actions/checkout@v4
17+
- name: Set up Python 3.12
18+
uses: actions/setup-python@v5
1719
with:
18-
python-version: 3.9
20+
python-version: '3.12'
1921
- name: Install flake8
2022
run: pip install flake8
2123
- name: Run flake8

.github/workflows/pytest.yml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
name: pytest
22

33
on:
4-
push: []
4+
push:
5+
paths:
6+
- '**.py'
7+
- .github/workflows/pytest.yml
58

69
jobs:
710
pytest:
811

912
runs-on: ubuntu-latest
1013
container:
11-
image: checkmk/check-mk-raw:2.2.0-latest
12-
13-
env:
14-
OMD_ROOT: /omd/sites/cmk
15-
OMD_SITE: cmk
16-
CMK_SITE_ID: cmk
17-
WORKSPACE: ${{ github.workspace }}
14+
image: checkmk/check-mk-raw:2.3.0-latest
1815

1916
steps:
20-
- name: Initialize Checkmk Site
21-
run: /docker-entrypoint.sh /bin/true
22-
- uses: actions/checkout@v3
23-
- name: Setup links
24-
run: ./.devcontainer/symlink.sh
25-
- name: Install pytest
26-
run: su -l -c "REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt pip3 install -r $GITHUB_WORKSPACE/.devcontainer/requirements.txt" cmk
27-
- name: Update GITHUB_PATH
28-
run: echo "/omd/sites/cmk/bin" >> $GITHUB_PATH
29-
- name: Run pytest
30-
run: python3 -m pytest
17+
- name: Initialize Checkmk Site
18+
run: /docker-entrypoint.sh /bin/true
19+
- uses: actions/checkout@v4
20+
- name: Parse Package File
21+
run: |
22+
NAME=$(python3 -c 'print(eval(open("package").read())["name"])')
23+
VERSION=$(python3 -c 'print(eval(open("package").read())["version"])')
24+
echo "CMKPKG_NAME=$NAME" >> "$GITHUB_ENV"
25+
echo "CMKPKG_VERSION=$VERSION" >> "$GITHUB_ENV"
26+
- name: Install Plugin
27+
run: |
28+
rsync -aC --chown=cmk:cmk $GITHUB_WORKSPACE/ /omd/sites/cmk/local/lib/python3/cmk_addons/plugins/$CMKPKG_NAME/
29+
- name: Install pytest
30+
run: su -l -c "REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt pip3 install -r $GITHUB_WORKSPACE/.devcontainer/requirements.txt" cmk
31+
- name: Run pytest
32+
run: su -l -c "python3 -m pytest /omd/sites/cmk/local/lib/python3/cmk_addons/plugins/$CMKPKG_NAME/" cmk

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ For the best development experience use [VSCode](https://code.visualstudio.com/)
2424

2525
## Directories
2626

27-
The following directories in this repo are getting mapped into the Checkmk site.
28-
29-
* `agents`, `checkman`, `checks`, `doc`, `inventory`, `notifications`, `pnp-templates`, `web` are mapped into `local/share/check_mk/`
30-
* `agent_based` is mapped to `local/lib/check_mk/base/plugins/agent_based`
31-
* `nagios_plugins` is mapped to `local/lib/nagios/plugins`
27+
The repository is mounted into `/omd/sites/cmk/local/lib/python3/cmk_addons/plugins/jb_fls`
3228

3329
## Continuous integration
3430
### Local

0 commit comments

Comments
 (0)