Skip to content
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

Implement basic global webhooks from config #10545

Closed
wants to merge 2 commits into from

Conversation

jamesorlakin
Copy link
Contributor

This PR adds a very primitive way of having webhooks configured that work for all repositories across the system. Originally I misinterpreted Default Webhooks as system-wide setting for this feature, and not just a template for new repositories - Doh 🤦‍♂

The rationale for this change (as potentally hinted here) would be to enable more custom integrations. I was investigating at creating a custom authentication layer for a Docker registry, but wanted to know when a repository was deleted in order to remove images automatically. I was also looking at creating a utility to comment Jira tickets on PRs - equally in need of knowing events happening on the system.

I accept if this isn't a desired method, so alternatively we could look at implenting system webhooks in the UI and DB (while trying to avoid any confusion with default webhooks) or even a full 'apps/plugin API'? I'm also not that fluent at Go, so all comments are welcome! 😄

@codecov-io
Copy link

Codecov Report

Merging #10545 into master will increase coverage by 0.03%.
The diff coverage is 24%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10545      +/-   ##
==========================================
+ Coverage   43.74%   43.77%   +0.03%     
==========================================
  Files         586      586              
  Lines       81764    81789      +25     
==========================================
+ Hits        35769    35807      +38     
+ Misses      41553    41548       -5     
+ Partials     4442     4434       -8
Impacted Files Coverage Δ
modules/setting/webhook.go 58.82% <100%> (+2.57%) ⬆️
modules/webhook/webhook.go 40.12% <20.83%> (-3.49%) ⬇️
models/unit.go 37.03% <0%> (-2.47%) ⬇️
modules/indexer/issues/indexer.go 56.19% <0%> (-1.33%) ⬇️
models/notification.go 63.88% <0%> (-0.84%) ⬇️
routers/repo/view.go 36.14% <0%> (-0.68%) ⬇️
models/error.go 29.23% <0%> (+0.51%) ⬆️
services/pull/pull.go 36.07% <0%> (+0.87%) ⬆️
modules/git/repo.go 49.08% <0%> (+2.29%) ⬆️
services/pull/patch.go 62.89% <0%> (+2.51%) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82be59e...bed66ea. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 29, 2020
@lafriks
Copy link
Member

lafriks commented Feb 29, 2020

It would be better if they would be saved in database to have more flexibility and extendability in the future

@jamesorlakin
Copy link
Contributor Author

I agree to be honest. I'll take a look at it for another PR but it might not be perfect...

@jamesorlakin
Copy link
Contributor Author

Closing in favour of #10546

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants