My Devepolment and CI/CD Environment


I asked for experience and tricks with developing and testing extensions on here a while back. I did not get to much feedback, so I wanted to share the setup and workflow i came up with. With the upcoming release of Checkmk 2 I was busy packaging and updating quiet a lot of extensions.

To develop in VSCode with the Remote-Containers extension. This allows me to use the check-mk-raw Docker image as my development environment. So I get a powerful IDE but at the same time the code gets the environment it expects (a Checkmk site).

The new Plugins, which are loadable Python modules, make it then quiet easy to unit test them. Just load them and test the parse, discover and check function. This helps to test each part of the check separately and to ensure each part works as expected. This was especially helpful for me to ensure different check and inventory parameters work as expected. The wato plugins for the parameters can be tested too. However it is needed to trick a bit with the Python Path to load them. This allowed me to verify that the plugin accepts and transforms the configuration as expected.

As all the actual work is going on inside in a Container it is quiet easy to reuse this for the CI/CD part. I setup GitHub Workflows to test, package and release the Extension in the same way by using the same Docker Image. This way Github tells me when i break one of the tests and if I am read to release a new Version all I need to do is tag the commit. Github will then build the extension and link it on the releases page.

As I had a multiple extensions to package I made a template repo to simplify the setup of new extensions with all this.

I home this can help or inspire some of you developing and packaging Checkmk extensions.

Regards Marius