Skip to content

Commit e4c5adc

Browse files
Clean up codebase (#2)
This makes a pass over the entire repository to clean it up a bit so that we can comfortably publish it.
1 parent f240833 commit e4c5adc

File tree

12 files changed

+46
-19
lines changed

12 files changed

+46
-19
lines changed

.dockerignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
/.git/
3+
/Dockerfile
4+
/LICENSE
5+
/README.md
6+
/docker-compose.yaml
7+
/integration/data/reference/

.github/workflows/tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ jobs:
3333
docker compose build --build-arg TENZIR_VERSION=${{ matrix.version }}
3434
- name: Test
3535
run: |
36-
docker compose run tests
36+
docker compose run --build tests
3737
git diff --exit-code

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store
File renamed without changes.

Dockerfile

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
ARG TENZIR_VERSION=main
2-
FROM ghcr.io/tenzir/tenzir-dev:${TENZIR_VERSION} AS example-builder-untested
2+
FROM ghcr.io/tenzir/tenzir-dev:${TENZIR_VERSION} AS example-builder
33

4-
COPY example /plugins/example
4+
COPY . /plugins/example/
55

66
RUN cmake -S /plugins/example -B build-example -G Ninja -D CMAKE_INSTALL_PREFIX:STRING="$PREFIX"
77
RUN cmake --build build-example --parallel
88
RUN cmake --install build-example --strip --component Runtime --prefix /plugin/example
99

10-
FROM example-builder-untested AS example-test
10+
FROM example-builder AS example-test
1111

1212
ENV BATS_LIB_PATH=/tmp/tenzir/tenzir/integration/lib
1313
# TODO: Use the update-integration target instead
1414
ENV UPDATE=1
1515

1616
ENTRYPOINT cmake --build build-example --target integration
1717

18-
FROM example-builder-untested AS example-builder
19-
20-
ENV BATS_LIB_PATH=/tmp/tenzir/tenzir/integration/lib
21-
RUN cmake --build build-example --target integration
22-
2318
FROM ghcr.io/tenzir/tenzir:${TENZIR_VERSION}
2419

2520
COPY --from=example-builder --chown=tenzir:tenzir /plugin/example /opt/tenzir

README.md

+31-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
11
# Tenzir Example Plugin
22

3-
This is an example plugin for Tenzir. Simply run `docker compose up` to build
4-
and start a Tenzir node with your additional plugin. Use `docker compose run
5-
tenzir '<pipeline>'` to interact with the node, or set the following
6-
environment variables and to connect your node to app.tenzir.com:
3+
This is an example plugin for Tenzir.
4+
5+
## Build and run
6+
7+
Simply run `docker compose up` to build and start a Tenzir node with your
8+
additional plugin.
9+
10+
Use `docker compose run tenzir '<pipeline>'` to interact with the node. Set the
11+
following environment variables and to connect your node to app.tenzir.com:
712

813
```
914
export TENZIR_PLUGINS__PLATFORM__API_KEY='<api-key>'
1015
export TENZIR_PLUGINS__PLATFORM__TENANT_ID='<tenant-id>'
1116
```
1217

13-
## Write Tests
18+
## Learn how to write a plugin
19+
20+
We think that learning how to build a plugin is best done by example. Tenzir
21+
ships with a variety of [plugins][plugins-source] and
22+
[builtins][builtins-source] to get inspired by and to learn from.
23+
24+
If you have any questions, feel free to reach out in the [#developers channel
25+
on Discord][discord].
26+
27+
## Run tests
1428

1529
Every plugin defines additional tests using
1630
[BATS](https://bats-core.readthedocs.io/en/stable/writing-tests.html). Use
17-
`docker compose run tests` to execute your tests and update the reference files
18-
automatically.
31+
`docker compose run --build tests` to execute your tests and update the
32+
reference files automatically.
33+
34+
## Contribute your plugin
35+
36+
If you want to upstream your plugin so that it is bundled with every Tenzir
37+
installation, open a PR that adds it to the [`plugins/` directory in the
38+
`tenzir/tenzir` repository][plugins-source].
39+
40+
[plugins-source]: https://github.com/tenzir/tenzir/tree/main/plugins
41+
[builtins-source]: https://github.com/tenzir/tenzir/tree/main/libtenzir/builtins
42+
[discord]: https://docs.tenzir.com/discord

docker-compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ services:
4747
profiles:
4848
- donotstart
4949
volumes:
50-
- ./example/integration/data/reference/:/plugins/example/integration/data/reference/
50+
- ./integration/data/reference/:/plugins/example/integration/data/reference/
5151

5252
volumes:
5353
tenzir-node:

example/integration/data/reference/tests/test_check_plugin_availability/step_00.ref

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name": "example", "types": ["operator"], "dependencies": []}
File renamed without changes.

example/integration/tests/tests.bats integration/tests/tests.bats

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ teardown() {
1515
}
1616

1717
@test "Check plugin availability" {
18-
check tenzir 'show plugins | where name == "example"'
18+
check tenzir 'show plugins | where name == "example" | drop version, kind'
1919
}
File renamed without changes.

0 commit comments

Comments
 (0)