-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Drop db operations from hook commands #1514
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
Conversation
…tead of internal routes
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.
Just documenting this
) | ||
|
||
// GetProtectedBranchBy get protected branch information | ||
func GetProtectedBranchBy(repoID int64, branchName string) (*models.ProtectedBranch, error) { |
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 should be moved to go-gitea/sdk
later on... I'm not gonna ask you to do it now , but we're gonna have to move it at some point.
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 should we move it to go-gitea/sdk
later? It is an internal SDK.
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.
Should still be in the SDK. That way other implementations of gitea serv
could re-use this :)
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 that the sdk contain any internal route but we could maybe add it in an other time.
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.
In fact it add /api/v1 to url request (https://github.com/go-gitea/go-sdk/blob/master/gitea/gitea.go#L42) so no internal route.
routers/private/push_update.go
Outdated
"strings" | ||
|
||
macaron "gopkg.in/macaron.v1" | ||
|
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.
local package -> public package.
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.
done.
related #1023 |
cmd/hook.go
Outdated
log.NewGitLogger(filepath.Join(setting.LogRootPath, logPath)) | ||
models.LoadConfigs() | ||
|
||
return nil |
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.
No error return. Maybe changed to
func hookSetup(logPath string) {
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.
done.
LGTM |
@lunny Why do you think this is a good idea? Just trying to get the intention... Doing GET and POST from hooks seems unstable to me. Will they work when HTTPS is being used? |
@andreynering They will use |
// GetProtectedBranchBy get protected branch information | ||
func GetProtectedBranchBy(repoID int64, branchName string) (*models.ProtectedBranch, error) { | ||
// Ask for running deliver hook and test pull request tasks. | ||
reqURL := setting.LocalURL + fmt.Sprintf("api/internal/branch/%d/%s", repoID, branchName) |
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.
@andreynering As you can see here it uses LocalURL
which is fine 🙂
@andreynering As far as "is this a good idea?", this is actually how |
@andreynering It will let us avoid open db on |
LGTM |
No description provided.