mattermost-plugin-gitlab icon indicating copy to clipboard operation
mattermost-plugin-gitlab copied to clipboard

WIP: :sparkles: add webhook in gitlab when subscribe

Open manland opened this issue 6 years ago • 7 comments
trafficstars

TODO :

  • [ ] test
  • [ ] all pages in addWebhook to check already exist

Fix #15 Fix #46

manland avatar May 21 '19 11:05 manland

Codecov Report

Merging #53 into master will decrease coverage by 4.21%. The diff coverage is 15.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #53      +/-   ##
==========================================
- Coverage   35.31%   31.09%   -4.22%     
==========================================
  Files          16       21       +5     
  Lines        1416     1701     +285     
==========================================
+ Hits          500      529      +29     
- Misses        867     1106     +239     
- Partials       49       66      +17
Impacted Files Coverage Δ
server/plugin.go 6.95% <0%> (-0.28%) :arrow_down:
server/gitlab/user.go 0% <0%> (ø)
server/cron.go 0% <0%> (ø)
server/subscriptions.go 23.47% <0%> (-0.42%) :arrow_down:
server/gitlab/gitlab.go 0% <0%> (ø)
server/gitlab/api.go 10.06% <21.12%> (ø)
server/gitlab/mock_goGitlabProxy.go 29.16% <29.16%> (ø)
... and 2 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 e12418b...257c232. Read the comment docs.

codecov[bot] avatar Jul 01 '19 20:07 codecov[bot]

@hanzei @crspeller @jasonblais I need help for this... I don't know if I finish it or not!

Hi think, adding webhook automatically, is a good feature. But I don't know if this MR is not over-engineering for the purpose.

I can imagine a simple one where user add an arg to the command /gitlab subscribe owner[/repo] [features] autowebhook=true and it will add the webhook only for owner/repo not for owner at the user demand (not automatically)!?

In this PR I try to keep owner (or organization in github world) and sub project in sync (every time we create a project in an organization and plugin listen this organization we add a webhook).

And what about the unsucribing a repo? I need to delete the webhook? Or I keep it running (to have info on issues... for DM user) and just don't display it in the channel?

An other missing feature around this topic is #36, I can imagine a popup with all subscriptions and a form to add new one. And so adding a check box to add webhook on creation...

What do you think about that? Finishing it, is not time consuming but can have huge impact for user!? Maybe a more simple implementation and try to have feedback from users can help?

manland avatar Sep 11 '19 20:09 manland

@manland To confirm - is the proposal to automate webhook creation in step 3 based on users' subscriptions?

jasonblais avatar Sep 12 '19 00:09 jasonblais

@jasonblais yes sorry I didn't explain the context :sweat_smile:

This PR is for delete the need to add web hook in gitlab manually! Deleted part in readme.

In github, the process is different because :

  • with an organization and a web hook added to it (like MM) all sub projects will work
  • most users don't have personal instance of github (and, I guess 2 or 3 organizations are enough for them)

But in gitlab world :

  • lot of users have personal instance with lot of organizations (and sub group)
  • web hook on other level than project doesn't exist (I have discovered web hook at instance level but not all events are fired)

In my company (which is little : 100 employees) we have 50 organizations, mostly have 10 subgroup and all have 100 projects. Adding web hook in this context is really long... And organizations, subgroup or project are created every day by other teams!

manland avatar Sep 12 '19 10:09 manland

@manland Interesting, thanks for sharing the context.

I'm curious how other webhook-based integrations work with GitLab. E.g. for Slack it appears you have to configure the webhook once per GitLab project https://docs.gitlab.com/ee/user/project/integrations/slack.html

Are there any concerns with security / privacy -- e.g. will a subscription that is auto-created accidentally post confidential information into a channel?

Maybe a more simple implementation and try to have feedback from users can help?

I like this approach as it gives us an opportunity to see if we're moving in the right direction. Maybe with a System Console setting so the SysAdmin can enable/disable this feature?

cc @aaronrothschild if you have additional thoughts on above

jasonblais avatar Sep 13 '19 19:09 jasonblais

User here: if an administrator of a team could use "/gitlab subscribe group/subgroup/project" to create the webhook in said Gitlab project, given said administrator also has the required permissions, you would already have a way better workflow than the current one. This could be a feature release on its own.

Handling whole (sub)group subscriptions could come in a second time/PR.

guillaume-perreal avatar Sep 16 '19 14:09 guillaume-perreal

This issue has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

/cc @jasonblais @hanzei

mattermod avatar Sep 27 '19 00:09 mattermod

This PR is not longer needed

hanzei avatar Feb 21 '23 09:02 hanzei