The idea around these recipes is to make tedious tasks easier, and the idea around chat integration is to notify everyone on the team when someone is doing something to production.
The 5 steps that should go into a chatroom is: Starting deploy, Successful deploy, Failed deploy, Attempting Rollback, Successful Rollback.
We've had a custom setup for notifying Hipchat for the above stages. This was a simple 22 lines of code, everything in the deploy.php file. Now, using the recipe for Hipchat, the simplest solution I could find increases that to 32 lines of code, and that excludes the part doing the notification. This is what I've ended up with:
// Hipchat
set('hipchat_token', '##########');
set('hipchat_room_id', 'RoomId');
set('hipchat_url', 'https://our.internal.hipchat.url.com/v1/rooms/message');
task('hipchat:prepare', function() {
set('hipchat_color', 'yellow');
set('hipchat_message', 'STARTING: {{user}} started deploying {{application}} from {{branch}} to {{target}}');
});
before('deploy:prepare', 'hipchat:prepare');
after('hipchat:prepare', 'hipchat:notify');
task('hipchat:success', function() {
set('hipchat_color', 'green');
set('hipchat_message', 'SUCCESS: {{user}} successfully deployed {{application}} from {{branch}} to {{target}}');
});
after('success', 'hipchat:success');
after('hipchat:success', 'hipchat:notify');
task('hipchat:fail', function() {
set('hipchat_color', 'red');
set('hipchat_message', 'FAILED: {{user}} failed to deploy {{application}} from {{branch}} to {{target}}');
});
after('deploy:failed', 'hipchat:fail');
after('hipchat:fail', 'hipchat:notify');
task('hipchat:rolling-back', function() {
set('hipchat_color', 'red');
set('hipchat_message', 'ROLLING BACK: {{user}} is rolling back {{application}} on {{target}}');
});
before('rollback', 'hipchat:rolling-back');
after('hipchat:rolling-back', 'hipchat:notify');
task('hipchat:rolled-back', function() {
set('hipchat_color', 'purple');
set('hipchat_message', 'ROLLED BACK: {{user}} successfully rolled back {{application}} on {{target}}');
});
after('rollback', 'hipchat:rolled-back');
after('hipchat:rolled-back', 'hipchat:notify');
Am I missing something, or can we work together to find a way to make this simpler?
before('deploy:prepare', 'hipchat:notify', [
'hipchat_color' => 'green',
'hipchat_message' => 'SUCCESS: {{user}} successfully deployed {{application}} from {{branch}} to {{target}}',
]);
Another idea is to setup these 5 functions in the recipe, with maybe an env var of: set('hipchat_notify_all');
Let me know what you think, will be happy to help implement these.