ops-bot

command module
v0.0.0-...-5e8daf6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2019 License: GPL-2.0 Imports: 10 Imported by: 0

README

GoDoc

Ops Bot

Development helper bot.

Table Of Contents

Overview

Chat bot which completes development operations.

See interact section for details on how to use the bot.

See the develop section to learn how to contribute.

Interact

Summon

Bot responds to GitHub issue and pull request comments in the KScout organization.

Bot only takes action if summoned via an @-mention:

@kscout-ops-bot

Summon can be anywhere in comment.

Permissions

Only users which are part of the KScout GitHub organization can interact with the bot.

Commands

Accepts commands in a rigid syntax:

/<command> <options>

Comments can have an unlimited number of commands, only requirement is that all commands start with a slash.

Deploy Command

Deploy pull request to environment.

Usage:

/deploy env=<env>

Options:

  • <env> (String) Environment to deploy pull request

Configure

Configure GitHub App

Create a new GitHub app:

  1. Set the Homepage URL to https://github.com/kscout/ops-bot
  2. Set the Webhook URL to https://<deploy host>/github/webhook
  3. Set the Webhook Secret
  4. Permissions:
    • Repository administration: Read-only
    • Repository contents: Read-only
    • Deployments: Read & write
    • Issues: Read & write
    • Pull requests: Read & write
  5. Subscribe to events
    • Commit comment
    • Issue comment
    • Pull request
    • Pull request review
    • Pull request review comment
    • Push
  6. Click create button
  7. Set application logo

Install GitHub app:

  1. Install on all repositories
  2. Generate private key

Configure Application

Configuration is passed via environment variables.

See the config Godoc for information about the available configuration options.

Develop

Most of the developer documentation is located in the [godoc](https://godoc.org/github.com/kscout/ops-bot]. See the [handlers godoc](https://godoc.org/github.com/kscout/ops-bot/handlers] for HTTP API documentation.

Documentation

Overview

An API server which provides ops-bot functionality.

Due to the nature of running jobs only 1 ops-bot process should run at a time. If more than one job ran at a time we would have to write distributed job management logic. This is not required right now.

Architecture:

Messages received from any source -> commands.Receiver -> commands.CommandRunner

Message sources send received messages as messages.Message structs to commands.Receiver.

Currently GitHub is the only message source. The handlers package includes a webhook which receives GitHub events and sends them to the commands.Receiver.

The commands.Receiver parses commands.CommandRequests out of incoming messages and sends these to commands.CommandRunner.

commands.CommandRunner receives commands.CommandRequests and starts a go routines for each command request.

Directories

Path Synopsis
Logic which runs at the request of messages
Logic which runs at the request of messages
Configuration.
Configuration.
GitHub.
GitHub.
HTTP handlers.
HTTP handlers.
Message data model.
Message data model.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL