Allows you to publish custom events for flight controller to produce metrics.
- Python version 3.10
- Pipenv (version 2022.10.12 proven working)
- Ensure you have working AWS account creds/tokens.
make local - Install python prerequisites and enter the pip environment.
python -m publisher.entrypoints.main
| Option (Short) | Options (Long) | Description |
|---|---|---|
| -h | --help | Shows command help and all available options |
| -so | --source | {open_policy_agent,checkov} - The source in which you want to get events from. |
| -f | --file | The json file in which to parse result into events. |
| -si | --sink | {event_bridge} - The sink in which you want to send events to. |
You can test with the examples in tests/examples by running the the publisher tool against these output files.
checkov -d ${INFRA_FOLDER} -o json > checkov.jsonpython -m publisher.entrypoints.main -so checkov -f checkov.json -si event_bridge
python -m publisher.entrypoints.main -so open_policy_agent -f opa.json -si event_bridge
- Run your desired tool and output this to a .json file
- Run Flight Controller handler.py on this file to parse results and generate events.
This can be done with in your CICD
make localsetup local environment and install dependencies.make install-dependenciesinstall dependencies defined in the pipfile.make unittestruns all the unit tests (i.e. tests that are not marked as integration).make integration-testrun all the integration tests.make testruns all the tests and reports on coverage.make watchruns all the unit tests on file change. Allowing the test code while making live changes.make e2eruns the end to end BDD tests using behave.
The code is structured in the Clean Architecture pattern.
The current layers are:
Entities, which contains domain objects (Events)Drivers, which interact with data storage (File Source, Git, Event Bridge)Entrypoints, which handle the command line arguments and passing data between layers.
The core rule of Clean Architecture, is that a layer can only depend on the layers that have come before it. E.g. code in the usecases layer, may depend on entities, but cannot depend on adapters or drivers.
When developing, it is simplest to start at the first layer and work down ending up with the entrypoint. This forces you to focus on the domain objects first before considering external services.
Adding support for a new source:
publisher/drivers/
Adding support for a new event type:
publisher/entities/
Adding support for a new sink:
publisher/drivers/