add option to skip running of already queued build

This commit is contained in:
oleg 2015-12-11 01:26:18 +03:00
parent 89d6484dd7
commit 486d2006c0
2 changed files with 14 additions and 0 deletions

View File

@ -63,6 +63,7 @@ module.exports = function(app) {
app.distributor.run({
projectName: projectName,
withScmChangesOnly: req.body.withScmChangesOnly,
skipQueued: req.body.skipQueued,
initiator: {type: 'httpApi'}
});
} else {

View File

@ -273,6 +273,19 @@ Distributor.prototype.run = function(params, callback) {
return callback();
}
if (params.skipQueued) {
var queuedItem = _(self.queue).find(function(item) {
return item.project.name === project.name;
});
if (queuedItem) {
logger.log(
'Building of "%s" skipped coz it`s already queued',
project.name
);
return callback();
}
}
self._updateBuild({}, {
project: project,
initiator: params.initiator,