weque

package module
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

README

README

CircleCI

Weque is a tool to handle webhooks and notifications. It's a replacement of hoko.

Features

Weque supports next functions.

  • Trigger processe with some environment variables when receiving webhooks of GitHub and Bitbucket.
  • Kick process with some environmet variables when receiving notifications of docker registry.
  • TLS communication
  • Notification to slack with rich attachment.
  • Helper commands to develop.
    • Maintain webhook settings of GitHub and Bitbucket.
    • Run handler scripts with payload without receiving webhooks actually.
    • Send notification to slack manually.

Installation

go get -u github.com/tmtk75/weque

Getting Started

Prerequisites

export GITHUB_TOKEN=<your github personal access token>

Take it here, https://github.com/settings/tokens

Preparing
$ ngrok http 9981
...
Forwarding                    https://df431fc9.ngrok.io -> localhost:9981
...

ngrok shows a URL for https and memorize it.

Then start a weque process.

SECRET_TOKEN=abc123 go run ./cmd/weque/main.go server
...

It's ready to receive webhooks.

Create a webhook setting and receive ping

Replace tmtk75/weque with a repository of yours.

$ go run ./cmd/weque/main.go github create \
        tmtk75/weque \
        https://df431fc9.ngrok.io \
	abc123

Repalce tmtk75/weque with a repository you have.

You will see some logs appear for receiving a ping just after you create a webhook if webhook is created properly.

$ go run ./cmd/weque/main.go github list tmtk75/weque
[{"type":"Repsitory","id":26495951,"name":"web","active":true,...

You can also see the webhook you created with github list command.

Debug

tcpflow on MacOS
$ tcpflow -i lo0 -c 'port 3000'

Development

[0]$ go run ./cmd/weque/main.go serve
...

[1]$ ngrok http 9981

Credit

The GitHub icon made by Dave Gandy from www.flaticon.com is licensed by CC 3.0 BY
The Bitbucket icon made by Swifticons from www.flaticon.com is licensed by CC 3.0 BY

Documentation

Index

Constants

View Source
const (
	KeySecretToken  = "secret_token"
	KeyInsecureMode = "insecure" // Skip verification step for development
	KeyPrefix       = "prefix"
)

Variables

View Source
var Stderr io.Writer = nil // for test
View Source
var Stdout io.Writer = nil // for test

Functions

func Request

func Request(mkreq func(m, p string, b io.Reader) (*http.Request, error), method, path string, body io.Reader) (string, error)

func Run

func Run(env []string, wd, s string, args ...string) error

func SendError

func SendError(w http.ResponseWriter, status int, msg string)

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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