From 83e62dc6e12630141df7dc5faa5001b6f7f1aa2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 21 May 2025 16:44:04 +0200 Subject: [PATCH] Fix double logs on failure --- .../Platform/Modules/Functions/Workers/Builds.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index cbbe6ee9c3..163623241c 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -1218,13 +1218,22 @@ class Builds extends Action $message .= "\n" . $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', '')) {