ops-tool

An abstract tool for DevOps which streamlines day to day operations. It allow teams to implement custom workflows, dialogs, integrations and bind that pipeline to Mattermost slash commands. See commands folder for sample integrations. For more information check doc folder.

It will allow to integrate many providers and workflows by using configuration files. Ie.

Ops Tool Providers

For every provider it is possible to register different commands by only using configuration files.

GitLab Commnds

See documents how to configure provider and register commands. Sample configuration:

- command: "version"
  name: "Get GitLab Version"
  description: "Gets gitlab version. `gitlab version check` will do upgrade check!"
  exec: 
    - scripts/gitlab/gitlab_version.sh
  response:
    type: "ephemeral"
    colors:
    - color: "#ff0000"
      status: "upgrade"
    - color: "#00ff00"
      status: "ok"
    template: |
      {{ if eq .Status "upgrade" }}
      [GitLab](https://git.internal.mattermost.com) version is {{ .Data.version }}. Please upgrade to {{ .Data.latest }}.[Change Notes]({{ .Data.change_notes_url }})
      {{ else }}
      [GitLab](https://git.internal.mattermost.com) version is {{ .Data.version }}. {{ if .Data.latest }} Upgrade is not needed! {{ end }}
      {{ end }}  

Sample command output: /ops gitlab version check

GitLab Version Check

Architecture Example

In the following example, several Mattermost clients, are invoking /ops commands, to interact with remote APIs accessed by the ops-tool.

Ops Tool Architecture Example

Get Involved

Developing

Environment Setup

Essentials:

  1. Install Go
  2. Install jq

Optionals:

For local installations public tunnel is not needed. For cloud Mattermost servers :

  1. Public tunnel to expose local endpoints to the internet if needed. ie. Ngrok.

See config.sample.yaml for sample and read documentation how to configure the tool.

Configuration

  1. Create a Bot account.

  2. If Public tunnel is needed, configure your tunnel.

  3. Create Slash command. Enter <BASE_URL>/hook to Request URL and select POST as request method.

    image

  4. Create a Incoming Webhook. Do not select lock to this channel. It will be used for dialog and forms.

  5. Define command group configuration locations at configuration file in commands sections.

  6. Define scheduled command definitions in configuration.

  7. Define commands at commands folder.

  8. Prepared scripts at scripts folder.

See documentation for detailed configuration and command reference.

Running

To execute locally:

go run ./...

Testing

Running all tests:

make test

GitHub

View Github