deployer/docs/contrib/mattermost.md

216 lines
5.6 KiB
Markdown
Raw Normal View History

2020-10-02 00:11:13 +02:00
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit contrib/mattermost.php -->
<!-- Then run bin/docgen -->
# mattermost
[Source](/contrib/mattermost.php)
## Installing
Create a Mattermost incoming webhook, through the administration panel.
Require the new recipe into your `deploy.php`
```php
require 'contrib/mattermost.php';
```
Add hook on deploy:
```
before('deploy', 'mattermost:notify');
```
## Configuration
- `mattermost_webhook` - incoming mattermost webook **required**
```
set('mattermost_webook', 'https://{your-mattermost-site}/hooks/xxx-generatedkey-xxx');
```
- `mattermost_channel` - overrides the channel the message posts in
```
set('mattermost_channel', 'town-square');
```
- `mattermost_username` - overrides the username the message posts as
```
set('mattermost_username', 'deployer');
```
- `mattermost_icon_url` - overrides the profile picture the message posts with
```
set('mattermost_icon_url', 'https://domain.com/your-icon.png');
```
- `mattermost_text` - notification message
```
set('mattermost_text', '_{{user}}_ deploying `{{branch}}` to **{{target}}**');
```
- `mattermost_success_text` success template, default:
```
set('mattermost_success_text', 'Deploy to **{{target}}** successful {{mattermost_success_emoji}}');
```
- `mattermost_failure_text` failure template, default:
```
set('mattermost_failure_text', 'Deploy to **{{target}}** failed {{mattermost_failure_emoji}}');
```
- `mattermost_success_emoji` emoji added at the end of success text
- `mattermost_failure_emoji` emoji added at the end of failure text
For detailed information about Mattermost hooks see: https://developers.mattermost.com/integrate/incoming-webhooks/
## Usage
If you want to notify only about beginning of deployment add this line only:
```php
before('deploy', 'mattermost:notify');
```
If you want to notify about successful end of deployment add this too:
```php
2020-10-29 23:16:36 +01:00
after('deploy:success', 'mattermost:notify:success');
2020-10-02 00:11:13 +02:00
```
If you want to notify about failed deployment add this too:
```php
after('deploy:failed', 'mattermost:notify:failure');
```
2021-08-31 20:15:06 +02:00
* Configuration
* [mattermost_webhook](#mattermost_webhook)
* [mattermost_channel](#mattermost_channel)
* [mattermost_username](#mattermost_username)
* [mattermost_icon_url](#mattermost_icon_url)
* [mattermost_success_emoji](#mattermost_success_emoji)
* [mattermost_failure_emoji](#mattermost_failure_emoji)
* [mattermost_text](#mattermost_text)
* [mattermost_success_text](#mattermost_success_text)
* [mattermost_failure_text](#mattermost_failure_text)
2020-10-02 00:11:13 +02:00
* Tasks
2021-08-31 20:15:06 +02:00
* [mattermost:notify](#mattermostnotify) — Notify mattermost
* [mattermost:notify:success](#mattermostnotifysuccess) — Notifying mattermost about deploy finish
* [mattermost:notify:failure](#mattermostnotifyfailure) — Notifying mattermost about deploy failure
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
## Configuration
2020-10-02 00:11:13 +02:00
### mattermost_webhook
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost_webhook%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
null
```
2020-10-02 00:11:13 +02:00
### mattermost_channel
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost_channel%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
null
```
2020-10-02 00:11:13 +02:00
### mattermost_username
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost_username%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
'deployer'
```
2020-10-02 00:11:13 +02:00
### mattermost_icon_url
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost_icon_url%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
null
```
2020-10-02 00:11:13 +02:00
### mattermost_success_emoji
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost_success_emoji%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
':&#8203;white_check_mark:'
```
2020-10-02 00:11:13 +02:00
### mattermost_failure_emoji
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost_failure_emoji%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
':&#8203;x:'
```
2020-10-02 00:11:13 +02:00
### mattermost_text
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost_text%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
'_{{user}}_ deploying `{{branch}}` to **{{target}}**'
```
2020-10-02 00:11:13 +02:00
### mattermost_success_text
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost_success_text%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
'Deploy to **{{target}}** successful {{mattermost_success_emoji}}'
```
2020-10-02 00:11:13 +02:00
### mattermost_failure_text
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost_failure_text%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
'Deploy to **{{target}}** failed {{mattermost_failure_emoji}}'
```
2020-10-02 00:11:13 +02:00
## Tasks
### mattermost:notify
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost%3Anotify%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
2020-10-02 00:11:13 +02:00
### mattermost:notify:success
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost%3Anotify%3Asuccess%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
2020-10-02 00:11:13 +02:00
### mattermost:notify:failure
2020-11-16 10:56:42 +01:00
[Source](https://github.com/deployphp/deployer/search?q=%22mattermost%3Anotify%3Afailure%22+in%3Afile+language%3Aphp+path%3Acontrib+filename%3Amattermost.php)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00