From c580b78d915d0acdb4537b2e1f5c40d8b61379e5 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 15:21:32 -0500 Subject: [PATCH 01/82] add deploy hook --- worker.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/worker.js b/worker.js index b118069..9dbbb02 100644 --- a/worker.js +++ b/worker.js @@ -20,6 +20,18 @@ module.exports = { } }) }) + io.on('job.status.deployed', function (id, data){ + hooks.forEach(function (hook) { + context.comment('Firing webhook ' + hook.title) + try { + var payload = hook.prepare(data, job) + io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) + } catch (e) { + context.comment('Failed to prepare webhook payload: ' + e.message); + return + } + }) + }) } }) }, From ee51fa88adcbe77070286f7134921dfa2e3bb16e Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 15:29:54 -0500 Subject: [PATCH 02/82] try to add deploy exit code --- worker.js | 1 + 1 file changed, 1 insertion(+) diff --git a/worker.js b/worker.js index 9dbbb02..b5f1191 100644 --- a/worker.js +++ b/worker.js @@ -25,6 +25,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) + payload.data.deploy_exitcode = 0; io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { context.comment('Failed to prepare webhook payload: ' + e.message); From 114c0e6d3f360dc905430db0f32bced633415faf Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 15:33:12 -0500 Subject: [PATCH 03/82] try to add deploy exit code --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index b5f1191..273abb2 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - payload.data.deploy_exitcode = 0; + payload.deploy_exitcode = 0; io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { context.comment('Failed to prepare webhook payload: ' + e.message); From 23c5ec012ba4c619351db26a28676e35cfa31bfc Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 15:37:39 -0500 Subject: [PATCH 04/82] add deploy exit code --- lib/utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/utils.js b/lib/utils.js index 6686a5b..4013847 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -39,6 +39,7 @@ var DEFAULT_FORMAT = { repo_url: 'job.project.provider.config.url', // results test_exitcode: 'data.exitCode', + deploy_exitcode: 'data.deploy.exitCode' finish_time: 'data.time' } From 42230f2270e0f9085a28484e0f31cd51ed14a424 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 15:40:11 -0500 Subject: [PATCH 05/82] add output for debugging --- worker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 273abb2..ced90db 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,8 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - payload.deploy_exitcode = 0; + context.comment(data); + context.comment(payload); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { context.comment('Failed to prepare webhook payload: ' + e.message); From 1dd82bca50974faeaff572a544612e05b96c0600 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 15:45:16 -0500 Subject: [PATCH 06/82] add logs --- worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker.js b/worker.js index ced90db..c0c509d 100644 --- a/worker.js +++ b/worker.js @@ -13,6 +13,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) + console.log(payload); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { context.comment('Failed to prepare webhook payload: ' + e.message); @@ -25,8 +26,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - context.comment(data); - context.comment(payload); + console.log(payload); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { context.comment('Failed to prepare webhook payload: ' + e.message); From 732c93577946f531438f64e47f4b1b55b1012caa Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 15:47:54 -0500 Subject: [PATCH 07/82] more hacking --- worker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker.js b/worker.js index c0c509d..c774b3a 100644 --- a/worker.js +++ b/worker.js @@ -26,7 +26,8 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - console.log(payload); + payload['deploy_exitcode'] = 0; + console.log(data); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { context.comment('Failed to prepare webhook payload: ' + e.message); From 7978f01f1861aad90c46e5b7f0de486c9c1ee8fc Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 15:51:03 -0500 Subject: [PATCH 08/82] remove logline --- worker.js | 1 - 1 file changed, 1 deletion(-) diff --git a/worker.js b/worker.js index c774b3a..b59d743 100644 --- a/worker.js +++ b/worker.js @@ -13,7 +13,6 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - console.log(payload); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { context.comment('Failed to prepare webhook payload: ' + e.message); From 4954f7e9bdb151a2ac015381777464998cecddd0 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 15:56:10 -0500 Subject: [PATCH 09/82] make exitcode dynamic --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index b59d743..0b08da0 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - payload['deploy_exitcode'] = 0; + payload['deploy_exitcode'] = data.exitCode; console.log(data); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { From 2a7aacaa618e6e10c80188ee90cbc33adde0e118 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 16:32:29 -0500 Subject: [PATCH 10/82] Improve deploy logic --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 0b08da0..3a56e54 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - payload['deploy_exitcode'] = data.exitCode; + payload['deploy_exitcode'] = (data.exitCode) ? 1 : 0; console.log(data); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { From 6cd19d839d3c0dd0373157e182114537150af92a Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 16:45:27 -0500 Subject: [PATCH 11/82] remove deploy exit code --- lib/utils.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 4013847..6686a5b 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -39,7 +39,6 @@ var DEFAULT_FORMAT = { repo_url: 'job.project.provider.config.url', // results test_exitcode: 'data.exitCode', - deploy_exitcode: 'data.deploy.exitCode' finish_time: 'data.time' } From e5f9b1f62fd3e3b6f53a0b17bcc3ddfd86dd0dd9 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 16:47:48 -0500 Subject: [PATCH 12/82] fix logic --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 3a56e54..7b04eec 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - payload['deploy_exitcode'] = (data.exitCode) ? 1 : 0; + payload['deploy_exitcode'] = (data.exitCode) ? 0 : 1; console.log(data); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { From 5104d898d53c8bd3c2c60b401f3152cfccf95791 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 16:51:46 -0500 Subject: [PATCH 13/82] improve logic --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 7b04eec..eb26d31 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - payload['deploy_exitcode'] = (data.exitCode) ? 0 : 1; + payload['deploy_exitcode'] = (data.exitCode === 0) ? 0 : 1; console.log(data); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { From db2dea31ea54d1e8a58a91e60bfeb0a594a00906 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 16:59:58 -0500 Subject: [PATCH 14/82] remove logic --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index eb26d31..0b08da0 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - payload['deploy_exitcode'] = (data.exitCode === 0) ? 0 : 1; + payload['deploy_exitcode'] = data.exitCode; console.log(data); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { From 2a01d0888c1448652d5526d260a19a169db41fc8 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 17:14:18 -0500 Subject: [PATCH 15/82] logic gah --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 0b08da0..749684a 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - payload['deploy_exitcode'] = data.exitCode; + payload['deploy_exitcode'] = return (data.exitCode === 0) ? 0 : 1 ; console.log(data); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { From a4c8d84d95ed40a4b46a144d16242d40c81a0d1d Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 17:16:59 -0500 Subject: [PATCH 16/82] trying to fix --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 749684a..8a88418 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - payload['deploy_exitcode'] = return (data.exitCode === 0) ? 0 : 1 ; + payload['deploy_exitcode'] = return (data.exitCode === 0) ? 0 : 1 console.log(data); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { From 9b51c2c4c14ea8ff0595918200f1dad306004bc4 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 17:18:17 -0500 Subject: [PATCH 17/82] I sux --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 8a88418..70b3bdf 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { context.comment('Firing webhook ' + hook.title) try { var payload = hook.prepare(data, job) - payload['deploy_exitcode'] = return (data.exitCode === 0) ? 0 : 1 + payload['deploy_exitcode'] = (data.exitCode === 0) ? 0 : 1 console.log(data); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { From d2b859a04c876e30d2591b9c7de8683ae560666d Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 19:22:13 -0500 Subject: [PATCH 18/82] Refactor hook callbacks --- worker.js | 59 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/worker.js b/worker.js index 70b3bdf..b8f6231 100644 --- a/worker.js +++ b/worker.js @@ -1,6 +1,37 @@ var utils = require('./lib/utils') +function onTested (id, data){ + io.removeListener('job.status.tested', onTested) + hooks.forEach(function (hook) { + context.comment('Firing webhook ' + hook.title) + try { + var payload = hook.prepare(data, job) + io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) + } catch (e) { + context.comment('Failed to prepare webhook payload: ' + e.message); + return + } + }) +} + +function onDeployed (id, data){ + io.removeListener('job.status.deployed', onDeployed) + hooks.forEach(function (hook) { + context.comment('Firing webhook ' + hook.title) + try { + var payload = hook.prepare(data, job) + payload['deploy_exitcode'] = (data.exitCode === 0) ? 0 : 1 + console.log(data); + io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) + } catch (e) { + context.comment('Failed to prepare webhook payload: ' + e.message); + return + } + }) +} + + module.exports = { // run for each job init: function (config, job, context, cb) { @@ -8,32 +39,8 @@ module.exports = { console.log('init wh', config, hooks) cb(null, { listen: function (io, context) { - io.on('job.status.tested', function (id, data) { - hooks.forEach(function (hook) { - context.comment('Firing webhook ' + hook.title) - try { - var payload = hook.prepare(data, job) - io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) - } catch (e) { - context.comment('Failed to prepare webhook payload: ' + e.message); - return - } - }) - }) - io.on('job.status.deployed', function (id, data){ - hooks.forEach(function (hook) { - context.comment('Firing webhook ' + hook.title) - try { - var payload = hook.prepare(data, job) - payload['deploy_exitcode'] = (data.exitCode === 0) ? 0 : 1 - console.log(data); - io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) - } catch (e) { - context.comment('Failed to prepare webhook payload: ' + e.message); - return - } - }) - }) + io.on('job.status.tested', onTested); + io.on('job.status.deployed', onDeployed) } }) }, From 48804b11464c0bc20bbfa184575d0fd424a41ebe Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 19:27:32 -0500 Subject: [PATCH 19/82] describe which hook is firing in output --- worker.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/worker.js b/worker.js index b8f6231..221fabf 100644 --- a/worker.js +++ b/worker.js @@ -4,7 +4,7 @@ var utils = require('./lib/utils') function onTested (id, data){ io.removeListener('job.status.tested', onTested) hooks.forEach(function (hook) { - context.comment('Firing webhook ' + hook.title) + context.comment('Firing Test webhook ' + hook.title) try { var payload = hook.prepare(data, job) io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) @@ -18,11 +18,10 @@ function onTested (id, data){ function onDeployed (id, data){ io.removeListener('job.status.deployed', onDeployed) hooks.forEach(function (hook) { - context.comment('Firing webhook ' + hook.title) + context.comment('Firing Deploy webhook ' + hook.title) try { var payload = hook.prepare(data, job) payload['deploy_exitcode'] = (data.exitCode === 0) ? 0 : 1 - console.log(data); io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { context.comment('Failed to prepare webhook payload: ' + e.message); From 80b81de06a08e97a9c172d9b07268c2ba179f9f4 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 19:44:21 -0500 Subject: [PATCH 20/82] bring listeners onto scope --- worker.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/worker.js b/worker.js index 221fabf..94e6347 100644 --- a/worker.js +++ b/worker.js @@ -1,19 +1,7 @@ var utils = require('./lib/utils') -function onTested (id, data){ - io.removeListener('job.status.tested', onTested) - hooks.forEach(function (hook) { - context.comment('Firing Test webhook ' + hook.title) - try { - var payload = hook.prepare(data, job) - io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) - } catch (e) { - context.comment('Failed to prepare webhook payload: ' + e.message); - return - } - }) -} + function onDeployed (id, data){ io.removeListener('job.status.deployed', onDeployed) @@ -40,6 +28,20 @@ module.exports = { listen: function (io, context) { io.on('job.status.tested', onTested); io.on('job.status.deployed', onDeployed) + + function onTested (id, data){ + io.removeListener('job.status.tested', onTested) + hooks.forEach(function (hook) { + context.comment('Firing Test webhook ' + hook.title) + try { + var payload = hook.prepare(data, job) + io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) + } catch (e) { + context.comment('Failed to prepare webhook payload: ' + e.message); + return + } + }) +} } }) }, From f719e826c6040434739fdfdd20d029e8f236469c Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 19:51:53 -0500 Subject: [PATCH 21/82] move deployed on io scope --- worker.js | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/worker.js b/worker.js index 94e6347..ab42fb0 100644 --- a/worker.js +++ b/worker.js @@ -13,7 +13,6 @@ function onDeployed (id, data){ io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) } catch (e) { context.comment('Failed to prepare webhook payload: ' + e.message); - return } }) } @@ -30,19 +29,31 @@ module.exports = { io.on('job.status.deployed', onDeployed) function onTested (id, data){ - io.removeListener('job.status.tested', onTested) + io.removeListener('job.status.tested', onTested); hooks.forEach(function (hook) { - context.comment('Firing Test webhook ' + hook.title) - try { - var payload = hook.prepare(data, job) - io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) - } catch (e) { - context.comment('Failed to prepare webhook payload: ' + e.message); - return + context.comment('Firing Test webhook ' + hook.title) + try { + var payload = hook.prepare(data, job) + io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) + } catch (e) { + context.comment('Failed to prepare webhook payload: ' + e.message); + } + }) + } + function onDeployed (id, data){ + io.removeListener('job.status.deployed', onDeployed) + hooks.forEach(function (hook) { + context.comment('Firing Deploy webhook ' + hook.title) + try { + var payload = hook.prepare(data, job) + payload['deploy_exitcode'] = (data.exitCode === 0) ? 0 : 1 + io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) + } catch (e) { + context.comment('Failed to prepare webhook payload: ' + e.message); + } + }) } - }) -} } }) - }, + } } From f9d245ddd05706a3a5ce353d78863c3bb0da6b4b Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 19:52:41 -0500 Subject: [PATCH 22/82] remove unneeded function --- worker.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/worker.js b/worker.js index ab42fb0..48d6191 100644 --- a/worker.js +++ b/worker.js @@ -1,23 +1,6 @@ var utils = require('./lib/utils') - - -function onDeployed (id, data){ - io.removeListener('job.status.deployed', onDeployed) - hooks.forEach(function (hook) { - context.comment('Firing Deploy webhook ' + hook.title) - try { - var payload = hook.prepare(data, job) - payload['deploy_exitcode'] = (data.exitCode === 0) ? 0 : 1 - io.emit('plugin.webhooks.fire', hook.url, hook.secret, payload) - } catch (e) { - context.comment('Failed to prepare webhook payload: ' + e.message); - } - }) -} - - module.exports = { // run for each job init: function (config, job, context, cb) { From a2690f1f5b5b3e63cfa912f2724aed5a5bca2538 Mon Sep 17 00:00:00 2001 From: ProZachJ Date: Sat, 9 Aug 2014 21:00:39 -0500 Subject: [PATCH 23/82] Remove logline --- worker.js | 1 - 1 file changed, 1 deletion(-) diff --git a/worker.js b/worker.js index 48d6191..241f54d 100644 --- a/worker.js +++ b/worker.js @@ -5,7 +5,6 @@ module.exports = { // run for each job init: function (config, job, context, cb) { var hooks = utils.makeWebHooks(config || [], job) - console.log('init wh', config, hooks) cb(null, { listen: function (io, context) { io.on('job.status.tested', onTested); From 69dfece8e3072fbcd64755e518914a7cb5735efe Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 21:40:38 -0500 Subject: [PATCH 24/82] add triggers input --- config/config.html | 1 + 1 file changed, 1 insertion(+) diff --git a/config/config.html b/config/config.html index 7281a0e..91a49cd 100644 --- a/config/config.html +++ b/config/config.html @@ -29,6 +29,7 @@ + - From 454b4c7c6ba5ff98fbeee41440f67ee9010dd8bd Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 22:44:26 -0500 Subject: [PATCH 38/82] add radio buttons --- config/config.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/config.html b/config/config.html index 276f99e..b9b9d92 100644 --- a/config/config.html +++ b/config/config.html @@ -29,7 +29,14 @@ - + + + + diff --git a/config/config.less b/config/config.less index 07d383a..a0a5776 100644 --- a/config/config.less +++ b/config/config.less @@ -19,4 +19,9 @@ fieldset { width: 100%; } + + .icon-remove { + padding-left: 0px; + padding-right: 0px; + } } From e196fc5950d698b4505498f3bb79169d379ee606 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 23:02:53 -0500 Subject: [PATCH 40/82] trying a dropdown --- config/config.html | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/config/config.html b/config/config.html index 7273691..e313736 100644 --- a/config/config.html +++ b/config/config.html @@ -30,12 +30,15 @@ - - + + + + - - - + + + - - - + + + @@ -25,28 +47,7 @@ - -
- - -
-
-
-
@
- -
-
-
- - -
-
- -
- - + From 72f88ab92498eabe1ca2f3f13e9ed51120fd6f21 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 23:24:17 -0500 Subject: [PATCH 45/82] modify css --- config/config.less | 6 ------ 1 file changed, 6 deletions(-) diff --git a/config/config.less b/config/config.less index 9848918..e441fc5 100644 --- a/config/config.less +++ b/config/config.less @@ -1,11 +1,5 @@ #project_config_webhooks { - .input-append { - input { - display: block; - width: 100%; - } - } textarea { width: 100%; From 604490a938e68e759a0c7b99d3a114e25f49d222 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 23:27:06 -0500 Subject: [PATCH 46/82] trying to understand why bootstrap is not inlining --- config/config.html | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/config/config.html b/config/config.html index 490a24b..d695d8c 100644 --- a/config/config.html +++ b/config/config.html @@ -1,4 +1,26 @@
+
+
+ + +
+
+
+
@
+ +
+
+
+ + +
+
+ +
+ +
Webhooks
@@ -16,28 +38,6 @@ See a sample payload.

-
-
- - -
-
-
-
@
- -
-
-
- - -
-
- -
- -
Hook TitleDelet
From aef361def9369b4371f47e70eb8337dabb3a98bf Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 23:34:15 -0500 Subject: [PATCH 47/82] another inline form attempt --- config/config.html | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/config/config.html b/config/config.html index d695d8c..d48b4fa 100644 --- a/config/config.html +++ b/config/config.html @@ -1,25 +1,11 @@
-
-
- - -
-
-
-
@
- -
-
-
- - -
-
- -
- + + + + +
Webhooks From 620cfa36ce7bef9e33ae541af66db1137722eebd Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 23:41:35 -0500 Subject: [PATCH 48/82] more style changes --- config/config.html | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/config/config.html b/config/config.html index d48b4fa..3d869c3 100644 --- a/config/config.html +++ b/config/config.html @@ -1,12 +1,4 @@
-
- - - - -
Webhooks
@@ -35,22 +27,18 @@
- - - - - + + + + + + + + - + - From 6a41da7ea428237bf90d77c331fd9640d95430f2 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 23:48:19 -0500 Subject: [PATCH 51/82] add spaces --- config/config.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.html b/config/config.html index 9494afd..161a1f7 100644 --- a/config/config.html +++ b/config/config.html @@ -32,8 +32,8 @@ + + - + @@ -31,10 +31,14 @@ - - + From e9e4d315dff9ea9b710bddcb7f17485894f4742f Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 23:59:12 -0500 Subject: [PATCH 54/82] add model --- config/config.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.html b/config/config.html index c06b113..6cda564 100644 --- a/config/config.html +++ b/config/config.html @@ -33,10 +33,10 @@ - + @@ -44,7 +44,6 @@ - - - +
Hook Title
- - - - -
From 2589d8b46da9e0d641485ed3c4c3190911be068e Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sat, 9 Aug 2014 23:43:21 -0500 Subject: [PATCH 49/82] close td --- config/config.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.html b/config/config.html index 3d869c3..8f458e4 100644 --- a/config/config.html +++ b/config/config.html @@ -32,8 +32,8 @@ Test Deploy Test DeployTest + Deploy +
Test - Deploy Test   +  Deploy  Test   -  Deploy Test   +  Deploy TargetURL for HTTP Post Shared secret for HMAC-SHA1 signature Hook TriggerDeletDelete
 Test   -  Deploy + + +
+
- -
From 3353a9dfcbd5dcf85395ba61d5c37259ad98c764 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sun, 10 Aug 2014 03:23:25 -0500 Subject: [PATCH 65/82] add tr --- config/config.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.html b/config/config.html index 4d99c8a..ef0d646 100644 --- a/config/config.html +++ b/config/config.html @@ -45,12 +45,14 @@ + + From d015949f6c8a2a74be2548b2a9d6288d9f2849aa Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sun, 10 Aug 2014 03:25:28 -0500 Subject: [PATCH 66/82] nest table --- config/config.html | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/config/config.html b/config/config.html index ef0d646..0f9e525 100644 --- a/config/config.html +++ b/config/config.html @@ -44,15 +44,16 @@ + + +
+ +
- - - - - + From dd134d138c67daa038a4b4e0e2ba3520605b3bed Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sun, 10 Aug 2014 03:26:48 -0500 Subject: [PATCH 67/82] add break --- config/config.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.html b/config/config.html index 0f9e525..124963d 100644 --- a/config/config.html +++ b/config/config.html @@ -43,7 +43,7 @@ - +
-
+ - - - + From 885c03bd05ce99427a854af8674a602837b2cadb Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Sun, 10 Aug 2014 03:33:29 -0500 Subject: [PATCH 69/82] add empty tr as end --- config/config.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/config.html b/config/config.html index cc71de6..17e7926 100644 --- a/config/config.html +++ b/config/config.html @@ -54,7 +54,8 @@ - + + From 0ae6b93893e1e212c782fc3de427a0e3afbc47e0 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Tue, 12 Aug 2014 22:28:46 -0500 Subject: [PATCH 70/82] merge in master --- lib/utils.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 6686a5b..7e46178 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -10,7 +10,7 @@ module.exports = { function fire(url, secret, payload) { var hmac = secret && crypto.createHmac('sha1', secret) - , body = {payload: payload} + , body = {payload: JSON.stringify(payload)} , signature = 'sha1=' if (secret) { hmac.update(qs.stringify(body).toString('utf8')) diff --git a/package.json b/package.json index 7856dcd..7702a7c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "strider-webhooks", - "version": "0.1.0", + "version": "0.1.1", "description": "Enables strider to fire webhooks based on certain events", "main": "webapp.js", "scripts": { From 029ace9df11ce76e0c8687811a43e7a802ef8f55 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 21:25:16 -0500 Subject: [PATCH 71/82] move listener removal from forEach --- worker.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/worker.js b/worker.js index b8ca4c5..6575f5d 100644 --- a/worker.js +++ b/worker.js @@ -12,7 +12,6 @@ module.exports = { function onTested (id, data){ hooks.forEach(function (hook) { if(hook.trigger === 'test'){ - io.removeListener('job.status.tested', onTested); context.comment('Firing Test webhook ' + hook.title) try { var payload = hook.prepare(data, job) @@ -25,15 +24,14 @@ module.exports = { if(job.type === 'TEST_AND_DEPLOY'){ io.on('job.status.deployed', onDeployed) } - io.removeListener('job.status.tested', onTested); } - }) + }); + io.removeListener('job.status.tested', onTested); } function onDeployed (id, data){ hooks.forEach(function (hook) { if(hook.trigger === 'deploy'){ - io.removeListener('job.status.deployed', onDeployed); context.comment('Firing Deploy webhook ' + hook.title) try { var payload = hook.prepare(data, job) @@ -44,6 +42,7 @@ module.exports = { } } }) + io.removeListener('job.status.deployed', onDeployed); } } }) From a5cd3aaf2b404e201fd72e6b595f1482c81dab68 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 21:31:53 -0500 Subject: [PATCH 72/82] refactor deploy listener registration and removal --- worker.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/worker.js b/worker.js index 6575f5d..19c523b 100644 --- a/worker.js +++ b/worker.js @@ -8,7 +8,9 @@ module.exports = { cb(null, { listen: function (io, context) { io.on('job.status.tested', onTested) - + if(job.type = 'TEST_AND_DEPLOY'){ + io.on('job.status.deployed', onDeployed) + } function onTested (id, data){ hooks.forEach(function (hook) { if(hook.trigger === 'test'){ @@ -20,13 +22,11 @@ module.exports = { context.comment('Failed to prepare webhook payload: ' + e.message); } } - else if(hook.trigger === 'deploy'){ - if(job.type === 'TEST_AND_DEPLOY'){ - io.on('job.status.deployed', onDeployed) - } - } }); io.removeListener('job.status.tested', onTested); + if (data.exitCode !== 0 && job.type === 'TEST_AND_DEPLOY'){ + io.removeListener('job.status.deployed', onDeployed); + } } function onDeployed (id, data){ From dd80c2b732c04e269ea2aaa716718d6ebbe4fab8 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 22:06:57 -0500 Subject: [PATCH 73/82] debugging --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 19c523b..f0eadfb 100644 --- a/worker.js +++ b/worker.js @@ -9,7 +9,7 @@ module.exports = { listen: function (io, context) { io.on('job.status.tested', onTested) if(job.type = 'TEST_AND_DEPLOY'){ - io.on('job.status.deployed', onDeployed) + //io.on('job.status.deployed', onDeployed) } function onTested (id, data){ hooks.forEach(function (hook) { From 116a5ccb74a0798a0ed5ba5a50dbd674be30e43f Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 22:12:05 -0500 Subject: [PATCH 74/82] more debug --- worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker.js b/worker.js index f0eadfb..cc555b2 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { }); io.removeListener('job.status.tested', onTested); if (data.exitCode !== 0 && job.type === 'TEST_AND_DEPLOY'){ - io.removeListener('job.status.deployed', onDeployed); + //io.removeListener('job.status.deployed', onDeployed); } } @@ -42,7 +42,7 @@ module.exports = { } } }) - io.removeListener('job.status.deployed', onDeployed); + //io.removeListener('job.status.deployed', onDeployed); } } }) From a6a790c4c041ef837576934d5622757127d10ac2 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 22:15:14 -0500 Subject: [PATCH 75/82] bring deploy listener removal back in. --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index cc555b2..7e077e2 100644 --- a/worker.js +++ b/worker.js @@ -25,7 +25,7 @@ module.exports = { }); io.removeListener('job.status.tested', onTested); if (data.exitCode !== 0 && job.type === 'TEST_AND_DEPLOY'){ - //io.removeListener('job.status.deployed', onDeployed); + io.removeListener('job.status.deployed', onDeployed); } } From 16dbf0ce30b8a6a3c4955834d28aefe461b5927c Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 22:23:10 -0500 Subject: [PATCH 76/82] add log jobtype --- worker.js | 1 + 1 file changed, 1 insertion(+) diff --git a/worker.js b/worker.js index 7e077e2..2984848 100644 --- a/worker.js +++ b/worker.js @@ -8,6 +8,7 @@ module.exports = { cb(null, { listen: function (io, context) { io.on('job.status.tested', onTested) + console.log(job.type); if(job.type = 'TEST_AND_DEPLOY'){ //io.on('job.status.deployed', onDeployed) } From 7fc40957b1e9475d0656eb7ceb1eb1269ebd9e80 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 22:24:20 -0500 Subject: [PATCH 77/82] fix conditional assignment --- worker.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/worker.js b/worker.js index 2984848..c451c67 100644 --- a/worker.js +++ b/worker.js @@ -8,8 +8,7 @@ module.exports = { cb(null, { listen: function (io, context) { io.on('job.status.tested', onTested) - console.log(job.type); - if(job.type = 'TEST_AND_DEPLOY'){ + if(job.type === 'TEST_AND_DEPLOY'){ //io.on('job.status.deployed', onDeployed) } function onTested (id, data){ From e84a918de031ce610772502c6eaccd0f03a47e5b Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 22:25:38 -0500 Subject: [PATCH 78/82] uncomment listener removal. --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index c451c67..e3a73b7 100644 --- a/worker.js +++ b/worker.js @@ -42,7 +42,7 @@ module.exports = { } } }) - //io.removeListener('job.status.deployed', onDeployed); + io.removeListener('job.status.deployed', onDeployed); } } }) From 0d2566be6375e791818635a380cc67bc8e1c291a Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 22:27:14 -0500 Subject: [PATCH 79/82] uncomment listener addition --- worker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worker.js b/worker.js index e3a73b7..4b20c66 100644 --- a/worker.js +++ b/worker.js @@ -9,7 +9,7 @@ module.exports = { listen: function (io, context) { io.on('job.status.tested', onTested) if(job.type === 'TEST_AND_DEPLOY'){ - //io.on('job.status.deployed', onDeployed) + io.on('job.status.deployed', onDeployed) } function onTested (id, data){ hooks.forEach(function (hook) { From ab5485751dd192513195d46868be18bac815a33c Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 22:29:44 -0500 Subject: [PATCH 80/82] more debug --- worker.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/worker.js b/worker.js index 4b20c66..84bfd23 100644 --- a/worker.js +++ b/worker.js @@ -9,6 +9,7 @@ module.exports = { listen: function (io, context) { io.on('job.status.tested', onTested) if(job.type === 'TEST_AND_DEPLOY'){ + console.log('register deploy listener') io.on('job.status.deployed', onDeployed) } function onTested (id, data){ @@ -25,6 +26,7 @@ module.exports = { }); io.removeListener('job.status.tested', onTested); if (data.exitCode !== 0 && job.type === 'TEST_AND_DEPLOY'){ + console.log('remove deploy listener') io.removeListener('job.status.deployed', onDeployed); } } @@ -42,6 +44,7 @@ module.exports = { } } }) + console.log('remove deploy listen') io.removeListener('job.status.deployed', onDeployed); } } From f6d9fecd041880e7747dc5959db8b3d17f06ccc0 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Wed, 13 Aug 2014 22:32:14 -0500 Subject: [PATCH 81/82] remove logging --- worker.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/worker.js b/worker.js index 84bfd23..4b20c66 100644 --- a/worker.js +++ b/worker.js @@ -9,7 +9,6 @@ module.exports = { listen: function (io, context) { io.on('job.status.tested', onTested) if(job.type === 'TEST_AND_DEPLOY'){ - console.log('register deploy listener') io.on('job.status.deployed', onDeployed) } function onTested (id, data){ @@ -26,7 +25,6 @@ module.exports = { }); io.removeListener('job.status.tested', onTested); if (data.exitCode !== 0 && job.type === 'TEST_AND_DEPLOY'){ - console.log('remove deploy listener') io.removeListener('job.status.deployed', onDeployed); } } @@ -44,7 +42,6 @@ module.exports = { } } }) - console.log('remove deploy listen') io.removeListener('job.status.deployed', onDeployed); } } From 7ead02353f87af842bdcabb084f1b467a926df20 Mon Sep 17 00:00:00 2001 From: Zach Jones Date: Thu, 14 Aug 2014 00:42:52 -0500 Subject: [PATCH 82/82] add comments --- worker.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/worker.js b/worker.js index 4b20c66..9133508 100644 --- a/worker.js +++ b/worker.js @@ -8,9 +8,12 @@ module.exports = { cb(null, { listen: function (io, context) { io.on('job.status.tested', onTested) + + // add deploy listener if job will be deploying if(job.type === 'TEST_AND_DEPLOY'){ io.on('job.status.deployed', onDeployed) } + function onTested (id, data){ hooks.forEach(function (hook) { if(hook.trigger === 'test'){ @@ -23,7 +26,9 @@ module.exports = { } } }); + //always remove test listener io.removeListener('job.status.tested', onTested); + //remove deploy listener if tests failed and one was registered if (data.exitCode !== 0 && job.type === 'TEST_AND_DEPLOY'){ io.removeListener('job.status.deployed', onDeployed); } @@ -42,6 +47,7 @@ module.exports = { } } }) + //always remove deploy listener io.removeListener('job.status.deployed', onDeployed); } }