diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c7f04c6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.DS_Store +/.git/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/example/CMakeLists.txt b/CMakeLists.txt similarity index 100% rename from example/CMakeLists.txt rename to CMakeLists.txt diff --git a/Dockerfile b/Dockerfile index 9c40725..76ac484 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG TENZIR_VERSION=main FROM ghcr.io/tenzir/tenzir-dev:${TENZIR_VERSION} AS example-builder-untested -COPY example /plugins/example +COPY . /plugins/example/ RUN cmake -S /plugins/example -B build-example -G Ninja -D CMAKE_INSTALL_PREFIX:STRING="$PREFIX" RUN cmake --build build-example --parallel diff --git a/README.md b/README.md index f4d2919..11da86b 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,42 @@ # Tenzir Example Plugin -This is an example plugin for Tenzir. Simply run `docker compose up` to build -and start a Tenzir node with your additional plugin. Use `docker compose run -tenzir ''` to interact with the node, or set the following -environment variables and to connect your node to app.tenzir.com: +This is an example plugin for Tenzir. + +## Build and run + +Simply run `docker compose up` to build and start a Tenzir node with your +additional plugin. + +Use `docker compose run tenzir ''` to interact with the node. Set the +following environment variables and to connect your node to app.tenzir.com: ``` export TENZIR_PLUGINS__PLATFORM__API_KEY='' export TENZIR_PLUGINS__PLATFORM__TENANT_ID='' ``` -## Write Tests +## Learn how to write a plugin + +We think that learning how to build a plugin is best done by example. Tenzir +ships with a variety of [plugins][plugins-source] and +[builtins][builtins-source] to get inspired by and to learn from. + +If you have any questions, feel free to reach out in the [#developers channel +on Discord][discord]. + +## Run tests Every plugin defines additional tests using [BATS](https://bats-core.readthedocs.io/en/stable/writing-tests.html). Use `docker compose run tests` to execute your tests and update the reference files automatically. + +## Contribute your plugin + +If you want to upstream your plugin so that it is bundled with every Tenzir +installation, open a PR that adds it to the [`plugins/` directory in the +`tenzir/tenzir` repository][plugins-source]. + +[plugins-source]: https://github.com/tenzir/tenzir/tree/main/plugins +[builtins-source]: https://github.com/tenzir/tenzir/tree/main/libtenzir/builtins +[discord]: https://docs.tenzir.com/discord diff --git a/example/integration/data/reference/tests/test_check_plugin_availability/step_00.ref b/integration/data/reference/tests/test_check_plugin_availability/step_00.ref similarity index 100% rename from example/integration/data/reference/tests/test_check_plugin_availability/step_00.ref rename to integration/data/reference/tests/test_check_plugin_availability/step_00.ref diff --git a/example/integration/tests/setup_suite.bash b/integration/tests/setup_suite.bash similarity index 100% rename from example/integration/tests/setup_suite.bash rename to integration/tests/setup_suite.bash diff --git a/example/integration/tests/tests.bats b/integration/tests/tests.bats similarity index 100% rename from example/integration/tests/tests.bats rename to integration/tests/tests.bats diff --git a/example/src/plugin.cpp b/src/plugin.cpp similarity index 100% rename from example/src/plugin.cpp rename to src/plugin.cpp