Separated Build status constants and Plugin status constants
This commit is contained in:
parent
d54c1978b9
commit
31beb233e3
|
@ -25,7 +25,6 @@ class Build extends Model
|
|||
const STATUS_RUNNING = 1;
|
||||
const STATUS_SUCCESS = 2;
|
||||
const STATUS_FAILED = 3;
|
||||
const STATUS_FAILED_ALLOWED = 4;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
|
|
@ -11,6 +11,11 @@ use PHPCensor\Model\Build;
|
|||
*/
|
||||
abstract class Plugin
|
||||
{
|
||||
const STATUS_PENDING = 0;
|
||||
const STATUS_RUNNING = 1;
|
||||
const STATUS_SUCCESS = 2;
|
||||
const STATUS_FAILED = 3;
|
||||
const STATUS_FAILED_ALLOWED = 4;
|
||||
/**
|
||||
* @var \PHPCensor\Builder
|
||||
*/
|
||||
|
|
|
@ -7,6 +7,7 @@ use Exception;
|
|||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Logging\BuildLogger;
|
||||
use PHPCensor\Model\Build;
|
||||
use PHPCensor\Plugin;
|
||||
use PHPCensor\Store\BuildStore;
|
||||
|
||||
/**
|
||||
|
@ -138,15 +139,15 @@ class Executor
|
|||
'Stage' . ': ' . ucfirst($stage) . ')'
|
||||
);
|
||||
|
||||
$this->setPluginStatus($stage, $plugin, Build::STATUS_RUNNING);
|
||||
$this->setPluginStatus($stage, $plugin, Plugin::STATUS_RUNNING);
|
||||
|
||||
// Try and execute it
|
||||
if ($this->executePlugin($plugin, $options)) {
|
||||
// Execution was successful
|
||||
$this->logger->logSuccess('PLUGIN: SUCCESS');
|
||||
$this->setPluginStatus($stage, $plugin, Build::STATUS_SUCCESS);
|
||||
$this->setPluginStatus($stage, $plugin, Plugin::STATUS_SUCCESS);
|
||||
} else {
|
||||
$status = Build::STATUS_FAILED;
|
||||
$status = Plugin::STATUS_FAILED;
|
||||
|
||||
if ($stage === Build::STAGE_SETUP) {
|
||||
$this->logger->logFailure('PLUGIN: FAILED');
|
||||
|
@ -163,7 +164,7 @@ class Executor
|
|||
$this->logger->logFailure('PLUGIN: FAILED');
|
||||
$success = false;
|
||||
} else {
|
||||
$status = Build::STATUS_FAILED_ALLOWED;
|
||||
$status = Plugin::STATUS_FAILED_ALLOWED;
|
||||
|
||||
$this->logger->logFailure('PLUGIN: FAILED (ALLOWED)');
|
||||
}
|
||||
|
@ -223,9 +224,9 @@ class Executor
|
|||
|
||||
$summary[$stage][$plugin]['status'] = $status;
|
||||
|
||||
if ($status === Build::STATUS_RUNNING) {
|
||||
if ($status === Plugin::STATUS_RUNNING) {
|
||||
$summary[$stage][$plugin]['started'] = time();
|
||||
} elseif ($status >= Build::STATUS_SUCCESS) {
|
||||
} elseif ($status >= Plugin::STATUS_SUCCESS) {
|
||||
$summary[$stage][$plugin]['ended'] = time();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
?>
|
||||
<ul class="timeline">
|
||||
<?php $last = new \DateTime('-1 Year'); ?>
|
||||
|
||||
|
@ -8,25 +13,25 @@
|
|||
$branches = $build->getExtra('branches');
|
||||
|
||||
switch ($build->getStatus()) {
|
||||
case \PHPCensor\Model\Build::STATUS_PENDING:
|
||||
case Build::STATUS_PENDING:
|
||||
$updated = $build->getCreated();
|
||||
$label = Lang::get('pending');
|
||||
$color = 'blue';
|
||||
break;
|
||||
|
||||
case \PHPCensor\Model\Build::STATUS_RUNNING:
|
||||
case Build::STATUS_RUNNING:
|
||||
$updated = $build->getStarted();
|
||||
$label = Lang::get('running');
|
||||
$color = 'yellow';
|
||||
break;
|
||||
|
||||
case \PHPCensor\Model\Build::STATUS_SUCCESS:
|
||||
case Build::STATUS_SUCCESS:
|
||||
$updated = $build->getFinished();
|
||||
$label = Lang::get('success');
|
||||
$color = 'green';
|
||||
break;
|
||||
|
||||
case \PHPCensor\Model\Build::STATUS_FAILED:
|
||||
case Build::STATUS_FAILED:
|
||||
$updated = $build->getFinished();
|
||||
$label = Lang::get('failed');
|
||||
$color = 'red';
|
||||
|
@ -54,7 +59,7 @@
|
|||
<span class="time"><i class="fa fa-clock-o"></i>
|
||||
<?php
|
||||
echo $updated->format('H:i:s');
|
||||
if ($build->getStatus() != \PHPCensor\Model\Build::STATUS_PENDING) {
|
||||
if ($build->getStatus() != Build::STATUS_PENDING) {
|
||||
echo ' (' . $build->getPrettyDuration() . ')';
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<?php use PHPCensor\Helper\Lang; ?>
|
||||
<?php
|
||||
|
||||
use PHPCensor\Helper\Lang;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
?>
|
||||
<script>
|
||||
var DASHBOARD = true;
|
||||
</script>
|
||||
|
@ -34,25 +39,25 @@
|
|||
$branches = $build->getExtra('branches');
|
||||
|
||||
switch ($build->getStatus()) {
|
||||
case \PHPCensor\Model\Build::STATUS_PENDING:
|
||||
case Build::STATUS_PENDING:
|
||||
$updated = $build->getCreated();
|
||||
$label = Lang::get('pending');
|
||||
$color = 'blue';
|
||||
break;
|
||||
|
||||
case \PHPCensor\Model\Build::STATUS_RUNNING:
|
||||
case Build::STATUS_RUNNING:
|
||||
$updated = $build->getStarted();
|
||||
$label = Lang::get('running');
|
||||
$color = 'yellow';
|
||||
break;
|
||||
|
||||
case \PHPCensor\Model\Build::STATUS_SUCCESS:
|
||||
case Build::STATUS_SUCCESS:
|
||||
$updated = $build->getFinished();
|
||||
$label = Lang::get('success');
|
||||
$color = 'green';
|
||||
break;
|
||||
|
||||
case \PHPCensor\Model\Build::STATUS_FAILED:
|
||||
case Build::STATUS_FAILED:
|
||||
$updated = $build->getFinished();
|
||||
$label = Lang::get('failed');
|
||||
$color = 'red';
|
||||
|
@ -80,7 +85,7 @@
|
|||
<span class="time"><i class="fa fa-clock-o"></i>
|
||||
<?php
|
||||
echo $updated->format('H:i:s');
|
||||
if ($build->getStatus() != \PHPCensor\Model\Build::STATUS_PENDING) {
|
||||
if ($build->getStatus() != Build::STATUS_PENDING) {
|
||||
echo ' (' . $build->getPrettyDuration() . ')';
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue