2015-11-03 19:31:25 +00:00
|
|
|
# drone-webhook
|
|
|
|
|
2015-12-09 09:04:44 +00:00
|
|
|
Drone plugin for sending notifications via Webhook
|
2015-11-03 19:31:25 +00:00
|
|
|
|
2015-12-09 09:04:44 +00:00
|
|
|
## Usage
|
2015-11-03 19:31:25 +00:00
|
|
|
|
2015-12-09 09:04:44 +00:00
|
|
|
```
|
|
|
|
./drone-webhook <<EOF
|
2015-11-03 19:31:25 +00:00
|
|
|
{
|
|
|
|
"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": {
|
2015-11-21 18:01:42 +00:00
|
|
|
"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"
|
2015-11-03 19:31:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
```
|
|
|
|
|
|
|
|
## Docker
|
|
|
|
|
2015-12-09 09:04:44 +00:00
|
|
|
Build the Docker container using `make`:
|
2015-11-03 19:31:25 +00:00
|
|
|
|
2015-12-09 09:04:44 +00:00
|
|
|
```
|
|
|
|
make deps build
|
2015-11-03 19:31:25 +00:00
|
|
|
docker build --rm=true -t plugins/drone-webhook .
|
|
|
|
```
|
|
|
|
|
2015-12-09 09:04:44 +00:00
|
|
|
### Example
|
2015-11-03 19:31:25 +00:00
|
|
|
|
|
|
|
```sh
|
|
|
|
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": {
|
2015-11-21 18:01:42 +00:00
|
|
|
"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"
|
2015-11-03 19:31:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
```
|