novaway/deployer-release-check-list
最新稳定版本:1.0.0
Composer 安装命令:
composer require novaway/deployer-release-check-list
包简介
Release check-list for Deployer
README 文档
README
A simple recipe for Deployer to manage a release check-list using Gitlab issues.
The idea is to handle a list of mandatory (and non-blocking) tasks for a release.
This is made possible using a Gitlab issue (with its tasks system), with specific title and label (customisable).
Installation
composer require novaway/deployer-release-check-list
Configuration
// deploy.php <?php //... require 'recipe/release_check_list.php'; set('rcl_gitlab_host', 'https://gitlab.example.com'); set('rcl_gitlab_api_key', 'MY_API_TOKEN'); set('rcl_gitlab_project_id', 'MY_PROJECT_ID');
Usage
First, create a Gitlab issue with:
- a label named "Release check-list" (can be customized, see options below)
- a title following the format "[MAJOR.MINOR.x] My awesome check-list".
For example: "[1.8.x] My awesome check-list".
This issue will match all deployments based on a git tag beginning with 1.8:
bin/dep deploy prod --tag=1.8.6
Within the issue, you need to create a (one-level) task list:
Each task accepts two types of optional flags:
- one for the targeted Deployer host:
prod,staging, ... - one for tasks that need to be done after the deployment:
post-release(non-flagged tasks will be mandatory for the deployment and throw an error if not marked as done)
Example:
- [ ] Task 1 [prod,staging]
- [ ] Task 2 [prod,post-release]
- [ ] Task 3
Task 1will be mandatory before the deployment onprodandstaginghostsTask 2will be non-blocking for the deployment onprodhost, but will be reminded once the deployment is successfulTask 3will be mandatory before the deployment on all hosts
Options
Customizing the Gitlab label
set('rcl_gitlab_label', 'Foo list');
Customizing how to get the release version
By default, rcl_release_version is based on input()->getOption('tag').
set('rcl_release_version', get('my_release_version'));
Examples
In case of an uncompleted mandatory task:

Reminder for post-release tasks:

Bonus
Get a slack notification for uncompleted post-release tasks (considering you already configured the slack recipe):
// deploy.php use Deployer\Task\Context; use Deployer\Utility\Httpie; task('rcl:post-release-slack-reminder', function() { if (!get('slack_webhook', false)) { return; } $pendingPostReleaseTasks = get('rcl_pending_post_release_tasks', []); if (count($pendingPostReleaseTasks) === 0) { return; } $text = implode(PHP_EOL, array_map(function($item) { return '- '.$item[1]; }, $pendingPostReleaseTasks)); $host = Context::get()->getHost()->getHostname(); $attachment = [ 'title' => sprintf('[%s][%s] Pending post-release tasks:', $host, get('release_version')), 'text' => $text, 'color' => get('slack_color'), 'mrkdwn_in' => ['text'], ]; Httpie::post(get('slack_webhook'))->body(['attachments' => [$attachment]])->send(); }); after('success', 'rcl:post-release-slack-reminder');
统计信息
- 总下载量: 2.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-01-16
