-
Notifications
You must be signed in to change notification settings - Fork 10
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
🤖 Triggering CI on branch 'release-next' after synching to upstream/master #271
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: alanfx The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
4529f4e
to
b7d6c5a
Compare
OCF Webhook is merging this PR |
This commit adds two new types for InterceptorRequest and InterceptorResponse. Instead of just forwarding the incoming request, EventListeners will use these types to send requests to interceptors. This commit introduces an `extensions` field where Interceptors can add additional data that is available to TriggerBindings. This replaces the previous mechanism where Interceptors could freely modify the input bodies. With this change, the input bodies are immutable, and any extra fields added by Interceptors can only be done within the `extensions` field. This commit simply adds the new interface types and plumbing. Future commits will change the Interceptors to adopt the new Interface. Part of #271 and tektoncd#778 Signed-off-by: Dibyo Mukherjee <[email protected]>
This commit updates the CEL interceptor to use the new interface that supports immutable input event bodies. This represents a BREAKING CHANGE for users using `overlays`. Overlays will no longer modify the request body. Instead `keys` from overlays will be added to a new top-level `extensions` field that is accessible to TriggerBindings. Part of #271 Signed-off-by: Dibyo Mukherjee <[email protected]>
This commit migrates the GitHub, GitLab, BitBucket interceptors to use the new InterceptorRequest/Response types. Since these interceptors do not modify the event body, this change is not a breaking change. In addition, this commit also refactors the tests for the interceptors by splitting valid and invalid scenarios into separate test cases. Part of #271 and tektoncd#778 Signed-off-by: Dibyo Mukherjee <[email protected]>
We were using GRPC's `status.Status` as the type for the `Status` field in InterceptorResponse. This struct contains an embedded proto status message. This means that we'd have to use a custom Marshal/Unmarshal function for the Status to correctly contain the Code and Message fields. Instead, this commit creates our own Status struct that mimics the GRPC status. We will still use the same Status codes from GRPC but having our own type makes the JSON encoding/decoding process significantly less complex. In the future, we'd have to come up with a way to represent the Details field (which is of proto.Any type) as well. Part of #271 Signed-off-by: Dibyo Mukherjee <[email protected]>
1. Change body from []byte to json.RawMessage 2. Remove omitempty tag for boolean type so that it marshals when false 3. Change context.url to context.event_url to match struct type Part of #271 Signed-off-by: Dibyo Mukherjee <[email protected]>
This commit packages the 4 core interceptors into a single HTTP server. Each interceptor is available at a different path e.g. /cel for CEL etc. This does not wire up the implementation of the server into the EventListener which will be done in a future commit. Part of #271 Signed-off-by: Dibyo Mukherjee <[email protected]>
Storing the body as `json.RawMessage` can lead to loss of information about spaces in the incoming body when the InterceptorRequest is marshaled as JSON before sending it over HTTP. This is because Go's `json.Marshal` will encode `[]byte` as a base64 string and base64 does not preserve spaces. Adding a custom `MarshalJSON` does not help here since `MarshalJSON` will return a `[]byte` that will then get compacted as base64 by `json.Marshal`. This loss of spaces can be problematic for some use cases. For instance, the GitHub payload signature validation requires us to compare using the exact body as it was sent. Otherwise, the validation fails. Note that this will only be a problem when we marshal the InterceptorRequest i.e. when we move the core interceptors out to its own server. Using a string means that the string will be quoted e.g. `{\"foo\": \"bar\"}`. Go should take care of unquoting it during the unmarshaling process. However, intercetpor authors using a different language will have to manually unquote the string by parsing it as a JSON object. Part of #271, tektoncd#867 Signed-off-by: Dibyo Mukherjee <[email protected]>
No description provided.