From ec03c4a463f065a878e0dfa53d9adc3af01cf6b2 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Fri, 15 Feb 2019 11:58:36 +0100 Subject: [PATCH] Unified documentation and readme --- DOCS.md | 87 ------------------------------------------------------- README.md | 23 ++++++++++----- 2 files changed, 15 insertions(+), 95 deletions(-) delete mode 100644 DOCS.md diff --git a/DOCS.md b/DOCS.md deleted file mode 100644 index 1e1dc0d..0000000 --- a/DOCS.md +++ /dev/null @@ -1,87 +0,0 @@ -Use the Webhook plugin to notify services via Webhook when a build completes. -You will need to supply Drone with outgoing Webhook URLs. - -You can override the default configuration with the following parameters: - -* `urls` - JSON payloads are sent to each URL -* `method` - HTTP request method. Defaults to `POST` -* `headers` - HTTP request header map -* `username` - The username as a string for HTTP basic auth -* `password` - The password as a string for HTTP basic auth -* `skip_verify` - Skip verification of TLS certificates, defaults to `false` - -## Example - -The following is a sample configuration in your .drone.yml file: - -```yaml -notify: - webhook: - urls: - - https://your.webhook/... - - https://your.other.webhook/... - headers: - - "Authorization=pa55word" -``` - -### Custom Body - -In some cases you may want to submit a custom payload in the body of your hook. -For this usage the following additional parameters should be used: - -* `template` - Handlebars template to create a custom payload body. See [docs](http://handlebarsjs.com/) -* `content_type` - HTTP request content type, defaults to `application/json` - -Example configuration that generate a custom Yaml payload: - -TBD - -### Basic Authentication - -> It is important to note that with HTTP Basic Authentication the provided -> username and password are not encrypted. - -In some cases your webhook may need to authenticate with another service. You -can set the basic `Authentication` header with a username and password. For -these use cases we expose the following additional parameters: - -* Sets the request's `Authorization` header to use HTTP Basic Authentication with the provided username and password below - * `username` - The username as a string - * `password` - The password as a string - -Example configuration to include HTTP Basic Authentication: - -```yaml -notify: - webhook: - method: POST - username: myusername - password: mypassword - urls: - - https://tower.example.com/... -``` - -### Debugging Webhooks - -In some cases complicated webhooks may need debugging to ensure `urls`, -`template`, `auth` and more a properly configured. For these use cases we expose -the following `debug` parameter: - -* `debug` - If `true` it will print out each URL request and response information - -Example configuration to include the `debug` parameter: - -```yaml -notify: - webhook: - debug: true - method: POST - username: myusername - password: mypassword - urls: - - http://tower.example.com/api/v1/job_templates/44/launch/ - - http://tower.example.com/api/v1/job_templates/45/launch/ - content_type: application/json -``` - - diff --git a/README.md b/README.md index 2e2cfe5..7f5d295 100644 --- a/README.md +++ b/README.md @@ -12,24 +12,31 @@ Drone plugin to send build status notifications via Webhook. For the usage infor ## Build -Build the binary with the following commands: +Build the binary with the following command: -``` -go build +```console +export GOOS=linux +export GOARCH=amd64 +export CGO_ENABLED=0 +export GO111MODULE=on + +go build -v -a -tags netgo -o release/linux/amd64/drone-webhook ``` ## Docker -Build the Docker image with the following commands: +Build the Docker image with the following command: -``` -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -tags netgo -o release/linux/amd64/drone-webhook -docker build --rm -t plugins/webhook . +```console +docker build \ + --label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ + --label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \ + --file docker/Dockerfile.linux.amd64 --tag plugins/webhook . ``` ### Usage -``` +```console docker run --rm \ -e PLUGIN_URLS=https://hooks.somplace.com/endpoing/... \ -e PLUGIN_HEADERS="HEADER1=value1" \