diff --git a/app/executor.php b/app/executor.php index 7e83a6fc7..54936917d 100644 --- a/app/executor.php +++ b/app/executor.php @@ -495,6 +495,11 @@ function runBuildStage(string $tagID, Document $function, string $projectID, Dat 'buildStderr' => $buildStderr, ])); Authorization::enable(); + + // also remove the container if it exists + if ($id) { + $orchestration->remove($id, true); + } } return $tag; @@ -559,6 +564,11 @@ function createRuntimeServer(string $functionId, string $projectId, Document $ta $activeFunctions->del($container); } + // Check if tag hasn't failed + if ($tag->getAttribute('status') == 'failed') { + throw new Exception('Tag build failed, please check your logs.', 500); + } + // Check if tag is built yet. if ($tag->getAttribute('status') !== 'ready') { throw new Exception('Tag is not built yet', 500); @@ -788,6 +798,7 @@ function execute(string $trigger, string $projectId, string $executionId, string $executionStart = \microtime(true); $exitCode = 0; + $statusCode = 200; $errNo = -1; $attempts = 0; @@ -824,6 +835,8 @@ function execute(string $trigger, string $projectId, string $executionId, string $executorResponse = \curl_exec($ch); + $statusCode = \curl_getinfo($ch, CURLINFO_HTTP_CODE); + $error = \curl_error($ch); $errNo = \curl_errno($ch); diff --git a/composer.lock b/composer.lock index 814d58497..53e7296a8 100644 --- a/composer.lock +++ b/composer.lock @@ -119,7 +119,7 @@ "source": { "type": "git", "url": "https://github.com/PineappleIOnic/php-runtimes.git", - "reference": "47c963761d26c7f369c9a8a76e2a050eb009b479" + "reference": "fd85bad3c975ccfe4e7f35bafbc8c606fc3fdf79" }, "require": { "php": ">=8.0", @@ -156,7 +156,7 @@ "php", "runtimes" ], - "time": "2021-09-28T12:46:04+00:00" + "time": "2021-09-29T15:50:27+00:00" }, { "name": "chillerlan/php-qrcode",