mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 08:28:42 +00:00
Fix double logs on failure
This commit is contained in:
parent
341775de2e
commit
83e62dc6e1
1 changed files with 10 additions and 1 deletions
|
|
@ -1218,13 +1218,22 @@ class Builds extends Action
|
|||
$message .= "\n[31m" . $error;
|
||||
}
|
||||
|
||||
// Combine with previous logs if deployment got past build process
|
||||
$previousLogs = '';
|
||||
if (!empty($deployment->getAttribute('buildEndedAt', ''))) {
|
||||
$previousLogs = $deployment->getAttribute('buildLogs', '');
|
||||
if (!empty($previousLogs)) {
|
||||
$message = $previousLogs . "\n" . $message;
|
||||
}
|
||||
}
|
||||
|
||||
$endTime = DateTime::now();
|
||||
$durationEnd = \microtime(true);
|
||||
$deployment->setAttribute('buildEndedAt', $endTime);
|
||||
$deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart)));
|
||||
$deployment->setAttribute('status', 'failed');
|
||||
$deployment->setAttribute('buildLogs', $deployment->getAttribute('buildLogs', '') . "\n" . $message);
|
||||
|
||||
$deployment->setAttribute('buildLogs', $message);
|
||||
$deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment);
|
||||
|
||||
if ($deployment->getInternalId() === $resource->getAttribute('latestDeploymentInternalId', '')) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue