Giter Site home page Giter Site logo

mattermost / mattermost-plugin-gitlab Goto Github PK

View Code? Open in Web Editor NEW
132.0 35.0 81.0 12.3 MB

GitLab plugin for Mattermost

License: Apache License 2.0

Makefile 0.73% Go 25.33% JavaScript 70.66% CSS 0.46% TypeScript 2.82%
hacktoberfest mattermost mattermost-plugin

mattermost-plugin-gitlab's People

Contributors

apollo13 avatar ayusht2810 avatar bbodenmiller avatar crspeller avatar cvockrodt avatar cwarnermm avatar dependabot[bot] avatar dieakutesense avatar ericjaystevens avatar hanzei avatar icelander avatar iomodo avatar jasonblais avatar jfrerich avatar justinegeffen avatar jwilander avatar kshitij-katiyar avatar levb avatar lieut-data avatar m1lt0n avatar manland avatar matthewdorner avatar mickmister avatar raghavaggarwal2308 avatar shivamjosh avatar sibasankarnayak avatar spirosoik avatar srkgupta avatar titanventura avatar vladimirdotk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mattermost-plugin-gitlab's Issues

Repair test

When I had merge #64 the ci was not working. And i have introduced a regression in tests... ๐Ÿ˜“

Correction is trivial ;)

/gitlab settings provides no feedback

/gitlab settings [setting] [value] provides no feedback in the form of an ephemeral post that anything has happened.

There should be feedback that this change was saved.

Configuration change must propagate to client side

Reproduction

  • I activate the plugin, default config point to gitlab.com
  • A user load MM
  • I configure it with my.gilab.com
  • User connect to my.gitlab.com but top/left widget point to gitlab.com

Fix

When OnConfigurationChange in server arrive we must prevent all user connected (web socket) to reload conf

Help user to link multiple gitlab instances

Problem

If a user want to link to gitlab.com and gitlab.perso.com

Today solution

clone repo, change manifest id, recompile, add to mattermost, configure

Ideal solution

have list in plugin settings

Proposed solution

In CI we can :

  • build normal bin
  • change manifest id to add _2 at end and build
  • change manifest id to add _3 at end and build
  • change manifest id to add _4 at end and build
  • upload all this version in realease tag

User can add enough instance of this plugin and configure them.

As mattermost do the job of isolation in KVStore and reducers all should work.

Error when connecting with gitlab

Wheb running /gitlab connect and signing in I get the approval page to authorize access to my account.

After clicking on approve I get a page with only:

invalid character '<' looking for beginning of value

This is the error I see in the mattermost logs:

{"level":"error","ts":1557431585.4238338,"caller":"mlog/sugar.go:23","msg":"can't exchange state","plugin_id":"com.github.manland.mattermost-plugin-gitlab","err":"invalid character '<' looking for beginning of value"}

Adding multiple repos won't be reflected

First of, let me write this appreciation message! We love this plugin.

The problem we have is that when we add the webhook to many repos, the plugin will only show the first repo where the webhook was added. I've tried reenabling the plugin, restarting mattermost, readding the webhoo, but it all fails. Is this a bug or am I doing something wrong?

Help me with overstanding the ReadMe steps...

Unable to find this part nor any identical settings as described here:

I just realized now this is the old readme that applies to github mostly maybe thats why I do not find all menus like described ** updated **

