Big update: New way of storing build errors, updated UI, AdminLTE 2, fixes, etc.
This commit is contained in:
parent
9c7a1c7907
commit
7f823b37cf
821 changed files with 164244 additions and 19321 deletions
|
|
@ -28,7 +28,7 @@ class Build extends BuildBase
|
|||
const STATUS_SUCCESS = 2;
|
||||
const STATUS_FAILED = 3;
|
||||
|
||||
public $currentBuildPath = null;
|
||||
public $currentBuildPath;
|
||||
|
||||
/**
|
||||
* Get link to commit from another source (i.e. Github)
|
||||
|
|
@ -213,14 +213,34 @@ class Build extends BuildBase
|
|||
/**
|
||||
* Allows specific build types (e.g. Github) to report violations back to their respective services.
|
||||
* @param Builder $builder
|
||||
* @param $file
|
||||
* @param $line
|
||||
* @param $plugin
|
||||
* @param $message
|
||||
* @return mixed
|
||||
* @param int $severity
|
||||
* @param null $file
|
||||
* @param null $lineStart
|
||||
* @param null $lineEnd
|
||||
* @return BuildError
|
||||
*/
|
||||
public function reportError(Builder $builder, $file, $line, $message)
|
||||
{
|
||||
return array($builder, $file, $line, $message);
|
||||
public function reportError(
|
||||
Builder $builder,
|
||||
$plugin,
|
||||
$message,
|
||||
$severity = BuildError::SEVERITY_NORMAL,
|
||||
$file = null,
|
||||
$lineStart = null,
|
||||
$lineEnd = null
|
||||
) {
|
||||
$error = new BuildError();
|
||||
$error->setBuild($this);
|
||||
$error->setCreatedDate(new \DateTime());
|
||||
$error->setPlugin($plugin);
|
||||
$error->setMessage($message);
|
||||
$error->setSeverity($severity);
|
||||
$error->setFile($file);
|
||||
$error->setLineStart($lineStart);
|
||||
$error->setLineEnd($lineEnd);
|
||||
|
||||
return Factory::getStore('BuildError')->save($error);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -233,7 +253,13 @@ class Build extends BuildBase
|
|||
if (!$this->getId()) {
|
||||
return null;
|
||||
}
|
||||
return PHPCI_BUILD_ROOT_DIR . $this->getId() . '_' . substr(md5(microtime(true)), 0, 5);
|
||||
|
||||
if (empty($this->currentBuildPath)) {
|
||||
$buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5);
|
||||
$this->currentBuildPath = PHPCI_BUILD_ROOT_DIR . $buildDirectory . '/';
|
||||
}
|
||||
|
||||
return $this->currentBuildPath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -249,4 +275,21 @@ class Build extends BuildBase
|
|||
|
||||
exec(sprintf(IS_WIN ? 'rmdir /S /Q "%s"' : 'rm -Rf "%s"', $buildPath));
|
||||
}
|
||||
|
||||
public function getDuration()
|
||||
{
|
||||
$start = $this->getStarted();
|
||||
|
||||
if (empty($start)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$end = $this->getFinished();
|
||||
|
||||
if (empty($end)) {
|
||||
$end = new \DateTime();
|
||||
}
|
||||
|
||||
return $end->getTimestamp() - $start->getTimestamp();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue