mattermost / matterbuild

Matterbuild - An internal Mattermost chatops tool for generating Mattermost releases

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Matterbuild

Matterbuild is an internal Mattermost chatops tool for generating Mattermost releases.

Get Involved

Developing

Environment Setup

Essentials:

  1. Install Go

Optionals:

  1. Tilt v0.13+ (to deploy on a local dev K8s cluster)
  2. kind v0.8+ (to spin up a local dev K8s cluster)
  3. kustomize v3.6+

Running

This project uses tilt to deploy to local Kubernetes cluster. In order to do this you need a local Kuberetes cluster (kind is recommended).

kind create cluster --name matterbuild

Matterbuild deployment to any cluster and any environment (dev, prod, etc) depends on existense of deploy/config/config.json file, this file is .gitignored and you can safeley choose to copy sample config there for local development and testing:

cp config.json deploy/config/

Point KUBECONFIG to the newly created cluster, and start tilt and open http://localhost:8080/:

make run

Note: If you don't want to use Tilt nor deploy to local cluster you can ignore it and simply start the binary server:

NOTILT=1 make run

Testing

Running all tests:

make test

Generate github mocks:

make mocks

Setting up slash command in Mattermost

  1. Navigate to http://localhost:8065/_redirect/integrations/commands/add
  2. Set Command Trigger Word to matterbuild
  3. Set Request URL to http://localhost:8080/slash_command
  4. Set Request Method to POST
  5. Click Save
  6. Navigate to any channel and type /matterbuild cutplugin --tag v0.6.3 --repo mattermost-plugin-demo --commitSHA 24dbd65762612fb72af6e7c30b40e9e8d0a90968

Test via curl

Invoke matterbuild commands using curl:

curl -X POST http://localhost:8080/slash_command -d "command=/matterbuild&token=&user_id=" -d "text=cutplugin+--tag+v0.4.1+--repo+mattermost-plugin-demo"

Testing cutplugin

To test the cutplugin you have to:

  1. Connect to Mattermost VPN
  2. Get AWS Vault credentials
  3. Signed public certificate by Vault
  4. Generate Github Token
  5. Set following fields in config.json before running matterbuild
// Used to authenticate invoking slash command
"AllowedTokens": ["irkngs1z4jrcz8t9aiyzu8zx3r", ""],
"AllowedUsers": ["gcye3z5pnpgibkcfhpemsp78ey", ""],

"GithubAccessToken": "---",
"GithubOrg": "mattermost",

"PluginSigningSSHKeyPath": "/Users/<user>/.ssh/id_rsa",
"PluginSigningSSHPublicCertPath": "/Users/<user>/.ssh/signed-cert.pub",
"PluginSigningSSHUser": "---",
"PluginSigningSSHHost": "---",
"PluginSigningSSHHostPublicKey": "199.199.222.222 ecdsa-sha2-nistp256 AyNTYAAABBBDZEF6pmnR=",
"PluginSigningAWSAccessKey": "---",
"PluginSigningAWSSecretKey": "---",
"PluginSigningAWSRegion": "us-east-1",
"PluginSigningAWSS3PluginBucket": "mattermost-toolkit-dev"

Releasing

There are helper Makefile targets to cut a release following semver:

  • make patch: to cut a patch release
  • make minor: to cut a minor release
  • make major: to cut a major release

About

Matterbuild - An internal Mattermost chatops tool for generating Mattermost releases


Languages

Language:Go 93.5%Language:Makefile 4.0%Language:Shell 1.7%Language:Dockerfile 0.6%Language:Starlark 0.1%