**```
Go to the settings page of your GitLab group and click on "Webhooks" in the sidebar
Click "Add webhook"
WHERE is this area Gitlab Group??? <=

Change content type to "application/json" <= Where is this? Maybe adding a Print screen visual or GIF or short video, very confusing this readme .

Select the events: Issues, Issue comments, Pull requests, Pull request reviews, Pull request review comments, Pushes, Branch or Tag creation and Branch or Tag deletion

image

I am curious where are your events taken from... Again confusing here while I could never match all events you described.

Add webhook without leaving mattermost

As a user (before I dev this plugin) I didn't know how to add a project to listen to in github-plugin. I didn't read the readme... meaculpa. But I think to be more easy to use we should add webhook for user. Like that user just /gitlab subscribe owner/project and all the magic make the job.

Obviously for group, we need to fetch all projects and add it to every repos. If user create a new project after this init step we will miss it... maybe we can cron a synchronizer...

https://docs.gitlab.com/ce/api/projects.html#add-project-hook

Subgroups support

What about support for subscriptions on entire subgroups or subgroup projects?

Error with self signed certificates for GitLab

Setting the plugin up works as expected, /gitlab connect works up to the point where I can click
Authorize.
After that, I get redirected to a blank page:

Post https://<my-git-url>/oauth/token: x509: certificate signed by unknown authority

In the serverlog I can only see the same error:

{"level":"error","ts":1566657710.0417624,"caller":"mlog/sugar.go:23","msg":"can't exchange state","plugin_id":"com.github.manland.mattermost-plugin-gitlab","err":"Post https://<my-git-url>/oauth/token: x509: certificate signed by unknown authority"}

If I can supply you with any more information, please let me know.
Using the latest version of mattermost and your plugin.
Other services often have an option for untrusted connections, which do work.

Setting `Enterprise Base URL` is not appropriate for GitLab

This property is copied from mattermost-plugin-github and because in github all on-premise instances are entreprise grade, the name is good. But gitlab can have on-premise without etreprise lincence.

I propose to rename it Gitlab URL with https://gitlab.com as default value, without optional.

Move to gitlab

A plugin of gitlab in github...

Pro :

  • integrated ci/cd

Cons :

  • community of mattermost is in github
  • all other plugins are in github

Missing Validation when attempting to subscribe and providing invalid feature

Seems like using subscribe without providing a feature will subscribe to all which is good. But, it also seems like there is validation missing when subscribing to an individual feature.

When I include an invalid feature it is ignored and I get a success message. /gitlab subscribe owner dkh-test-group NotaFeature

This should provide feedback that the feature was invalid and was ignored.

Caching in ci doesn't work

On issue with this setup is that the caching doesn't work. The orb expects the go.mod file to be at /go.mod. But in this project it's at /server/go.mod.
I see
Screenshot from 2019-06-24 07-45-29

Possible options:

  1. Ignore this problem
  2. Move go.mod into the root directory
  3. Modify the orb to make this customizable

@manland Thoughts on this?

Originally posted by @hanzei in #69 (comment)

Missing validation when using unsubscribe

When the 'unsubscribe' command does nothing because the repo was incorrect, the users still get's a success message.

/gitlab unsubscribe fake-repo

The user should receive a message that they are not subscribed to any such repo,

Can't unsubscribe from organization

Instead of subscribing to a repo I've subscribed to the entire organization. Now I'd like to unsubscribe from the organization because it causes too much noise in our main channel. I can't seem to be able to unsubscribe:

image

I've tried subscribing/unsubscribing from repos and that works, I only seem to get this problem with organizations. Is there a trick to remove that subscription ?

Usa bot account

Mattermost 5.10 introduces bot accounts. A bot account should be created on startup and used. The setting Username an be removed.

Unitfy webhook event structure

The structure of the webhook events messages isn't very consistent. E.g.:

Comment on an issue:

$REPO New comment by $AUTHOR on $ISSUE_NUMBER $ISSUE_NAME
$CONTENT

Close issue:

[$REPO] Issue $ISSUE_NUMBER closed by $AUTHOR`

Opening an issue:

#### $ISSUE_NAME

##### $REPO/$ISSUE_NUMBER

# new issue by $AUTHOR on $TIMESTAP

MR events are structure similarly.

My proposal would be:

  1. Start comment and close event with [$REPO] and link to the repo
  2. Don't show issues numbers at all
  3. Don't show timestamps at all
  4. Always use the username
  5. Add @ before username
  6. Use #### as the maximum heading

