docs: add drone plugin docs. (#31)
This commit is contained in:
parent
92bb0b736a
commit
790c555063
287
DOCS.md
Normal file
287
DOCS.md
Normal file
@ -0,0 +1,287 @@
|
|||||||
|
---
|
||||||
|
date: 2017-01-08T00:00:00+00:00
|
||||||
|
title: Telegram
|
||||||
|
author: appleboy
|
||||||
|
tags: [ notifications, chat ]
|
||||||
|
repo: appleboy/drone-telegram
|
||||||
|
logo: telegram.svg
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
---
|
||||||
|
|
||||||
|
The Telegram plugin posts build status messages to your account. The below pipeline configuration demonstrates simple usage:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with photo message:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ photo:
|
||||||
|
+ - tests/1.png
|
||||||
|
+ - tests/2.png
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with document message:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ document:
|
||||||
|
+ - tests/1.pdf
|
||||||
|
+ - tests/2.pdf
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with sticker message:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ sticker:
|
||||||
|
+ - tests/3.png
|
||||||
|
+ - tests/4.png
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with audio message:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ audio:
|
||||||
|
+ - tests/audio1.mp3
|
||||||
|
+ - tests/audio2.mp3
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with voice message:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ voice:
|
||||||
|
+ - tests/voice1.ogg
|
||||||
|
+ - tests/voice2.ogg
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with location message:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ location:
|
||||||
|
+ - 24.9163213,121.1424972
|
||||||
|
+ - 24.9263213,121.1224972
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with venue message:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ venue:
|
||||||
|
+ - 24.9163213,121.1424972,title,address
|
||||||
|
+ - 24.3163213,121.1824972,title,address
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with video message:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ video:
|
||||||
|
+ - tests/video1.mp4
|
||||||
|
+ - tests/video2.mp4
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with message format:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ format: markdown
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration for success and failure messages:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ when:
|
||||||
|
+ status: [ success, failure ]
|
||||||
|
```
|
||||||
|
|
||||||
|
Example configuration with a custom message template:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
+ message: |
|
||||||
|
+ {{ #success build.status }}
|
||||||
|
+ build {{ build.number }} succeeded. Good job.
|
||||||
|
+ {{ else }}
|
||||||
|
+ build {{ build.number }} failed. Fix me please.
|
||||||
|
+ {{ /success }}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Secrets
|
||||||
|
|
||||||
|
The telegram plugin supports reading credentials from the Drone secret store. This is strongly recommended instead of storing credentials in the pipeline configuration in plain text.
|
||||||
|
|
||||||
|
```diff
|
||||||
|
pipeline:
|
||||||
|
telegram:
|
||||||
|
image: appleboy/drone-telegram
|
||||||
|
- token: xxxxxxxxxx
|
||||||
|
to: telegram_user_id
|
||||||
|
```
|
||||||
|
|
||||||
|
The `token` attribute can be replaced with the below secret environment variables. Please see the Drone documentation to learn more about secrets.
|
||||||
|
|
||||||
|
PLUGIN_TOKEN
|
||||||
|
: telegram token
|
||||||
|
|
||||||
|
# Parameter Reference
|
||||||
|
|
||||||
|
token
|
||||||
|
: telegram token from [telegram developer center](https://core.telegram.org/bots/api)
|
||||||
|
|
||||||
|
to
|
||||||
|
: telegram user id
|
||||||
|
|
||||||
|
message
|
||||||
|
: overwrite the default message template
|
||||||
|
|
||||||
|
photo
|
||||||
|
: local file path
|
||||||
|
|
||||||
|
document
|
||||||
|
: local file path
|
||||||
|
|
||||||
|
sticker
|
||||||
|
: local file path
|
||||||
|
|
||||||
|
audio
|
||||||
|
: local file path
|
||||||
|
|
||||||
|
voice
|
||||||
|
: local file path
|
||||||
|
|
||||||
|
location
|
||||||
|
: local file path
|
||||||
|
|
||||||
|
video
|
||||||
|
: local file path
|
||||||
|
|
||||||
|
venue
|
||||||
|
: local file path
|
||||||
|
|
||||||
|
format
|
||||||
|
: `markdown` or `html` format
|
||||||
|
|
||||||
|
# Template Reference
|
||||||
|
|
||||||
|
repo.owner
|
||||||
|
: repository owner
|
||||||
|
|
||||||
|
repo.name
|
||||||
|
: repository name
|
||||||
|
|
||||||
|
build.status
|
||||||
|
: build status type enumeration, either `success` or `failure`
|
||||||
|
|
||||||
|
build.event
|
||||||
|
: build event type enumeration, one of `push`, `pull_request`, `tag`, `deployment`
|
||||||
|
|
||||||
|
build.number
|
||||||
|
: build number
|
||||||
|
|
||||||
|
build.commit
|
||||||
|
: git sha for current commit
|
||||||
|
|
||||||
|
build.branch
|
||||||
|
: git branch for current commit
|
||||||
|
|
||||||
|
build.tag
|
||||||
|
: git tag for current commit
|
||||||
|
|
||||||
|
build.ref
|
||||||
|
: git ref for current commit
|
||||||
|
|
||||||
|
build.author
|
||||||
|
: git author for current commit
|
||||||
|
|
||||||
|
build.link
|
||||||
|
: link the the build results in drone
|
||||||
|
|
||||||
|
build.started
|
||||||
|
: unix timestamp for build started
|
||||||
|
|
||||||
|
build.finished
|
||||||
|
: unix timestamp for build finished
|
||||||
|
|
||||||
|
# Template Function Reference
|
||||||
|
|
||||||
|
uppercasefirst
|
||||||
|
: converts the first letter of a string to uppercase
|
||||||
|
|
||||||
|
uppercase
|
||||||
|
: converts a string to uppercase
|
||||||
|
|
||||||
|
lowercase
|
||||||
|
: converts a string to lowercase. Example `{{lowercase build.author}}`
|
||||||
|
|
||||||
|
datetime
|
||||||
|
: converts a unix timestamp to a date time string. Example `{{datetime build.started}}`
|
||||||
|
|
||||||
|
success
|
||||||
|
: returns true if the build is successful
|
||||||
|
|
||||||
|
failure
|
||||||
|
: returns true if the build is failed
|
||||||
|
|
||||||
|
truncate
|
||||||
|
: returns a truncated string to n characters. Example `{{truncate build.sha 8}}`
|
||||||
|
|
||||||
|
urlencode
|
||||||
|
: returns a url encoded string
|
||||||
|
|
||||||
|
since
|
||||||
|
: returns a duration string between now and the given timestamp. Example `{{since build.started}}`
|
1
logo.svg
Normal file
1
logo.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 512 512" height="512px" id="Layer_1" version="1.1" viewBox="0 0 512 512" width="512px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M492.168,442.732c0,34.171-27.703,61.872-61.873,61.872H80.551c-34.171,0-61.874-27.701-61.874-61.872 V92.987c0-34.171,27.703-61.873,61.874-61.873h349.744c34.17,0,61.873,27.701,61.873,61.873V442.732z" fill="#2A679E"/><path d="M492.168,417.988c0,34.172-27.703,61.873-61.873,61.873H80.551c-34.171,0-61.874-27.701-61.874-61.873 V68.243c0-34.171,27.703-61.872,61.874-61.872h349.744c34.17,0,61.873,27.7,61.873,61.872V417.988z" fill="#64A9DC"/><path d="M491.234,428.645c0.139-0.797,0.26-1.6,0.369-2.407c0.021-0.151,0.039-0.304,0.059-0.456 c0.091-0.715,0.171-1.432,0.238-2.152c0.033-0.367,0.057-0.738,0.084-1.107c0.041-0.544,0.084-1.086,0.109-1.635 c0.045-0.961,0.074-1.926,0.074-2.898V208.19c-0.656-0.645-1.314-1.29-1.965-1.937c-2.088-2.073-4.113-4.229-6.254-6.245 c-2.143-2.017-4.072-4.269-6.259-6.238c-1.942-2.207-4.222-4.127-6.24-6.263c-2.021-2.138-4.161-4.181-6.247-6.254 c-2.088-2.073-4.113-4.229-6.254-6.245c-2.143-2.017-4.072-4.269-6.259-6.238c-1.942-2.207-4.222-4.127-6.24-6.263 c-2.021-2.138-4.161-4.181-6.247-6.254c-2.088-2.073-4.113-4.229-6.254-6.245c-2.143-2.017-4.072-4.269-6.259-6.238 c-1.942-2.207-4.222-4.127-6.24-6.263c-2.021-2.138-4.161-4.181-6.247-6.254c-4.113-4.088-8.096-8.348-12.32-12.318 c-3.787-3.559-9.271-3.986-14.035-2.388c-0.775,0.26-1.516,0.602-2.278,0.896c-1.028,0.396-2.058,0.794-3.087,1.19 c-4.939,1.905-9.879,3.811-14.818,5.716c-8.076,3.115-16.151,6.229-24.227,9.344c-10.361,3.997-20.723,7.993-31.085,11.99 c-11.799,4.551-23.598,9.102-35.396,13.652c-12.388,4.777-24.774,9.555-37.161,14.333c-12.125,4.677-24.251,9.354-36.377,14.031 c-11.015,4.249-22.031,8.498-33.046,12.746c-9.056,3.493-18.112,6.986-27.168,10.479c-6.248,2.409-12.495,4.819-18.743,7.229 c-2.589,1-5.179,1.998-7.769,2.997c-2.942,1.135-5.839,2.569-8.425,4.381c-2.63,1.842-5.561,4.515-5.817,7.941 c-0.271,3.619,2.928,6.014,5.218,8.296c2.083,2.078,4.111,4.237,6.257,6.249c2.148,2.014,4.066,4.291,6.27,6.246 c1.922,2.217,4.224,4.112,6.229,6.254c2.008,2.145,4.163,4.176,6.244,6.251c2.083,2.077,4.111,4.237,6.257,6.249 c2.148,2.014,4.066,4.291,6.27,6.246c1.922,2.217,4.224,4.111,6.229,6.254c2.008,2.145,4.163,4.176,6.244,6.251 c2.083,2.077,4.111,4.237,6.257,6.249c2.148,2.014,4.066,4.291,6.27,6.246c1.922,2.217,4.224,4.111,6.229,6.254 c2.008,2.145,4.163,4.176,6.244,6.251c2.083,2.077,4.111,4.237,6.257,6.249c2.148,2.014,4.066,4.291,6.27,6.246 c1.922,2.217,4.224,4.111,6.229,6.254c0.975,1.041,2.044,1.99,3.025,3.025c0.403,0.426,0.49,0.947,0.672,1.506 c0.452,1.387,0.914,2.77,1.378,4.152c0.763,2.266,1.245,4.637,2.104,6.869c0.697,1.811,2.022,2.861,3.307,4.238 c1.607,1.723,3.393,3.277,5,5c3.214,3.443,6.786,6.555,10,10c3.214,3.443,6.786,6.555,10,10c3.214,3.443,6.786,6.555,10,10 c3.214,3.443,6.786,6.555,10,10c3.214,3.443,6.786,6.555,10,10c3.214,3.443,6.786,6.555,10,10c3.214,3.443,6.786,6.555,10,10 c3.214,3.443,6.786,6.555,10,10c3.214,3.443,6.786,6.555,10,10c3.214,3.443,6.786,6.555,10,10c3.214,3.443,6.786,6.555,10,10 c3.072,3.291,6.463,6.287,9.563,9.553h92.822C460.83,479.861,486.182,457.734,491.234,428.645z" fill="#3C7EC8"/><path d="M386.898,117.316L117.615,221.179c-18.379,7.374-18.27,17.625-3.35,22.196l67.16,20.962l25.697,78.785 c3.124,8.623,1.584,12.043,10.639,12.043c6.988,0,10.088-3.186,13.98-6.988c2.475-2.422,17.17-16.709,33.578-32.662l69.859,51.615 c12.855,7.092,22.137,3.418,25.338-11.939l45.857-216.096C411.068,120.272,399.197,111.734,386.898,117.316z M191.965,259.521 l151.379-95.506c7.557-4.583,14.486-2.119,8.797,2.931L222.521,283.896l-5.047,53.83L191.965,259.521z" fill="#FFFFFF"/></svg>
|
After Width: | Height: | Size: 3.8 KiB |
Loading…
Reference in New Issue
Block a user