Adding a formatted email for build fails
This commit is contained in:
parent
e6ef498db4
commit
73abea2485
|
@ -9,6 +9,7 @@
|
|||
|
||||
namespace PHPCI\Plugin;
|
||||
|
||||
use b8\View;
|
||||
use PHPCI\Builder;
|
||||
use PHPCI\Model\Build;
|
||||
|
||||
|
@ -84,10 +85,16 @@ class Email implements \PHPCI\Plugin
|
|||
sprintf("Log Output: <br><pre>%s</pre>", $logText)
|
||||
);
|
||||
} else {
|
||||
$view = new View('Email/failed');
|
||||
$view->build = $this->build;
|
||||
$view->project = $this->build->getProject();
|
||||
|
||||
$emailHtml = $view->render();
|
||||
|
||||
$sendFailures = $this->sendSeparateEmails(
|
||||
$addresses,
|
||||
sprintf($subjectTemplate, $projectName, "Failing Build"),
|
||||
sprintf("Log Output: <br><pre>%s</pre>", $logText)
|
||||
$emailHtml
|
||||
);
|
||||
}
|
||||
|
||||
|
|
13
PHPCI/View/Email/failed.phtml
Normal file
13
PHPCI/View/Email/failed.phtml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<div style="background: #900; padding: 25px;">
|
||||
<div style="background: #fff; padding: 15px; border-radius: 5px">
|
||||
<div style="font-family: arial, verdana, sans-serif; font-size: 25px; margin-bottom: 15px">
|
||||
<?= $project->getTitle(); ?> - Build #<?= $build->getId(); ?>
|
||||
</div>
|
||||
|
||||
<div style="font-family: arial, verdana, sans-serif; font-size: 15px">
|
||||
<p>Your commit <strong><?= $build->getCommitId(); ?></strong> caused a failed build in project <strong><?= $project->getTitle(); ?></strong>.</p>
|
||||
|
||||
<p>Please review <a href="<?= $build->getCommitLink(); ?>">your commit</a> and the <a href="<?= PHPCI_URL . 'build/view/' . $build->getId(); ?>">build log</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in a new issue