diff --git a/app/config/errors.php b/app/config/errors.php index bf0c6a04e..66178bcf7 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -543,7 +543,7 @@ return [ ], Exception::BUILD_ALREADY_COMPLETED => [ 'name' => Exception::BUILD_ALREADY_COMPLETED, - 'description' => 'Build with the requested ID is already completed and cannot be cancelled.', + 'description' => 'Build with the requested ID is already completed and cannot be canceled.', 'code' => 400, ], diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 64249e606..f0e75d3b9 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -1532,7 +1532,7 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId/build') 'startTime' => DateTime::now(), 'deploymentInternalId' => $deployment->getInternalId(), 'deploymentId' => $deployment->getId(), - 'status' => 'cancelled', + 'status' => 'canceled', 'path' => '', 'runtime' => $function->getAttribute('runtime'), 'source' => $deployment->getAttribute('path', ''), @@ -1558,7 +1558,7 @@ App::patch('/v1/functions/:functionId/deployments/:deploymentId/build') $build = $dbForProject->updateDocument('builds', $build->getId(), $build->setAttributes([ 'endTime' => DateTime::now(), 'duration' => $duration, - 'status' => 'cancelled' + 'status' => 'canceled' ])); } diff --git a/src/Appwrite/Platform/Workers/Builds.php b/src/Appwrite/Platform/Workers/Builds.php index f11ac5016..02ca13ae8 100644 --- a/src/Appwrite/Platform/Workers/Builds.php +++ b/src/Appwrite/Platform/Workers/Builds.php @@ -181,8 +181,8 @@ class Builds extends Action $deployment->setAttribute('buildId', $build->getId()); $deployment->setAttribute('buildInternalId', $build->getInternalId()); $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); - } elseif ($build->getAttribute('status') === 'cancelled') { - Console::info('Build has been cancelled'); + } elseif ($build->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); return; } else { $build = $dbForProject->getDocument('builds', $buildId); @@ -226,8 +226,8 @@ class Builds extends Action $stderr = ''; Console::execute('mkdir -p /tmp/builds/' . \escapeshellcmd($buildId), '', $stdout, $stderr); - if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'cancelled') { - Console::info('Build has been cancelled'); + if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); return; } @@ -407,8 +407,8 @@ class Builds extends Action $response = null; $err = null; - if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'cancelled') { - Console::info('Build has been cancelled'); + if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); return; } @@ -478,8 +478,8 @@ class Builds extends Action ]); if ($err) { - if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'cancelled') { - Console::info('Build has been cancelled'); + if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); return; } throw $err; @@ -511,8 +511,8 @@ class Builds extends Action $function = $dbForProject->updateDocument('functions', $function->getId(), $function); } - if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'cancelled') { - Console::info('Build has been cancelled'); + if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); return; } @@ -526,8 +526,8 @@ class Builds extends Action ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment'))); Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule)); } catch (\Throwable $th) { - if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'cancelled') { - Console::info('Build has been cancelled'); + if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); return; } diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 7a70b4538..4b2a8e0bc 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -488,9 +488,9 @@ class FunctionsCustomServerTest extends Scope ]); $this->assertEquals(200, $cancel['headers']['status-code']); - $this->assertEquals('cancelled', $cancel['body']['status']); + $this->assertEquals('canceled', $cancel['body']['status']); - // Confirm the deployment is cancelled + // Confirm the deployment is canceled $deployment = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'] . '/deployments/' . $deploymentId, [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -498,7 +498,7 @@ class FunctionsCustomServerTest extends Scope ]); $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertEquals('cancelled', $deployment['body']['status']); + $this->assertEquals('canceled', $deployment['body']['status']); } /**