mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-11 02:05:09 +00:00
provide scm info for build
This commit is contained in:
parent
da580dd813
commit
39786933de
@ -6,10 +6,10 @@ work in progress...
|
||||
|
||||
## TODO for release 1.0
|
||||
|
||||
* Dashboard(builds list, projects autocomlete)
|
||||
* Dashboard (builds list, projects autocomlete)
|
||||
* Build page (build info, console)
|
||||
* Url for trigger build run
|
||||
* YAML project configs
|
||||
* YAML project and server(executors count, etc) configs
|
||||
* Persistent builds
|
||||
* Project relations (blocks, triggers, etc)
|
||||
* Mail and jabber notifications (with commits, current step and error)
|
||||
|
@ -51,6 +51,7 @@ Distributor.prototype._runNext = function(callback) {
|
||||
var queueItem = self.queue[queueItemIndex];
|
||||
this.pass(queueItemIndex, queueItem);
|
||||
|
||||
queueItem.build.startDate = Date.now();
|
||||
queueItem.build.status = 'in-progress';
|
||||
self._updateBuild(queueItem.build, this.slot());
|
||||
},
|
||||
@ -59,6 +60,7 @@ Distributor.prototype._runNext = function(callback) {
|
||||
|
||||
var stepCallback = this.slot();
|
||||
var executor = node.run(queueItem.project, build.params, function(err) {
|
||||
build.endDate = Date.now();
|
||||
build.status = err ? 'error' : 'done';
|
||||
build.error = err;
|
||||
self._updateBuild(build, function(err, build) {
|
||||
@ -75,6 +77,11 @@ Distributor.prototype._runNext = function(callback) {
|
||||
executor.on('data', function(data) {
|
||||
self.onBuildData(build, data);
|
||||
});
|
||||
|
||||
executor.once('scmData', function(scmData) {
|
||||
build.scm = scmData;
|
||||
self._updateBuild(build);
|
||||
});
|
||||
},
|
||||
callback
|
||||
);
|
||||
|
@ -31,7 +31,8 @@ Executor.prototype.run = function(params, callback) {
|
||||
self.emit('currentStep', 'get sources');
|
||||
self._getSources(project.scm, this.slot());
|
||||
},
|
||||
function() {
|
||||
function(err, scmData) {
|
||||
self.emit('scmData', scmData);
|
||||
var funcs = project.steps.map(function(step, index) {
|
||||
return function() {
|
||||
var stepLabel = step.name || utils.prune(step.cmd, 15);
|
||||
|
@ -18,7 +18,7 @@ exports.Executor = Executor;
|
||||
|
||||
Executor.prototype._getSources = function(params, callback) {
|
||||
var self = this,
|
||||
scm, isFirstRun;
|
||||
scm, isFirstRun, oldRev;
|
||||
Steppy(
|
||||
function() {
|
||||
var slot = this.slot();
|
||||
@ -36,6 +36,16 @@ Executor.prototype._getSources = function(params, callback) {
|
||||
isFirstRun = true;
|
||||
}
|
||||
scm = createScm(scmParams);
|
||||
|
||||
if (isFirstRun) {
|
||||
this.pass(null);
|
||||
} else {
|
||||
scm.getCurrent(this.slot());
|
||||
}
|
||||
},
|
||||
function(err, id) {
|
||||
oldRev = id;
|
||||
|
||||
if (isFirstRun) {
|
||||
scm.clone(self.cwd, params.rev, this.slot());
|
||||
} else {
|
||||
@ -49,6 +59,13 @@ Executor.prototype._getSources = function(params, callback) {
|
||||
this.pass(null);
|
||||
}
|
||||
},
|
||||
function() {
|
||||
scm.getCurrent(this.slot());
|
||||
scm.getChanges(oldRev && oldRev.id, params.rev, this.slot());
|
||||
},
|
||||
function(err, rev, changes) {
|
||||
this.pass({rev: rev, changes: changes});
|
||||
},
|
||||
callback
|
||||
);
|
||||
};
|
||||
|
@ -46,8 +46,18 @@ var expect = require('expect.js'),
|
||||
});
|
||||
});
|
||||
|
||||
it('should run', function(done) {
|
||||
executor.run({}, done);
|
||||
it('should run', function() {
|
||||
executor.run({}, function(err) {
|
||||
expect(err).not.ok();
|
||||
});
|
||||
});
|
||||
|
||||
it('should emit scm data', function(done) {
|
||||
executor.on('scmData', function(scmData) {
|
||||
expect(scmData).have.keys('rev', 'changes');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user