From cd6cf36cc55e56f9d34b638e50a3cb426a89c5d8 Mon Sep 17 00:00:00 2001 From: "JM (Jason Meridth)" Date: Sun, 29 Dec 2024 13:58:54 -0600 Subject: [PATCH] chore: add docs about generating a plugin from template (#55) still a work in progress but a good start Signed-off-by: jmeridth --- docs/how-to-generate-example-plugin.md | 55 ++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 docs/how-to-generate-example-plugin.md diff --git a/docs/how-to-generate-example-plugin.md b/docs/how-to-generate-example-plugin.md new file mode 100644 index 0000000..265febb --- /dev/null +++ b/docs/how-to-generate-example-plugin.md @@ -0,0 +1,55 @@ +# How to Generate Example Plugin + +## What is this? + +This guide allows you to not have to start from scratch on a new plugin. + +> [!NOTE] +> Currently the generator only supports common cloud controls yaml files. This file is needed to be used to setup the plugin's test suite and test sets. All that is needed to be done after that is writing the actual tests. + +- get [`CCC.VPC_2025.01.yaml`](https://github.com/finos/common-cloud-controls/releases/download/v2025.01.VPC-rc/CCC.VPC_2025.01.yaml) file from [Common Cloud Controls Repository Releases page](https://github.com/finos/common-cloud-controls/releases) + +> [!NOTE] +> Version may change or you may need to expand the `Assets` section to find the latest yaml file. + +- in the root of this repository run the following command: + + ```bash + privateer generate-plugin -p ~/path/to/CCC.VPC_2025.01.yaml -n example + ``` + +- this will generate an example plugin in the `generated-plugin` folder at the root of the repository +- Go into the newly generated directory: + + ```bash + cd generated_plugin + ``` + +- run the following command to build the plugin: + + ```bash + cp config-example.yml config.yml + make binary + ``` + +- to run the plugin by itself in debug mode: + + ```bash + ./example debug --service my-cloud-service1 + ``` + +> [!TIP] +> If you use a different service name, make sure the service name matches what is in the config.yml in the root of the repository. + +> [!IMPORTANT] +> `test_output/[service_name]` folder should include a log file and a yaml file for each test suite +> +> example: `test_output/my-cloud-service1/my-cloud-service1.log` and `test_output/my-cloud-service1/tlp_red.yml` + +- to run the plugin from privateer, do the following: + + ```bash + cp example $HOME/.privateer/bin + cd .. + privateer run + ```