mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-23 00:32:25 +01:00
207 lines
4.1 KiB
Markdown
207 lines
4.1 KiB
Markdown
<!-- DO NOT EDIT THIS FILE! -->
|
||
<!-- Instead edit contrib/mattermost.php -->
|
||
<!-- Then run bin/docgen -->
|
||
|
||
# Mattermost Recipe
|
||
|
||
```php
|
||
require 'contrib/mattermost.php';
|
||
```
|
||
|
||
[Source](/contrib/mattermost.php)
|
||
|
||
|
||
|
||
## Installing
|
||
|
||
Create a Mattermost incoming webhook, through the administration panel.
|
||
|
||
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
|
||
after('deploy:success', 'mattermost:notify:success');
|
||
```
|
||
|
||
If you want to notify about failed deployment add this too:
|
||
|
||
```php
|
||
after('deploy:failed', 'mattermost:notify:failure');
|
||
```
|
||
|
||
|
||
|
||
## Configuration
|
||
### mattermost_webhook
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L80)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
null
|
||
```
|
||
|
||
|
||
### mattermost_channel
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L81)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
null
|
||
```
|
||
|
||
|
||
### mattermost_username
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L82)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'deployer'
|
||
```
|
||
|
||
|
||
### mattermost_icon_url
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L83)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
null
|
||
```
|
||
|
||
|
||
### mattermost_success_emoji
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L85)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
':​white_check_mark:'
|
||
```
|
||
|
||
|
||
### mattermost_failure_emoji
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L86)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
':​x:'
|
||
```
|
||
|
||
|
||
### mattermost_text
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L88)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'_{{user}}_ deploying `{{branch}}` to **{{target}}**'
|
||
```
|
||
|
||
|
||
### mattermost_success_text
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L89)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'Deploy to **{{target}}** successful {{mattermost_success_emoji}}'
|
||
```
|
||
|
||
|
||
### mattermost_failure_text
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L90)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'Deploy to **{{target}}** failed {{mattermost_failure_emoji}}'
|
||
```
|
||
|
||
|
||
|
||
## Tasks
|
||
|
||
### mattermost:notify
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L93)
|
||
|
||
Notifies mattermost.
|
||
|
||
|
||
|
||
|
||
### mattermost:notify:success
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L114)
|
||
|
||
Notifies mattermost about deploy finish.
|
||
|
||
|
||
|
||
|
||
### mattermost:notify:failure
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/mattermost.php#L135)
|
||
|
||
Notifies mattermost about deploy failure.
|
||
|
||
|
||
|
||
|