Fix: managing deployment failure

This commit is contained in:
2015-11-25 16:01:41 +00:00
parent e135c5d2c6
commit 75c0ec650c
7 changed files with 86 additions and 18 deletions

View File

@@ -24,3 +24,4 @@ zenorocha:clipboard
simple:reactive-method
vsivsi:job-collection
ogamedia:timer
less

View File

@@ -41,6 +41,7 @@ iron:router@1.0.12
iron:url@1.0.11
jquery@1.11.4
launch-screen@1.0.4
less@2.5.1
livedata@1.0.15
logging@1.0.8
meteor@1.1.10

41
client/custom.less Normal file
View File

@@ -0,0 +1,41 @@
// http://codepen.io/quickstep25/pen/BNOJXK
// OPTIONAL WELL STYLES
// VARS
@state-primary-bg: darken(#428bca, 6.5%);
@state-success-bg: #dff0d8;
@state-info-bg: #d9edf7;
@state-warning-bg: #fcf8e3;
@state-danger-bg: #f2dede;
// MIXINS - SHADOWS
.box-shadow(@arguments: none) {
-webkit-box-shadow: @arguments;
-moz-box-shadow: @arguments;
box-shadow: @arguments;
}
// MIXINS - GRADIENT BACKGROUND
.vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {
background: @start-color;
background-image: -moz-linear-gradient(left, @start-color @start-percent, @end-color @end-percent);
background-image: -webkit-linear-gradient(top, @start-color @start-percent, @end-color @end-percent);
background-image: -ms-linear-gradient(top, @start-color @start-percent, @end-color @end-percent);
background-image: -o-linear-gradient(top, @start-color @start-percent, @end-color @end-percent);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(@start-percent, @start-color), color-stop(@end-percent, @end-color));
background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent);
}
// MIXINS - BOOTSTRAP - WELL VARIANT OVERRIDE
.well-variant(@state; @bg) {
.well.bg-@{state} {
color: darken(@bg, 65%);
background-color: @bg;
.vertical(@start-color: darken(@bg, 5%); @end-color: @bg);
border-color: darken(@bg, 10%);
@shadow: inset 0 1px 3px rgba(0,0,0,.05), 0 1px 0 rgba(255,255,255,.1);
.box-shadow(@shadow);
}
}
// WELLS - CONTEXTUAL BACKGROUNDS
.well-variant(primary; @state-primary-bg);
.well-variant(success; @state-success-bg);
.well-variant(info; @state-info-bg);
.well-variant(warning; @state-warning-bg);
.well-variant(danger; @state-danger-bg);

View File

@@ -10,7 +10,20 @@ Template.deploymentDetails.helpers({
},
running: function() {
var string = this.status;
if( !string ) {
return '';
}
return string.charAt(0).toUpperCase() + string.slice(1);
},
deployment_status: function() {
switch( this.status ) {
case 'closed' :
return this.output[this.output.length - 1].error ? 'bg-danger' : 'bg-success';
case 'pending' :
return 'bg-info';
default :
return 'bg-default';
}
}
});

View File

@@ -39,10 +39,10 @@
<template name="deploymentDetails">
<div role="tabpanel" class="tab-pane" id="collapseDeployment{{index}}">
<div class="well">
<div class="well well-sm {{deployment_status}}">
<h4>Deployment # {{index}} - {{tm_cal timestamp}}</h4>
{{#each output}}
<p>
<p class="{{error}}">
<samp>{{{format}}}</samp>
</p>
{{/each}}

View File

@@ -17,6 +17,7 @@ Job.processJobs('projectDeployerJobQueue', 'create_repository',
}
},
function() {
DeploymentService.update_status(deployment._id, 'closed', callback);
if( callback ) {
callback();
}
@@ -61,6 +62,7 @@ Job.processJobs('projectDeployerJobQueue', 'update_repository',
}
},
function() {
DeploymentService.update_status(deployment._id, 'closed', callback);
if( callback ) {
callback();
}

View File

@@ -5,14 +5,16 @@ var exec = Npm.require('child_process').exec,
exec(cmd,
options,
Meteor.bindEnvironment(
function(error, stdout, stderr) {
function(errors, stdout, stderr) {
if( stdout !== '' ) {
stdoutHandler(stdout);
}
if( stderr != '' ) {
stderrHandler(stderr);
} else if( errors ) {
stderrHandler('Internal error');
}
callback();
callback(errors);
}
)
);
@@ -40,7 +42,15 @@ CommandRunner = {
options.cwd = replace(options.cwd, customs);
execSync(command, options, bundle.stdout, bundle.stderr, function() {
execSync(command, options, bundle.stdout, bundle.stderr, function(errors) {
if( errors ) {
if( callback ) {
return callback();
} else {
return;
}
}
bundle.counter++;
if( bundle.counter >= bundle.script.length ) {
if( bundle.deploy_script && bundle.project.commands ) {
@@ -49,12 +59,8 @@ CommandRunner = {
bundle.counter = 0;
CommandRunner.commands(bundle, callback);
} else if( callback ) {
if( bundle.deployment ) {
DeploymentService.update_status(bundle.deployment._id, 'closed', callback);
} else {
callback();
}
}
} else {
CommandRunner.run(bundle, callback);
}
@@ -68,14 +74,18 @@ CommandRunner = {
cwd: replace('%ROOT_CWD%/%CWD%', customs)
};
execSync(command, options, bundle.stdout, bundle.stderr, function() {
execSync(command, options, bundle.stdout, bundle.stderr, function(errors) {
if( errors ) {
if( callback ) {
return callback();
} else {
return;
}
}
bundle.counter++;
if( bundle.counter >= bundle.script.length ) {
if( bundle.deployment ) {
DeploymentService.update_status(bundle.deployment._id, 'closed', callback);
} else {
callback();
}
} else {
CommandRunner.commands(bundle, callback);
}