From 780ae266d6b05a9a0e42b70518809a31e6255c4b Mon Sep 17 00:00:00 2001 From: Jacob Williams Date: Tue, 2 Mar 2021 10:39:22 -0600 Subject: [PATCH] Added 'started' strategy for build notifications --- lib/distributor.js | 1 + lib/notifier/index.js | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/distributor.js b/lib/distributor.js index 1946a91..2305e6c 100644 --- a/lib/distributor.js +++ b/lib/distributor.js @@ -257,6 +257,7 @@ Distributor.prototype._runNext = function(callback) { executor.once('scmData', function(scmData) { self._updateBuild(build, {scm: scmData}); + self.notifier.send(build); // run the same project again if we don't reach the latest rev if (!scmData.isLatest) { self.run({ diff --git a/lib/notifier/index.js b/lib/notifier/index.js index fa690be..97f53c0 100644 --- a/lib/notifier/index.js +++ b/lib/notifier/index.js @@ -89,10 +89,6 @@ Notifier.prototype.send = function(build, callback) { Steppy( function() { - if (!build.completed) { - throw new Error('Build should be completed before notify'); - } - var notify = build.project.notify; // TODO: move to project validation during load @@ -111,7 +107,9 @@ Notifier.prototype.send = function(build, callback) { }, function(err, notify, prevBuild) { var strategy = _(notify.on).find(function(strategy) { - if (strategy === 'done') { + if (strategy === 'started') { + return build.status === 'in-progress'; + } else if (strategy === 'done') { return build.status === 'done'; } else if (strategy === 'error') { return build.status === 'error';