Skip to content

Commit

Permalink
Update GitLab plug-in documentation (#143)
Browse files Browse the repository at this point in the history
Co-authored-by: Romain Maneschi <[email protected]>
Co-authored-by: Justine Geffen <[email protected]>
Co-authored-by: Rohit Jain <[email protected]>
Co-authored-by: Ben Schumacher <[email protected]>
  • Loading branch information
5 people authored Sep 28, 2020
1 parent e43ead5 commit a5e7c6a
Show file tree
Hide file tree
Showing 12 changed files with 242 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
root: ./docs/
68 changes: 29 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Mattermost/GitLab Integration

The GitLab/Mattermost plugin documentation is currently being updated and relocated to a new location: https://mattermost.gitbook.io/gitlab-plugin/ - let us know your thoughts on the new format in the [Plugin: GitLab Channel](https://community-daily.mattermost.com/core/channels/gitlab-plugin) on our Mattermost community!

# Mattermost GitLab Plugin

[![Build Status](https://img.shields.io/circleci/project/github/mattermost/mattermost-plugin-gitlab/master.svg)](https://circleci.com/gh/mattermost/mattermost-plugin-gitlab)
Expand All @@ -8,96 +12,82 @@
**Maintainer:** [@iomodo](https://github.com/iomodo)
**Co-Maintainer:** [@hanzei](https://github.com/hanzei)

A GitLab plugin for Mattermost.

Originally developed by [Romain Maneschi](https://github.com/manland).
A GitLab plugin for Mattermost. Originally developed by [Romain Maneschi](https://github.com/manland).

![GitLab Plugin screenshot](https://user-images.githubusercontent.com/13119842/69115984-96b3ff80-0a58-11ea-92a3-9176b6b05a89.png)

## Features

* __Daily reminders__ - the first time you log in to Mattermost each day, get a post letting you know what issues and merge requests need your attention
* __Notifications__ - get a direct message in Mattermost when someone mentions you, requests your review, comments on or modifies one of your merge requests/issues, or assigns you on GitLab
* __Sidebar buttons__ - stay up-to-date with how many reviews, unread messages, assignments and open merge requests you have with buttons in the Mattermost sidebar
* __Slash commands__ - interact with the GitLab plugin using the `/gitlab` slash command
* __Subscribe to a repository__ - Use `/gitlab subscriptions add` to subscribe a Mattermost channel to receive posts for new merge requests and/or issues in a GitLab repository
* __Get to do items__ - Use `/gitlab todo` to get an ephemeral message with items to do in GitLab
* __Update settings__ - Use `/gitlab settings` to update your settings for the plugin
* __And more!__ - Run `/gitlab help` to see what else the slash command can do
* __Supports GitLab On Premise__ - Works with SaaS and On Premise versions of GitLab
* __Daily reminders__ - The first time you log in to Mattermost each day, get a post letting you know what issues and merge requests need your attention.
* __Notifications__ - Receive a direct message in Mattermost when someone mentions you, requests your review, comments on, or modifies one of your merge requests/issues, or assigns you on GitLab.
* __Sidebar buttons__ - Stay up to date with how many reviews, unread messages, assignments, and open merge requests you have with buttons in the Mattermost sidebar.
* __Slash commands__ - Interact with the GitLab plugin using the `/gitlab` slash command.
* __Subscribe to a repository__ - Use `/gitlab subscriptions add` to subscribe a Mattermost channel to receive posts for new merge requests and/or issues in a GitLab repository.
* __Get to do items__ - Use `/gitlab todo` to get an ephemeral message with items to do in GitLab.
* __Update settings__ - Use `/gitlab settings` to update your settings for the plugin.
* __And more!__ - Run `/gitlab help` to see what else the slash command can do.
* __Supports GitLab On Premise__ - Works with SaaS and on-prem versions of GitLab.

## Installation

In Mattermost 5.16 and later, the GitLab plugin is included in the Plugin Marketplace which can be accessed from **Main Menu > Plugins Marketplace**. You can install the GitLab plugin and then configure it via the [Plugin Marketplace "Configure" button](#configuration).
From Mattermost 5.16 and later, the GitLab plugin is included in the Plugin Marketplace which can be accessed from **Main Menu > Plugins Marketplace**. You can install the GitLab plugin and then configure it via the [Plugin Marketplace "Configure" button](#configuration).

In Mattermost 5.13 and earlier, follow these steps:

1. Go to https://github.com/mattermost/mattermost-plugin-gitlab/releases to download the latest release file in zip or tar.gz format.
2. Upload the file through **System Console > Plugins > Management**, or manually upload it to the Mattermost server under plugin directory. See [documentation](https://docs.mattermost.com/administration/plugins.html#set-up-guide) for more details.

See [Compatibility](#Compatibility) for supported versions.

## Configuration

### Step 1: Register an OAuth application in GitLab
### Step 1: Register an OAuth Application in GitLab

1. Go to https://gitlab.com/profile/applications or https://gitlab.yourdomain.com/profile/applications to register an OAuth app.
1. Set the following values:
- **Name**: `Mattermost GitLab Plugin - <your company name>`
- **Redirect URI**: `https://your-mattermost-url.com/plugins/com.github.manland.mattermost-plugin-gitlab/oauth/complete`, replacing `https://your-mattermost-url.com` with your Mattermost URL
1. Select `api` and `read_user` in **Scopes**
1. Select `api` and `read_user` in **Scopes**.
1. Save the application. Copy the **Application ID** and **Secret** fields in the resulting screen.
1. In Mattermost, go to **Plugins Marketplace > GitLab > Configure**, and enter the **GitLab URL**, **GitLab OAuth Client ID**, and **GitLab OAuth Client Secret**
1. In Mattermost, go to **Plugins Marketplace > GitLab > Configure**, and enter the **GitLab URL**, **GitLab OAuth Client ID**, and **GitLab OAuth Client Secret**.

### Step 2: Configure plugin in Mattermost
### Step 2: Configure the Plugin in Mattermost

1. Go to **System Console > Plugins > GitLab** and do the following:
- Generate a new value for **Webhook Secret**.
- Generate a new value for **At Rest Encryption Key**.
- (Optional) **GitLab Group**: Lock the plugin to a single GitLab group by setting this field to the name of your GitLab group.
- (Optional) **Enable Private Repositories**: Allow the plugin to receive notifications from private repositories by setting this value to true.
When enabled, existing users must reconnect their accounts to gain access to private project. Affected users will be notified by the plugin once private repositories are enabled.
- (Optional) **Enable Private Repositories**: Allow the plugin to receive notifications from private repositories by setting this value to `true`. When enabled, existing users must reconnect their accounts to gain access to private project. Affected users will be notified by the plugin once private repositories are enabled.
1. Hit **Save**.
1. Go to **Plugins Marketplace > GitLab > Configure > Enable Plugin** and click **Enable** to enable the GitLab plugin.

### Step 3: Connect your GitLab accounts
### Step 3: Connect Your GitLab Accounts

Run the `/gitlab connect` slash command to connect your Mattermost account with GitLab.

### Step 4: Subscribe to Projects and Groups

__Note for each project you want to receive notifications for or subscribe to, you must create a webhook__
__Note for each project you want to receive notifications for or subscribe to, you must create a webhook.__

Run the subscribe slash command to watch events sent from GitLab.

```/gitlab subscriptions add group[/project]```
``/gitlab subscriptions add group[/project]``

Run the webhook slash command to have GitLab send events to Mattermost.

```/gitlab webhook add group[/project]```
``/gitlab webhook add group[/project]``

## Compatibility

| Mattermost-Plugin-Gitlab | Mattermost | GitLab |
| Mattermost-Plugin-Gitlab| Mattermost | GitLab |
|:-----------------------:|:----------:|:------:|
| 0.3.0 | 5.10+ | 11.2+ |
| 0.2.0 | 5.8+ | 11.2+ |
| 0.1.0 | 5.8+ | 11.2+ |

## Developing

This plugin contains both a server and web app portion.

Use `make dist` to build distributions of the plugin that you can upload to a Mattermost server.

Use `make check-style` to check the style.

Use `make deploy` to deploy the plugin to your local server. Before running `make deploy` you need to set a few environment variables:
## Development

```
export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_USERNAME=admin
export MM_ADMIN_PASSWORD=password
```
This plugin contains both a server and web app portion. Read our documentation about the [Developer Workflow](https://developers.mattermost.com/extend/plugins/developer-workflow/) and [Developer Setup](https://developers.mattermost.com/extend/plugins/developer-setup/) for more information about developing and extending plugins.

## Inspiration

Expand Down
Binary file added docs/.gitbook/assets/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Mattermost/GitLab Integration

[![Build Status](https://img.shields.io/circleci/project/github/mattermost/mattermost-plugin-gitlab/master.svg)](https://circleci.com/gh/mattermost/mattermost-plugin-gitlab) [![Code Coverage](https://img.shields.io/codecov/c/github/mattermost/mattermost-plugin-gitlab/master.svg)](https://codecov.io/gh/mattermost/mattermost-plugin-gitlab)

This plugin supports a two-way integration between Mattermost and GitLab. For a stable production release, please download the latest version [in the Releases tab](https://github.com/mattermost/mattermost-plugin-gitlab/releases) and follow [these instructions](./#2-configuration) for install and configuration. Check the Plugin Marketplace.

This plugin supports Software-as-a-Service (SaaS) or on-premises versions of GitLab.

Originally developed by [Romain Maneschi](https://github.com/manland)
16 changes: 16 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Table of Contents

* [Mattermost/GitLab Integration](README.md)
* [Feature Summary](feature-summary.md)

## Setup

* [Installation](setup/installation.md)
* [Configuration](setup/configuration.md)
* [Updating the Plugin](setup/updating-the-plugin.md)

## Development

* [Environment](development/environment.md)
* [Help Wanted!](development/help-wanted.md)
* [Help and Support](help-and-support.md)
21 changes: 21 additions & 0 deletions docs/development/environment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Environment

## Development

This plugin contains both a server and web app component.

Use `make dist` to build distributions of the plugin that you can upload to a Mattermost server.

Use `make check-style` to check the style.

Use `make deploy` to deploy the plugin to your local server. Before running `make deploy` you need to set a few environment variables:

```
export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_USERNAME=admin
export MM_ADMIN_PASSWORD=password
```

##

For additional information on developing plugins, refer to [our plugin developer documentation](https://developers.mattermost.com/extend/plugins/).
7 changes: 7 additions & 0 deletions docs/development/help-wanted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Help Wanted!

This project, [mattermost-plugin-gitlab](https://github.com/mattermost/mattermost-plugin-gitlab), is a fork of [mattermost-plugin-github](https://github.com/mattermost/mattermost-plugin-github). Thanks to all contributors of it.

If you're interested in joining our community of developers who contribute to Mattermost - check out the current set of issues [that are being requested](https://github.com/mattermost/mattermost-plugin-gitlab/issues?q=is%3Aissue+is%3Aopen+label%3AEnhancement).

You can also find issues labeled ["Help Wanted"](https://github.com/mattermost/mattermost-plugin-gitlab/issues?q=is%3Aissue+is%3Aopen+label%3A%22Help+Wanted%22) in the GitLab plugin repository that we have laid out the primary requirements for and could use some coding help from the community.
77 changes: 77 additions & 0 deletions docs/feature-summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Feature Summary

## GitLab to Mattermost Notifications

### Channel Subscriptions

Notify your team of the latest updates by sending notifications from your GitLab group or repository to Mattermost channels. When team members log in the first time to Mattermost each day, they can get a post letting them know what issues and merge requests need their attention. They can also get a refresh of new events by clicking on *Refresh* and from every webhook configured in GitLab.

You can specify which events trigger a notification. They can see:

- issues - includes new and closed issues
- merges - includes new and closed merge requests
- pushes - includes pushes
- issue_comments - includes new issue comments
- merge_request_comments - include new merge-request comments
- pipeline - include pipeline
- tag - include tag creation
- pull_reviews - includes merge request reviews
- label:"<labelname>" - must include "merges" or "issues" in feature list when using a label
- Defaults to "merges,issues,tag"



![image](.gitbook/assets/image.png)



### Personal Notifications: GitLab Bot

Each user in Mattermost is connected with their own personal GitLab account. Users can get a direct message in Mattermost when someone mentions them, requests their review, comments on, or modifies one of their merge requests/issues, or assigns them on GitLab.



### Sidebar Buttons

Team members can stay up-to-date with how many reviews, unread messages, assignments, and open merge requests they have by using buttons in the Mattermost sidebar.



## Mattermost Commands

Interact with the GitLab plugin using the `/gitlab` slash command.

### Subscribe To/Unsubscribe From a Repository

Use `/gitlab subscribe owner[/repo] [features]` to subscribe a Mattermost channel to receive posts for new merge requests and/or issues, or other features (as listed above), from a GitLab repository. Ensure that the webhook is configured, otherwise this will not work properly.

Use `/gitlab unsubscribe owner/repo` to unsubscribe from it.

`/gitlab subscribe list` lists what you have subscribed to.

### Connect To/Disconnect From GitLab

Connect your Mattermost account to your GitLab account using `/gitlab connect` and disconnect it using`/gitlab disconnect`.

`/gitlab me` displays the connected GitLab account.

### Get "To Do" Items

Use `/gitlab todo` to get a list of unread messages and merge requests awaiting your review.

### Update Settings

Use `/gitlab settings [setting] [value]` to update your settings for the plugin. There are two settings:

- To turn **personal notifications** `on` or `off.
- To turn **reminders** `on` or `off` for when you connect for the first time each day.

### And More...

Run `/gitlab help` to see what else the slash command can do.



## *Don't forget to add a webhook in GitLab*

See [Configuration](setup/configuration.md)
9 changes: 9 additions & 0 deletions docs/help-and-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Help and Support

For Mattermost customers - please open a [support case](https://mattermost.zendesk.com/hc/en-us/requests/new) to ensure your issue is tracked properly.

For Questions, suggestions, and help - please find us on our forum at [https://forum.mattermost.org/c/plugins](https://forum.mattermost.org/c/plugins).

Alternatively, join our public Mattermost server and join the [Integrations and Apps channel](https://community-daily.mattermost.com/core/channels/integrations).

To contribute to the Mattermost project see [https://www.mattermost.org/contribute-to-mattermost/](https://www.mattermost.org/contribute-to-mattermost/).
42 changes: 42 additions & 0 deletions docs/setup/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Configuration

### Step 1: Register an OAuth application in GitLab

1. Go to https://gitlab.com/profile/applications or https://gitlab.yourdomain.com/profile/applications to register an OAuth app.
2. Set the following values:
- **Name**: `Mattermost GitLab Plugin - <your company name>`
- **Redirect URI**: `https://your-mattermost-url.com/plugins/com.github.manland.mattermost-plugin-gitlab/oauth/complete`, replacing `https://your-mattermost-url.com` with your Mattermost URL
3. Select `api` and `read_user` in **Scopes**
4. Save the application
5. Copy the **Application ID** and **Secret** fields from the resulting screen
6. In Mattermost, go to **Plugins Marketplace > GitLab > Configure**
7. Enter the **GitLab URL**, **GitLab OAuth Client ID**, and **Gitlab OAuth Client Secret**

### Step 2: Configure Plugin in Mattermost

1. Go to **Plugins Marketplace &gt; GitLab** and click the **Configure** button or go to **System Console > Plugins > GitLab** and do the following:
1. Generate a new value for `Webhook Secret`
2. Generate a new value for **At Rest Encryption Key**
3. (Optional) **GitLab Group**: Lock the plugin to a single GitLab group by setting this field to the name of your GitLab group.
4. (Optional) **Enable Private Repositories**: Allow the plugin to receive notifications from private repositories by setting this value as `true`. When enabled, existing users must reconnect their accounts to gain access to a private project. Affected users will be notified by the plugin once private repositories are enabled.
5. Click **Save**.
2. Go to the top of the screen and set **Enable Plugin** to `True`and then click **Save** to enable the GitLab plugin.

### Step 3: Configure Webhooks in GitLab

For each project you want to receive notifications for, or subscribe to, you must create a webhook.

1. In GitLab, go to the project you want to subscribe to, select **Settings** then **Integrations** in the sidebar.
2. Set the following values:
- **URL**: `https://your-mattermost-url.com/plugins/com.github.manland.mattermost-plugin-gitlab/webhook`, replacing `https://your-mattermost-url.com` with your Mattermost URL.
- **Secret Token**: the webhook secret you copied previously.
3. Select all the events in **Triggers**.
4. Add the webhook.

### Step 4: Test it

To test it, run the `/gitlab connect` slash command to connect your Mattermost account with GitLab.



If you face issues installing the plugin, see our [Frequently Asked Questions]() for troubleshooting help, or open an issue in the [Mattermost Forum](http://forum.mattermost.org).
24 changes: 24 additions & 0 deletions docs/setup/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
description: Get started by installing the GitLab plugin from the Marketplace
---

# Installation

### Release Dependency

* The GitLab plugin is included in the Plugin Marketplace in Mattermost v5.16 and above.
* For Mattermost v5.13 and earlier a manual install is necessary.

### Marketplace Installation

1. Go to **Main Menu &gt; Plugin Marketplace** in Mattermost.
2. Search for "gitlab" or manually find the plugin from the list and click **Install**.
3. After the plugin has downloaded and been installed, click the **Configure** button.

### Manual Installation

If your server doesn't have access to the internet, you can download the latest [plugin binary release](https://github.com/mattermost/mattermost-plugin-gitlab/releases) and upload it to your server via **System Console > Plugins &gt; Plugin Management**. The releases on this page are the same used by the Marketplace.

See [documentation](https://docs.mattermost.com/administration/plugins.html#set-up-guide) for more details.

See [GitLab plugin release page](https://github.com/mattermost/mattermost-plugin-gitlab/releases) for compatibility considerations.
7 changes: 7 additions & 0 deletions docs/setup/updating-the-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
description: Getting the latest features and fixes
---

# Updating the Plugin

When a new version of the plugin is released to the **Plugin Marketplace**, the system will display a prompt asking you to update your current version of the GitLab plugin to the newest one. There may be a warning shown if there is a major version change that **may** affect the installation. Generally, updates are seamless and don't interrupt the user experience in Mattermost.

0 comments on commit a5e7c6a

Please sign in to comment.