-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
migrate to cloudevents sdk v2 #2243
Conversation
Hi @n3wscott. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
/retest |
1 similar comment
/retest |
The errors do not look related to my change... /retest |
hm
cool.... /retest |
/retest i ... someone should make a better one of these. |
cc @afrittoli ^^ |
|
The sdk was not correctly setting the http request content length and was a real issue. Fixed with cloudevents/sdk-go#405 |
Thanks for putting this together @n3wscott 🎉 |
@vdemeester @dibyom @afrittoli What do we need to move this along? 😇 |
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.
/meow
/cc @sbwsg @bobcatfish
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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 for this!
My only question is whether we have less test coverage now.
failingClientBehaviour = FakeClientBehaviour{SendSuccessfully: false} | ||
) | ||
|
||
func TestSendCloudEvent(t *testing.T) { |
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.
Why is this test all removed?
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.
There is no need to wrap using the client send function. Just use the client directly.
logger = logger.With(zap.String("taskrun", tr.Name)) | ||
|
||
// Make the event we would like to send: | ||
event, err := EventForTaskRun(tr) |
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.
Nice, you separated creating the event from the delivery. Is this so we only build it once, in case of multiple deliveries?
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.
yeah, the controller now uses the client directly, and all the custom stuff is doing is understanding how to take a TaskRun
and turn it into an event.Event
.
Well... I deleted a lot of code, and so the coverage is about the same. |
cool, thanks /lgtm |
🙏 tide |
@afrittoli anything we can do to kick Prow here? Seems stuck. |
/lgtm |
That sounds... wierd |
@mattmoor @n3wscott The list of commits looks a bit unusual, there are 9 commits and at least on of them is a merge commit. Could you try and squash them into one or two commits, then I'll re-approve the patch? Thanks! |
/hold |
While I was here, I also refactored some of the CloudEvents integration, some major points: you now send spec version 1.0 formatted events ID is not the task run name, this was a bad idea if you want to send more than one event for that run. The task run name is now used as the subject. ID is now a UUID. The event that is created for sending is only created once, and then used for all deliveries. This means that all subscribers get the same event content and ID. The event payload is marshaled inside the Event object. I show examples in the code and tests of how to set and get the payload as your custom struct. Removed a lot of the layers passing clients and event components around. Better to build the event and then call send on the client directly. This deleted a lot of code that was doing many things, like create an event, and then attempt to send it. Signed-off-by: Scott Nichols <[email protected]>
ok smashed it all into one commit /unhold |
/hold cancel |
@afrittoli this should be RFAL |
looks like this failed:
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afrittoli, vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks! |
fixes #2240
While I was here, I also refactored some of the CloudEvents integration, some major points:
I think the integration tests had been failing (will confirm in moments) because in the new SDK if you set data as a
[]byte
, this tells us you want to base64 encode the data out. So the receiver was getting base64 encoded data and not understanding it.