log every build status change

This commit is contained in:
oleg 2015-12-15 20:29:13 +03:00
parent f249a705ad
commit 28b2b15d66

View File

@ -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());
},