Update section 4. of Setup Guide to use BOT Account

The setup guide should to be updated to use the new BOT accounts functionality. This functionality will be exposed in the UI for 5.12

Section 4. - step ii.
Create a new Mattermost user, through the regular UI or the CLI with the username "gitlab"

This should be updated for 5.12 to instruct the user to navigate to the integrations section and create a new bot instead of a user account that functions as a BOT.

Wrong gitlab API url when using on-prem server

When using custom "Enterprise Base URL" it seems that it pre-pends api/v3 before the api/v4 url.

Getting this error when trying to authorize the plugin after /gitlab connect:

GET https://gitlab.local.domain/api/v3/api/v4/user: 410 {error: API V3 is no longer supported. Use API V4 instead.}

Group limitation

Check if all endpoints and web hook are limited when group limitation is on

Enable Private Repositories not enforced

It it seems like even when Enable Private Repositories set to false, I can subscribe to private repos. I ensured that the plugin was restarted after the flag was set to False and saw the same result.
note: It's possible this could just be incorrect feedback returned by the subscribe command

  1. Disable plugin
  2. Set flag to false
  3. Enable Plugin
  4. Connect user to GitLab if needed - if needed
  5. Subscribe to a private project in a private group ex:/gitlab subscribe owner dkh-test-group/dkh-project2
    Expected: Subscription fails
    Observed: Subscription was successful

Implement web hook push event

Original github-plugin impelmentation :

func (p *Plugin) postPushEvent(event *github.PushEvent) {
	config := p.getConfiguration()
	repo := event.GetRepo()

	subs := p.GetSubscribedChannelsForRepository(ConvertPushEventRepositoryToRepository(repo))

	if len(subs) == 0 {
		return
	}

	userID := ""
	if user, err := p.API.GetUserByUsername(config.Username); err != nil {
		mlog.Error(err.Error())
		return
	} else {
		userID = user.Id
	}

	forced := event.GetForced()
	branch := strings.Replace(event.GetRef(), "refs/heads/", "", 1)
	commits := event.Commits
	compare_url := event.GetCompare()
	pusher := event.GetSender()

	if len(commits) == 0 {
		return
	}

	fmtMessage := ``
	if forced {
		fmtMessage = "[%s](%s) force-pushed [%d new commits](%s) to [\\[%s:%s\\]](%s/tree/%s):\n"
	} else {
		fmtMessage = "[%s](%s) pushed [%d new commits](%s) to [\\[%s:%s\\]](%s/tree/%s):\n"
	}
	newPushMessage := fmt.Sprintf(fmtMessage, pusher.GetLogin(), pusher.GetHTMLURL(), len(commits), compare_url, repo.GetName(), branch, repo.GetHTMLURL(), branch)
	for _, commit := range commits {
		newPushMessage += fmt.Sprintf("[`%s`](%s) %s - %s\n",
			commit.GetID()[:6], commit.GetURL(), commit.GetMessage(), commit.GetCommitter().GetName())
	}

	post := &model.Post{
		UserId: userID,
		Type:   "custom_git_push",
		Props: map[string]interface{}{
			"from_webhook":      "true",
			"override_username": GITHUB_USERNAME,
			"override_icon_url": config.ProfileImageURL,
		},
		Message: newPushMessage,
	}

	for _, sub := range subs {
		if !sub.Pushes() {
			continue
		}

		post.ChannelId = sub.ChannelID
		if _, err := p.API.CreatePost(post); err != nil {
			mlog.Error(err.Error())
		}
	}
}

Originally posted by @hanzei in https://github.com/manland/mattermost-plugin-gitlab/pull/5#discussion-diff-275288604R365

Refresh icon visibility

On the
image image is github plugin showcase, here is the gitlab plugin:

image

Also on macOS app, there are glitches on right side next to slider, when hovering over the gitlab icons.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.