mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-10 17:59:16 +00:00
add build initiator info
This commit is contained in:
parent
944a98947c
commit
37e9d6669e
@ -106,7 +106,13 @@ Distributor.prototype._onBuildComplete = function(err, build, callback) {
|
||||
_(after).each(function(item) {
|
||||
if (!item.status || item.status === build.status) {
|
||||
self.run({
|
||||
projectName: item.project
|
||||
projectName: item.project,
|
||||
initiator: {
|
||||
type: 'build',
|
||||
id: build.id,
|
||||
number: build.number,
|
||||
project: {name: build.project.name}
|
||||
},
|
||||
}, triggerAfterGroup.slot());
|
||||
}
|
||||
});
|
||||
@ -166,6 +172,7 @@ Distributor.prototype.run = function(params, callback) {
|
||||
project = _(self.projects).findWhere({name: params.projectName});
|
||||
self._updateBuild({}, {
|
||||
project: project,
|
||||
initiator: params.initiator,
|
||||
params: params.params,
|
||||
createDate: Date.now(),
|
||||
status: 'queued',
|
||||
|
@ -110,7 +110,10 @@ module.exports = function(app) {
|
||||
resource.use('run', function(req, res) {
|
||||
var projectName = req.data.projectName;
|
||||
console.log('Run the project: %s', projectName);
|
||||
distributor.run({projectName: projectName}, function(err, build) {
|
||||
distributor.run({
|
||||
projectName: projectName,
|
||||
initiator: {type: 'user'}
|
||||
}, function(err, build) {
|
||||
console.log('>>> err, build = ', err && err.stack || err, build);
|
||||
});
|
||||
res.send();
|
||||
|
@ -1,8 +1,19 @@
|
||||
if this.state.build
|
||||
h2
|
||||
span Build #
|
||||
span= this.state.build.project.name
|
||||
span build #
|
||||
span= this.state.build.number
|
||||
|
||||
div
|
||||
| Initiated by
|
||||
- var initiator = this.state.build.initiator;
|
||||
if initiator.type === 'user'
|
||||
span user
|
||||
else if initiator.type === 'build'
|
||||
span= initiator.project.name
|
||||
span build #
|
||||
span= initiator.number
|
||||
|
||||
if this.state.build.startDate
|
||||
div
|
||||
| Started at
|
||||
|
@ -62,7 +62,8 @@ describe('Distributor', function() {
|
||||
it('build should be queued', function() {
|
||||
var changes = updateBuildSpy.getCall(0).args[1];
|
||||
expect(changes).only.have.keys(
|
||||
'project', 'params', 'createDate', 'status', 'completed'
|
||||
'project', 'initiator', 'params', 'createDate', 'status',
|
||||
'completed'
|
||||
);
|
||||
expect(changes.status).equal('queued');
|
||||
expect(changes.completed).equal(false);
|
||||
|
Loading…
Reference in New Issue
Block a user