-
Notifications
You must be signed in to change notification settings - Fork 361
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
example hook: dataset metadata validation #7752
Conversation
♻️ PR Preview 2aea483 has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
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 hook definition looks good from a product perspective! I'm approving this aspect of the PR
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,
2 comments
pkg/api/controller.go
Outdated
@@ -4637,11 +4637,14 @@ func (c *Controller) MergeIntoBranch(w http.ResponseWriter, r *http.Request, bod | |||
swag.StringValue(body.Strategy), | |||
graveler.WithForce(swag.BoolValue(body.Force))) | |||
|
|||
var v *graveler.HookAbortError |
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.
Shouldn't this logic be in the action execution points in graveler?
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 think graveler should be aware of what happens in a hook, it should be opaque. The meaning of an execution error vs an explicit failure is (imo) out of scope. I chose to put it here because the main "benefit" of this capability is how the error is exposed, so the API (presentation) layer felt like the natural choice.
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 - so why are we doing it only or the Merge flow?
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.
Actually I wasn't :) turns out errors are already handled in handleAPIError
including HookAbortError - so I went ahead and removed this.
pkg/actions/lua/hook/lib.go
Outdated
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.
Would love to see unit tests for this lib similar to path
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 agree. Added.
@N-o-Z PTAL :) |
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.
LGTM!
This PR also adds: