show current build step

This commit is contained in:
oleg 2015-05-06 02:11:28 +03:00
parent 004b482a06
commit 94629bd27e
5 changed files with 12 additions and 3 deletions

View File

@ -67,6 +67,11 @@ Distributor.prototype._runNext = function(callback) {
});
});
executor.on('currentStep', function(stepName) {
build.currentStep = stepName;
self._updateBuild(build);
});
executor.on('data', function(data) {
self.onBuildData(build, data);
});
@ -76,6 +81,7 @@ Distributor.prototype._runNext = function(callback) {
};
Distributor.prototype._updateBuild = function(build, callback) {
callback = callback || _.noop;
this.onBuildUpdate(build, callback);
};

View File

@ -27,11 +27,13 @@ Executor.prototype.run = function(params, callback) {
project = _({}).extend(self.project, params);
Steppy(
function() {
self.emit('currentStep', 'get sources');
self._getSources(project.scm, this.slot());
},
function() {
var funcs = project.steps.map(function(step) {
var funcs = project.steps.map(function(step, index) {
return function() {
self.emit('currentStep', step.name || ('step ' + index));
self._runStep(step, this.slot());
};
});

View File

@ -7,7 +7,7 @@
},
"steps": [
{"type": "shell", "cmd": "echo \"hello, cur dir is `pwd`\""},
{"type": "shell", "cmd": "sleep 4"},
{"type": "shell", "name": "sleep", "cmd": "sleep 4"},
{"type": "shell", "cmd": "echo 1 > 1.txt"},
{"type": "shell", "cmd": "sleep 4"},
{"type": "shell", "cmd": "echo 2 > 2.txt"},

View File

@ -5,7 +5,7 @@ define(['_dataio'], function(dataio) {
var connect = dataio(socket);
/*
* Extend resource
* Extend Resource
*/
var resource = connect.resource('__someResource__'),
resourcePrototype = Object.getPrototypeOf(resource);

View File

@ -30,6 +30,7 @@ html
| <span>#<%= build.id %></span>
| <span><%= build.project.name %></span>
| <span><%= build.status %></span>
| <span><%= build.currentStep && build.status === 'in-progress' ? '(' + build.currentStep + ')' : '' %></span>
| <span class="js-show-console">&#8631;</span>
| </div>
| <% }); %>