From 45193664abbf4743cc119bf0f1e2f84de310c687 Mon Sep 17 00:00:00 2001 From: oleg Date: Tue, 19 May 2015 23:48:20 +0300 Subject: [PATCH] cmd type is optional now - shell is the default + more info at ui --- data/projects/project1/config.yaml | 18 +++++---------- data/projects/project2/config.json | 8 +++---- lib/distributor.js | 2 +- lib/project.js | 8 +++++++ static/css/sources/components/builds.less | 2 +- static/js/app/components/builds/item.jade | 3 +++ static/js/app/components/builds/view.jade | 28 +++++++++++++++++++++++ static/js/app/components/builds/view.js | 7 ++++-- 8 files changed, 56 insertions(+), 20 deletions(-) diff --git a/data/projects/project1/config.yaml b/data/projects/project1/config.yaml index 0ce3f1e..587821d 100644 --- a/data/projects/project1/config.yaml +++ b/data/projects/project1/config.yaml @@ -7,20 +7,14 @@ scm: rev: default steps: - - type: shell - cmd: > + - cmd: > echo "long multiline string" && sleep 2 && echo "is not a problem when you're using yaml" && echo "cur dir is `pwd`" - - type: shell - name: sleep + - name: sleep cmd: sleep 4 - - type: shell - cmd: echo 1 > 1.txt - - type: shell - cmd: sleep 4 - - type: shell - cmd: echo 2 > 2.txt - - type: shell - cmd: cat 1.txt 2.txt + - cmd: echo 1 > 1.txt + - cmd: sleep 4 + - cmd: echo 2 > 2.txt + - cmd: cat 1.txt 2.txt diff --git a/data/projects/project2/config.json b/data/projects/project2/config.json index 9661323..6c91244 100644 --- a/data/projects/project2/config.json +++ b/data/projects/project2/config.json @@ -6,9 +6,9 @@ "rev": "1" }, "steps": [ - {"type": "shell", "cmd": "echo 11 > 11.txt"}, - {"type": "shell", "cmd": "sleep 4"}, - {"type": "shell", "cmd": "echo 22 > 22.txt"}, - {"type": "shell", "cmd": "cat 11.txt 22.txt"} + {"cmd": "echo 11 > 11.txt"}, + {"cmd": "sleep 4"}, + {"cmd": "echo 22 > 22.txt"}, + {"cmd": "cat 11.txt 22.txt"} ] } \ No newline at end of file diff --git a/lib/distributor.js b/lib/distributor.js index 01d11db..a59f739 100644 --- a/lib/distributor.js +++ b/lib/distributor.js @@ -68,7 +68,7 @@ Distributor.prototype._runNext = function(callback) { { endDate: Date.now(), status: err ? 'error' : 'done', - error: err + error: err ? err.message : null }, function(err, build) { // try to run next project from the queue diff --git a/lib/project.js b/lib/project.js index 78456e1..2c4a9e4 100644 --- a/lib/project.js +++ b/lib/project.js @@ -63,6 +63,14 @@ exports.loadConfig = function(dir, callback) { function() { reader.load(dir, 'config', this.slot()); }, + function(err, config) { + // apply defaults + _(config.steps).each(function(step) { + _(step).defaults({type: 'shell'}); + }); + + this.pass(config); + }, callback ); }; diff --git a/static/css/sources/components/builds.less b/static/css/sources/components/builds.less index afaf332..a5c975b 100644 --- a/static/css/sources/components/builds.less +++ b/static/css/sources/components/builds.less @@ -10,7 +10,7 @@ background: lighten(@brand-success, 50%); } &__error { - background: lighten(@brand-danger, 50%); + background: lighten(@brand-danger, 30%); } &_info { diff --git a/static/js/app/components/builds/item.jade b/static/js/app/components/builds/item.jade index 0b1e7b4..0f24e7f 100644 --- a/static/js/app/components/builds/item.jade +++ b/static/js/app/components/builds/item.jade @@ -8,6 +8,9 @@ mixin statusText(build) if build.status === 'done' span done + if build.status === 'error' + span error + - var build = this.props.build; .build(class="build__#{build.status}") diff --git a/static/js/app/components/builds/view.jade b/static/js/app/components/builds/view.jade index f5b9b8c..151340b 100644 --- a/static/js/app/components/builds/view.jade +++ b/static/js/app/components/builds/view.jade @@ -2,4 +2,32 @@ if this.state.build h2 span Build # span= this.state.build.number + + if this.state.build.startDate + div + | Started at + if this.state.build.startDate + DateTime(date=new Date(this.state.build.startDate)) + else + | - + else + div + | Queued at + if this.state.build.createDate + DateTime(date=new Date(this.state.build.createDate)) + else + | - + + div + | Builded at + if this.state.build.endDate + DateTime(date=new Date(this.state.build.endDate)) + else + | - + + div + if this.state.build.error + | Error: + span= this.state.build.error + Terminal(build=this.state.build.id) diff --git a/static/js/app/components/builds/view.js b/static/js/app/components/builds/view.js index ca3a37f..f0100e5 100644 --- a/static/js/app/components/builds/view.js +++ b/static/js/app/components/builds/view.js @@ -6,11 +6,14 @@ define([ 'app/actions/build', 'app/stores/build', 'app/components/terminal/terminal', - 'templates/app/components/builds/view' + 'templates/app/components/builds/view', + 'app/components/common/index' ], function( - React, Reflux, BuildActions, buildStore, TerminalComponent, template + React, Reflux, BuildActions, buildStore, TerminalComponent, template, + CommonComponents ) { template = template.locals({ + DateTime: CommonComponents.DateTime, Terminal: TerminalComponent });