mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Error any execution if the tag is still being built.
This commit is contained in:
+19
-2
@@ -680,6 +680,20 @@ function execute(string $trigger, string $projectId, string $executionId, string
|
||||
|
||||
Authorization::reset();
|
||||
|
||||
if ($tag->getAttribute('status') == 'building') {
|
||||
Console::error('Execution Failed. Reason: Code was still being built.');
|
||||
Authorization::disable();
|
||||
$execution = $database->updateDocument(array_merge($execution->getArrayCopy(), [
|
||||
'tagId' => $tag->getId(),
|
||||
'status' => 'failed',
|
||||
'exitCode' => 1,
|
||||
'stderr' => 'Tag is still being built.', // log last 4000 chars output
|
||||
'time' => 0
|
||||
]));
|
||||
Authorization::reset();
|
||||
throw new Exception('Tag is still being built.');
|
||||
}
|
||||
|
||||
// Check if runtime is active
|
||||
$runtime = (isset($runtimes[$function->getAttribute('runtime', '')]))
|
||||
? $runtimes[$function->getAttribute('runtime', '')]
|
||||
@@ -707,8 +721,6 @@ function execute(string $trigger, string $projectId, string $executionId, string
|
||||
|
||||
$container = 'appwrite-function-' . $tag->getId();
|
||||
|
||||
// Check if code is built
|
||||
|
||||
try {
|
||||
if ($tag->getAttribute('status') !== 'ready') {
|
||||
runBuildStage($tag->getId(), $function, $projectId, $database);
|
||||
@@ -744,6 +756,11 @@ function execute(string $trigger, string $projectId, string $executionId, string
|
||||
'time' => 0
|
||||
]));
|
||||
Authorization::enable();
|
||||
return [
|
||||
'status' => 'failed',
|
||||
'response' => \utf8_encode(\mb_substr($e->getMessage(), -4000)), // log last 4000 chars output
|
||||
'time' => 0
|
||||
];
|
||||
}
|
||||
|
||||
$internalFunction = $activeFunctions->get('appwrite-function-' . $tag->getId());
|
||||
|
||||
Generated
+2
-2
@@ -119,7 +119,7 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PineappleIOnic/php-runtimes.git",
|
||||
"reference": "b8814cdb76dbc06f5aafd1a00d6d01573b3ba9c3"
|
||||
"reference": "35a610b0ae858d514fbfe44bef725a0f83a4f4f3"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.0",
|
||||
@@ -156,7 +156,7 @@
|
||||
"php",
|
||||
"runtimes"
|
||||
],
|
||||
"time": "2021-09-21T09:33:16+00:00"
|
||||
"time": "2021-09-27T14:18:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "chillerlan/php-qrcode",
|
||||
|
||||
Reference in New Issue
Block a user