mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-22 16:27:39 +01:00
4.4 KiB
4.4 KiB
Cimonitor Recipe
require 'contrib/cimonitor.php';
Monitor your deployments on CIMonitor.
Add tasks on deploy:
before('deploy', 'cimonitor:notify');
after('deploy:success', 'cimonitor:notify:success');
after('deploy:failed', 'cimonitor:notify:failure');
Configuration
cimonitor_webhook
– CIMonitor server webhook url, requiredset('cimonitor_webhook', 'https://cimonitor.enrise.com/webhook/deployer');
cimonitor_title
– the title of application, default the username\reponame combination from{{repository}}
set('cimonitor_title', '');
cimonitor_user
– User object with name and email, default gets information fromgit config
set('cimonitor_user', function () { return [ 'name' => 'John Doe', 'email' => 'john@enrise.com', ]; });
Various cimonitor statusses are set, in case you want to change these yourselves. See the CIMonitor documentation for the usages of different states.
Usage
If you want to notify only about beginning of deployment add this line only:
before('deploy', 'cimonitor:notify');
If you want to notify about successful end of deployment add this too:
after('deploy:success', 'cimonitor:notify:success');
If you want to notify about failed deployment add this too:
after('deploy:failed', 'cimonitor:notify:failure');
Configuration
cimonitor_title
Title of project based on git repo
$repo = get('repository');
$pattern = '/\w+\/\w+/';
return preg_match($pattern, $repo, $titles) ? $titles[0] : $repo;
cimonitor_user
return [
'name' => runLocally('git config --get user.name'),
'email' => runLocally('git config --get user.email'),
];
cimonitor_status_info
CI monitor status states and job states
'info'
cimonitor_status_warning
'warning'
cimonitor_status_error
'error'
cimonitor_status_success
'success'
cimonitor_job_state_info
get('cimonitor_status_info')
cimonitor_job_state_pending
'pending'
cimonitor_job_state_running
'running'
cimonitor_job_state_warning
get('cimonitor_status_warning')
cimonitor_job_state_error
get('cimonitor_status_error')
cimonitor_job_state_success
get('cimonitor_status_success')
Tasks
cimonitor:notify
Notifies CIMonitor.
cimonitor:notify:success
Notifies CIMonitor about deploy finish.
cimonitor:notify:failure
Notifies CIMonitor about deploy failure.