Skip to content

M-ZubairAhmed/mattermost-plugin-netlify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

repo image

Mattermost Plugin Netlify

A two way integration plugin between Mattermost and Netlify.

working of netlify plugin

Table of content

Installation

Please download the latest version of the release directory. Head over to System Console and drop the latest release in plugins section. For more help on how to install a custom plugin refers installing custom plugin docs.

Currently unstable due to active development, should be used for testing purpose only, Open for bugs and improvements.

Setting up

Setting up at Netlify

  1. Head over to your Netlify account, and proceed to User settings. Find the tab Applications and under OAuth applications section; click on New OAuth app button. Screenshot_2020-02-23 Sites XOXOXO's team

  2. Enter the Application Name. The Redirect URI should be of /plugins/netlify/auth/redirect form. The site url is where you mattermost app is hosted. Example if you are installing it at the community the redirect url can be https://community.mattermost.com/plugins/netlify/auth/redirect . Description is optional field. Hit save button when fields are filled. Screenshot_2020-02-23 OAuth applications Netlify

  3. You can see the new oauth app of the Application Name you entered, created under OAuth applications. Expand it to view Redirect URL, Client ID and Secret. Screenshot_2020-02-23 Mohammed Zubair Ahmed Applications

  4. Keep all the information above handy to be copied at plugin settings. ie.

    • Application Name
    • Redirect URI
    • Client ID
    • Secret

Setting up at Mattermost

  1. Head back to your Mattermost application. And open Sytem Console and select Netlify under Plugins tab on the left. plugin-settings

  2. Copy over the fields from Netlify

    • Netlify Application Name also referred as Application Name at Netlify.
    • Netlify Client ID also referred as Client ID at Netlify
    • Netlify Secret also referred as Secret at Netlify
    • Plugin Encryption Key can be generated by hitting over Regenerate button below it.
    • Webhook Secret Key can be generated by hitting over Regenerate button below it.
  3. Hit Save button in the footer to save your settings.

  4. Restart the plugin to propagate the effect. Screenshot_2020-02-23 System Console - Mattermostsas

Running up

  1. This plugin works with the helps of simple commands and interactive dialogues. But first to be able to access any of the plugins commands, Netlify and Mattermost needs to be connected. Go to any channel and write the first slash command of netlify plugin /netlify connect. Netlify bot then posts a link through which you can authenticate your netlify account. Screenshot_2020-02-23 Any Channel - AQQQ Mattermost

  2. Follow the link and you will be taken to Netlify login site. After logging in you will be presented with a permission screen. Hit approve button. Screenshot_2020-02-23 Authorize Application Netlify

  3. If successful, You will be redirected to successfully authenticated page. This page can be safely closed then. Screenshot_2020-02-23 Screenshot

  4. A new message from netlify Bot is also posted on the DM stating the same. With this Netlify Mattermost plugin is configured and ready to use. Screenshot_2020-02-23 netlify - AQQQ Mattermost

Features

Slash commands

With the series of slash commands at its disposal, Netlify plugin can be used to manage or change resources up at Netlify account.

Connect command

/netlify connect

By executing this command, the bot will post a link into the channel. Following which authentication with Netlify can be performed. Any of the belows commands requests that connection being made first before execution. After successfully authentication access token is stored in encrypted form at mattermost database. Which is then used to perform various operations via netlify api.

connect-gif

Disconnect command

/netlify disconnect

This commands clears out authentication between netlify and mattermost. All the notifications are also unsubscribed from Mattermost.

disconnect-gif

List command

/netlify list

It tabulates all the sites information of Netlify account. It lists name, url, custom domain, repository, deployed branch, managed by team, last updated of the site.

list-gif

List Id command

/netlify list id

This is usually a precursor command which you will be using to obtain site ids of you netlify hosted sites. It tabulates your sites along with its ids.

list-id-gif

Deploy command

/netlify deploy <site_id>

It triggers a new build on your site. At a time only one site can be built. Site Id could be obtained by running list id command. When deployed through this command your netlify site deploy message will be triggered by Netlify Bot from Mattermost. It will also automatically create a build webhook in your netlify application under the name Mattermost-Netlify-Build-Hook, care must be taken not to delete it while running the Netlify bot.

deploy-gif

Rollback command

/netlify rollback

It can facilitate to quick rollback to a previous stable state of the website. The latest five releases are shown for a particular site to roll back the site to. Since this is not a deploy, notification are not enabled for this operation. But the site itself it rolled back internally and can be verified by checking the site url itself.

rollback-gif

Subscribe command

/netlify subscribe

It subscribes sites to post build notifications on the channel from where the command was executed.

subscribe

Unsubscribe command

/netlify unsubscribe

It unsubscribes the channel from where command was executed from all Netlify sites build notifications.

unsubscribe

Subscriptions command

/netlify subscriptions

Lists out all your Netlify site(s) subscribed with the channel to receive build notifications.

subscribes

Site command

/netlify site

Shows in depth information of your Netlify site.

site

Me command

/netlify me

This commands show relevant information of the Netlify account connected to Mattermost via the plugin.

me-gif

Help command

/netlify help

It shows all the commands which are available for user to interact with Netlify bot.

help-gif

Notifications

This plugin comes with beautiful, slick and condensed notifications for your Netlify sites. Which when subscribed can show information regarding your builds.

Build started

When enabled, this notifications pops up in your channel as soon as a new deploy is in progress for one of your sites.

st

Build successful

When enabled, this notification informs you that the build has successfully completed for one of your site. It also gives an SSL enabled preview url of the new build along with build logs.

co

Build failed

When enabled, this notification alerts you that the build has terminated without result. It shows the top build failure reason along with complete failure build logs.

fail

Development

This plugin contains only a server portion. Webapp portion at this time is not needed. But feel free to include that if need arises.

  • To bundle plugin
make dist
  • To check for styles
make check-style

Road map

  • Tighten security along the lines of encrypted keys
  • Add support for DNS configuration
  • Add support for Forms control
  • Include notifications for Forms submissions
  • Enforce JWS authentication for incoming webhooks

About

Mattermost netlify plugin

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published