From 28b2b15d66f9db5747869045488a8b58094d2678 Mon Sep 17 00:00:00 2001 From: oleg Date: Tue, 15 Dec 2015 20:29:13 +0300 Subject: [PATCH] log every build status change --- lib/distributor.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/distributor.js b/lib/distributor.js index 81848f8..780ef0b 100644 --- a/lib/distributor.js +++ b/lib/distributor.js @@ -182,10 +182,21 @@ Distributor.prototype._onBuildComplete = function(build, callback) { Distributor.prototype._updateBuild = function(build, changes, callback) { var self = this; callback = callback || _.noop; - var isWithNumber = Boolean(build.number); + var isWithId = Boolean(build.id), + isWithNumber = Boolean(build.number); Steppy( function() { + if (build.id && changes.status && changes.status !== build.status) { + logger.log( + 'Build #%s (project "%s") change status: %s -> %s', + build.id, + build.project.name, + build.status, + changes.status + ); + } + _(build).extend(changes); // skip saving to db of unimportant data @@ -196,6 +207,14 @@ Distributor.prototype._updateBuild = function(build, changes, callback) { } }, function() { + if (!isWithId && build.id) { + logger.log( + 'Build #%s (project "%s") %s', + build.id, + build.project.name, + build.status + ); + } // if number appear after save to db then add it to changes // TODO: might be better to generate number right there (instead @@ -296,11 +315,6 @@ Distributor.prototype.run = function(params, callback) { }, this.slot()); }, function(err, build) { - logger.log( - 'Queue build #%s (project "%s")', - build.id, - build.project.name - ); self.queue.push({project: project, build: build}); self._runNext(this.slot()); },