Drone plugin for triggering webhook notifications
Go to file
Thomas Boerger a555f47f46 Some unification of the plugin code structure 2015-12-10 10:09:39 +01:00
.drone.sec sync on .drone.sec 2015-11-21 12:07:03 -06:00
.drone.yml Added makefile and use it within drone config 2015-12-10 10:09:39 +01:00
.gitignore Extended gitignore 2015-12-10 10:09:39 +01:00
DOCS.md adding some comments and fixing docs debug template example 2015-11-24 20:12:23 -06:00
Dockerfile Use official alpine image 2015-12-10 10:09:39 +01:00
LICENSE initial support for webhooks 2015-11-03 11:31:25 -08:00
MAINTAINERS Updated MAINTAINERS file [CI SKIP] 2015-12-09 14:19:07 -08:00
Makefile Added makefile and use it within drone config 2015-12-10 10:09:39 +01:00
README.md updating readme 2015-11-21 12:01:42 -06:00
logo.svg initial support for webhooks 2015-11-03 11:31:25 -08:00
main.go Some unification of the plugin code structure 2015-12-10 10:09:39 +01:00
types.go Some unification of the plugin code structure 2015-12-10 10:09:39 +01:00

README.md

drone-webhook

Drone plugin for sending Webhook notifications.

Overview

This plugin is responsible for sending build notifications via Webhooks:

./drone-webhooks <<EOF
{
    "repo" : {
        "owner": "foo",
        "name": "bar",
        "full_name": "foo/bar"
    },
    "build" : {
        "number": 22,
        "status": "success",
        "started_at": 1421029603,
        "finished_at": 1421029813,
        "commit": "9f2849d5",
        "branch": "master",
        "message": "Update the Readme",
        "author": "johnsmith",
        "author_email": "john.smith@gmail.com"
    },
    "vargs": {
      "urls": ["https://your.webhook/..."],
      "debug": true,
      "auth": {
        "username": "johnsmith",
        "password": "secretPass"
      },
      "headers": {
        "SomeHeader": "SomeHeaderValue"
      },
      "method": "POST",
      "template": "{\"git_branch\": \"{{ .Build.Branch }}\"}",
      "content_type": "application/json"
    }
}
EOF

Docker

Build the Docker container. Note that we need to use the -netgo tag so that the binary is built without a CGO dependency:

CGO_ENABLED=0 go build -a -tags netgo
docker build --rm=true -t plugins/drone-webhook .

Send a Webhook notification:

docker run -i plugins/drone-webhook <<EOF
{
    "repo" : {
        "owner": "foo",
        "name": "bar",
        "full_name": "foo/bar"
    },
    "build" : {
        "number": 22,
        "status": "success",
        "started_at": 1421029603,
        "finished_at": 1421029813,
        "commit": "9f2849d5",
        "branch": "master",
        "message": "Update the Readme",
        "author": "johnsmith",
        "author_email": "john.smith@gmail.com"
    },
    "vargs": {
      "urls": ["https://your.webhook/..."],
      "debug": true,
      "auth": {
        "username": "johnsmith",
        "password": "secretPass"
      },
      "headers": {
        "SomeHeader": "SomeHeaderValue"
      },
      "method": "POST",
      "template": "{\"git_branch\": \"{{ .Build.Branch }}\"}",
      "content_type": "application/json"
    }
}
EOF