docs/contrib/cimonitor.md
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');
cimonitor_webhook – CIMonitor server webhook url, required
set('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 from git config
set('cimonitor_user', function () {
return [
'name' => 'John Doe',
'email' => '[email protected]',
];
});
Various cimonitor statusses are set, in case you want to change these yourselves. See the CIMonitor documentation for the usages of different states.
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');
Title of project based on git repo
$repo = get('repository');
$pattern = '/\w+\/\w+/';
return preg_match($pattern, $repo, $titles) ? $titles[0] : $repo;
return [
'name' => runLocally('git config --get user.name'),
'email' => runLocally('git config --get user.email'),
];
CI monitor status states and job states
'info'
'warning'
'error'
'success'
get('cimonitor_status_info')
'pending'
'running'
get('cimonitor_status_warning')
get('cimonitor_status_error')
get('cimonitor_status_success')
Notifies CIMonitor.
Notifies CIMonitor about deploy finish.
Notifies CIMonitor about deploy failure.