mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-03-12 19:30:01 +00:00
run the same project again if we don't reach the latest rev
This commit is contained in:
parent
5428347bfe
commit
827c3d4888
@ -4,8 +4,8 @@ scm:
|
||||
repository: ./test/repos/mercurial
|
||||
rev: default
|
||||
|
||||
# catchRev:
|
||||
# comment: !!js/regexp //
|
||||
catchRev:
|
||||
comment: !!js/regexp //
|
||||
|
||||
notify:
|
||||
on:
|
||||
@ -45,7 +45,7 @@ steps:
|
||||
- cmd: cat 1.txt 2.txt
|
||||
- shell: /bin/bash
|
||||
cmd: >
|
||||
for i in {1..30}; do
|
||||
for i in {1..10}; do
|
||||
echo "tick $i";
|
||||
sleep 0.3;
|
||||
done;
|
||||
|
@ -5,7 +5,8 @@ var Steppy = require('twostep').Steppy,
|
||||
Node = require('./node').Node,
|
||||
EventEmitter = require('events').EventEmitter,
|
||||
inherits = require('util').inherits,
|
||||
notifier = require('./notifier');
|
||||
notifier = require('./notifier'),
|
||||
utils = require('./utils');
|
||||
|
||||
|
||||
function Distributor(params) {
|
||||
@ -97,6 +98,18 @@ Distributor.prototype._runNext = function(callback) {
|
||||
|
||||
executor.once('scmData', function(scmData) {
|
||||
self._updateBuild(build, {scm: scmData});
|
||||
// run the same project again if we don't reach the latest rev
|
||||
if (!scmData.isLatest) {
|
||||
self.run({
|
||||
projectName: build.project.name,
|
||||
initiator: {
|
||||
type: 'build',
|
||||
id: build.id,
|
||||
number: build.number,
|
||||
project: {name: build.project.name}
|
||||
},
|
||||
}, utils.logErrorCallback);
|
||||
}
|
||||
});
|
||||
|
||||
// update wait reasons for all queue items after run
|
||||
|
@ -74,7 +74,7 @@ Executor.prototype._getTarget = function(rev, changes) {
|
||||
|
||||
if (index !== -1) {
|
||||
result.rev = changes[index].id;
|
||||
result.changes = changes.slice(0, index);
|
||||
result.changes = changes.slice(0, index + 1);
|
||||
result.changes.reverse();
|
||||
}
|
||||
|
||||
|
@ -65,16 +65,11 @@ Executor.prototype._getSources = function(params, callback) {
|
||||
this.pass(changes);
|
||||
scm.getRev(params.rev, this.slot());
|
||||
},
|
||||
function(err, rev, changes, latestRev) {
|
||||
// add current rev to the lates changes (if it's not yet there)
|
||||
if (changes.length && changes[0].id !== rev.id) {
|
||||
changes.unshift(rev);
|
||||
}
|
||||
|
||||
function(err, currentRev, changes, latestRev) {
|
||||
this.pass({
|
||||
rev: rev,
|
||||
rev: currentRev,
|
||||
changes: changes,
|
||||
isLatest: changes.length && changes[0].id === latestRev.id
|
||||
isLatest: currentRev.id === latestRev.id
|
||||
});
|
||||
},
|
||||
callback
|
||||
|
Loading…
Reference in New Issue
Block a user