-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC : CDEvents Webhook Adapter design review #42
Conversation
rfc/cdevents-translator.md
Outdated
### Overview: | ||
This proposal describes translating events from various source control systems into CDEvents and sending them to configured message-broker, by using a common cdevents-translator | ||
|
||
A library cdevents-translator will be developed to receive various event types and convert them into CDEvents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How this will work in terms of supporting multiple types?
Will the library provide an interface that various implementors can implement independently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes an interface EventTranslator
will be created with the implementation needed for TranslateEvent()
for different source of events(GitHub/Gerrit`/...etc)
type EventTranslator interface {
TranslateEvent()
}
And will have a common methods to create and send CDEvents, will update the design as per this.
rfc/cdevents-translator.md
Outdated
Instructions for configuring Gerrit webhooks and implementation details can be found in [gerrit-cdevent](gerrit-cdevents.md) | ||
|
||
### Design approach | ||
Create a Golang application with an API server configured to initialize SCM systems webhooks/endpoints to receive events and translate them into CDEvents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following just for info.
Tekton Triggers provides and API server that can reply to webhooks. It supports incoming CloudEvents
as well as generic webhooks and it provides a powerful templating mechanism to extract information from incoming payloads and produce a YAML out of them. I used it in this POC https://github.com/afrittoli/cdeventer.
The approach of CDEventer is a bit more complex, but it has the advantage of decoupling the processing of incoming messages, which is then implemented as a set of input specific TriggerBindings
, from the actual sending of the target CDEvents, through the use of an intermediate YAML.
The downside of CDEventer is the extra dependency to Tekton (and thus K8s).
e72bf27
to
cc9f1f0
Compare
Thank you @xibz for directing various approaches for the translator. @afrittoli @xibz please let us know your views on these design proposals and review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks much better @rjalander! One thing I noticed missing was a final "Conclusions" to summarize which was preferred by you, etc. Or did you want to leave that up for discussion?
rfc/cdevents-translator.md
Outdated
This structure can be extended by adding more translator libraries in the future without modifying the main application code.</br> | ||
The problem with this approach anyone who is wanting some custom set of translator would need to write their own main class. | ||
|
||
### Approach 2 : Creating a Go's plugin system to implement different Translators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably rename this to "Using Go plugins to implement different Translators"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
rfc/cdevents-translator.md
Outdated
|
||
For example the event structure is different for various events produced by Gerrit and an example struct of Gerrit project created event as below, | ||
|
||
### Approach 3 : Creating Go Plugin System over RPC(gRPC) using HashiCorp's go-plugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Using RPC to add new Translators"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
rfc/cdevents-translator.md
Outdated
|
||
|
||
type GerritTranslator struct { | ||
//Fields for Gerrit event Translator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: // [.]+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Fields for Gerrit event Translator | |
// Fields for Gerrit event Translator |
rfc/cdevents-translator.md
Outdated
|
||
### Approach 3 : Creating Go Plugin System over RPC(gRPC) using HashiCorp's go-plugin | ||
|
||
HashiCorp's [`go-plugin`](https://github.com/hashicorp/go-plugin) library simplifies the implementation of a plugin system in Go, it is a Go (golang) plugin system over RPC created by HashiCorp.</br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugin system in Go. It is a
rfc/cdevents-translator.md
Outdated
Expose the functionality of Go translator plugins as an HTTP/REST API, if this needs be used from other languages. | ||
- This structure can be extended by adding more translator plugins in the future without having to recompile the entire application. | ||
- The plugins can be developed independently and reside in separate repositories. | ||
- But the Go plugin system is currently only supported on Unix-like systems and has some limitations, such as the need to compile everything with the same Go version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the initial "But"
Thank you @xibz for reviewing this PR, Yes I think we can discuss in CDEvents Working Group meeting and reach a conclusion to select the most suitable one |
Some general comments on this RFC:
Bottom line: I propose that this initiative is limited to manage SCM related events only, and that it is one-directional. The name should preferably in some way reflect that. |
@e-backmark-ericsson Thank you very much for your comments,
|
Signed-off-by: Jalander Ramagiri <[email protected]>
Signed-off-by: Jalander Ramagiri <[email protected]>
Signed-off-by: Jalander Ramagiri <[email protected]>
Signed-off-by: Jalander Ramagiri <[email protected]>
Signed-off-by: Jalander Ramagiri <[email protected]>
Signed-off-by: Jalander Ramagiri <[email protected]>
Signed-off-by: Jalander Ramagiri <[email protected]>
Signed-off-by: Jalander Ramagiri <[email protected]>
Co-authored-by: xibz <[email protected]> Signed-off-by: Jalander Ramagiri <[email protected]>
Co-authored-by: xibz <[email protected]> Signed-off-by: Jalander Ramagiri <[email protected]>
75f28db
to
ffb63fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it makes sense to rename this proposed implementation to webhook_cdevents_adapter
. A translator
to me implies that there would be a one-to-one translation, but that might not always be the case I think.
Signed-off-by: Jalander Ramagiri <[email protected]>
@e-backmark-ericsson @afrittoli @xibz Thank you all for reviewing and providing your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a valid opinion on whether alternative 3 or any of the other are preferred but I'd say go ahead to this and if needed we could always make a different attempt later.
The proposal has some inconsistencies in the naming between 'adapter' and 'translator', but we could sort those out during the actual PR review later. I assume that based on this RFC we will create a repo under the cdevents org called 'webhook_cdevents_adapter'.
Yes I requested @afrittoli to create project under cdevents org with the name "webhook-cdevents-adapter" (replaced _ with -), just to follow other projects naming conventions under cdevents org And about using Ex: Please suggest, If I can rename this too with |
Signed-off-by: Jalander Ramagiri <[email protected]>
As discussed in one of the SIG event meets, keeping the plugins name with |
@afrittoli @xibz can you please re-review and approve If no other comments with this RFC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rjalander - lgtm!
Commits need to squashed - we can do a squash and merge too.
Can we merge this PR If no other comments. Thank you. |
Creating this PR, to review the current design approach and propose any changes that might help in creating a common cdevents-translator library.
Adding a page for Gerrit-CDEvents integration and mapping for various Gerrit events to CDEvents.