You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In addition to the constructor 3 more handlers need to be implemented.
66
+
In addition to the constructor, 3 more handlers need to be implemented.
67
67
68
68

69
69
70
-
### Registration Stage
70
+
### Registration Handler
71
71
72
72
Registration is when a specific instance of the extension is configured on a Chainloop organization. A registered instance is then available to be attached to any workflow, more on that later.
73
73
@@ -78,22 +78,22 @@ Examples:
78
78
- Register a Dependency-Track instance by receiving its URL and API key. At this stage, the extension will make sure that the provided information is valid and store it for later use.
79
79
- Register a Discord instance by receiving its webhook URL. The handler will store the webhook URL securely for later use.
80
80
81
-
### Attachment Stage
81
+
### Attachment Handler
82
82
83
83
In order for an user to use a registered instance, it needs to be attached to a workflow. This stage can be also used to optionally customize the behavior of the extension for a specific workflow.
84
84
85
85
This handler **will receive not only the input from the user but also the output from the registration state**. Similarly to the registration handler, the handler returned output value will be stored in the state for later use.
86
86
87
87
Examples:
88
88
89
-
- Tell the already registered Dependency Track instance to send the SBOMs **to a specific project**.
90
-
- Tell the already registered Discord instance to send all attestations to the configured channel
89
+
- Tell the already registered Dependency Track extension to send the SBOMs **to a specific project**.
90
+
- Tell the already registered Discord extension to send all attestations to the configured channel.
91
91
92
-
### Execution Stage
92
+
### Execution Handler
93
93
94
-
This is the actual execution of the extension. This is where the extension will do its work. i.e call a workflow or send a notification.
94
+
This is the actual execution of the extension. This is where the extension will do its work. i.e forward the attestation/material data to a third-party API, send a notification and so on.
95
95
96
-
This handler **will also have access to the outputs from the registration and attachment phases**.
96
+
In addition to the attestation and material data, this handler **will also have access to the outputs from the registration and attachment phases**.
97
97
98
98
Examples:
99
99
@@ -110,4 +110,13 @@ A Discord webhook extension will
110
110
111
111
## How to create a new extension
112
112
113
-
We offer a [starter template](./core/template). Just copy it to a new folder and follow the steps shown in its readme file.
113
+
We offer a [starter template](./core/template) that can be used as baseline. Just copy it to a new folder i.e `core/my-extension/v1` to get started.
114
+
115
+
Next:
116
+
117
+
- Replace all the occurrences of `template` in the code with your extension name.
118
+
- Add it to the list of available extensions [here](`./extensions.go`). This will make this extension available the next time the control plane starts.
119
+
- Define the API request payloads for both Registration and Attachment.
120
+
- Implement the [FanOutExtension interface](https://github.com/chainloop-dev/chainloop/blob/main/app/controlplane/extensions/sdk/v2/fanout.go#L55). The template comes prefilled with some commented out code as guideline.
121
+
122
+
Remember that you can find some examples of fully functional extensions in [here](./core/).
0 commit comments