Merge branch '1.9.x' of https://github.com/appwrite/appwrite into log-scheduler-execution

This commit is contained in:
fogelito committed 2026-06-09 12:50:43 +03:00
commit b97594c061
23 files changed
+2370 -4342

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@ RUN composer install --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist \
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
FROM appwrite/base:1.4.2 AS base
FROM appwrite/base:1.4.3 AS base
LABEL maintainer="team@appwrite.io"
-98
View File
@@ -85,48 +85,6 @@ return [
'icon' => '/images/services/databases.png',
'platforms' => ['client', 'server', 'console'],
],
'documentsDB' => [
'key' => 'documentsDB',
'name' => 'DocumentsDB',
'subtitle' => 'The DocumentsDB service allows you to create structured collections of documents, query and filter lists of documents.',
'description' => '/docs/services/databases.md',
'controller' => '', // Uses modules
'sdk' => true,
'docs' => true,
'docsUrl' => 'https://appwrite.io/docs/references/documentsdb',
'tests' => false,
'optional' => true,
'icon' => '/images/services/databases.png',
'platforms' => ['server', 'console'],
],
'tablesDB' => [
'key' => 'tablesDB',
'name' => 'TablesDB',
'subtitle' => 'The TablesDB service allows you to create structured tables of columns, query and filter lists of rows.',
'description' => '/docs/services/tablesdb.md',
'controller' => '', // Uses modules
'sdk' => true,
'docs' => true,
'docsUrl' => 'https://appwrite.io/docs/references/tablesdb',
'tests' => false,
'optional' => true,
'icon' => '/images/services/databases.png',
'platforms' => ['server', 'console'],
],
'vectorsDB' => [
'key' => 'vectorsDB',
'name' => 'VectorsDB',
'subtitle' => 'The VectorsDB service allows you to create vector collections, embeddings, indexes, and documents.',
'description' => '/docs/services/databases.md',
'controller' => '', // Uses modules
'sdk' => true,
'docs' => true,
'docsUrl' => 'https://appwrite.io/docs/references/vectorsdb',
'tests' => false,
'optional' => true,
'icon' => '/images/services/databases.png',
'platforms' => ['server', 'console'],
],
'locale' => [
'key' => 'locale',
'name' => 'Locale',
@@ -239,48 +197,6 @@ return [
'icon' => '',
'platforms' => ['client', 'server', 'console'],
],
'webhooks' => [
'key' => 'webhooks',
'name' => 'Webhooks',
'subtitle' => 'The Webhooks service allows you to configure event-driven HTTP callbacks for your project.',
'description' => '',
'controller' => '', // Uses modules
'sdk' => true,
'docs' => true,
'docsUrl' => '',
'tests' => false,
'optional' => true,
'icon' => '',
'platforms' => ['server', 'console'],
],
'tokens' => [
'key' => 'tokens',
'name' => 'Tokens',
'subtitle' => 'The Tokens service allows you to create and manage resource tokens for project resources.',
'description' => '',
'controller' => '', // Uses modules
'sdk' => true,
'docs' => true,
'docsUrl' => '',
'tests' => false,
'optional' => true,
'icon' => '',
'platforms' => ['server', 'console'],
],
'presences' => [
'key' => 'presences',
'name' => 'Presences',
'subtitle' => 'The Presences service allows you to create, query, and manage realtime presence state.',
'description' => '',
'controller' => '', // Uses modules
'sdk' => true,
'docs' => true,
'docsUrl' => 'https://appwrite.io/docs/references/presences',
'tests' => false,
'optional' => true,
'icon' => '',
'platforms' => ['client', 'server', 'console'],
],
'sites' => [
'key' => 'sites',
'name' => 'Sites',
@@ -365,20 +281,6 @@ return [
'icon' => '',
'platforms' => ['client', 'server', 'console'],
],
'assistant' => [
'key' => 'assistant',
'name' => 'Assistant',
'subtitle' => 'The Assistant service allows Console users to ask assistant queries.',
'description' => '',
'controller' => '', // Uses modules
'sdk' => true,
'docs' => true,
'docsUrl' => 'https://appwrite.io/docs/references/assistant',
'tests' => false,
'optional' => false,
'icon' => '',
'platforms' => ['console'],
],
'organization' => [
'key' => 'organization',
'name' => 'Organization',
@@ -139,18 +139,6 @@ class Base extends Action
'activate' => $activate,
]));
$function = $function
->setAttribute('latestDeploymentId', $deployment->getId())
->setAttribute('latestDeploymentInternalId', $deployment->getSequence())
->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt())
->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$dbForProject->updateDocument('functions', $function->getId(), new Document([
'latestDeploymentId' => $deployment->getId(),
'latestDeploymentInternalId' => $deployment->getSequence(),
'latestDeploymentCreatedAt' => $deployment->getCreatedAt(),
'latestDeploymentStatus' => $deployment->getAttribute('status', ''),
]));
$publisherForBuilds->enqueue(new BuildMessage(
project: $project,
resource: $function,
@@ -253,18 +241,6 @@ class Base extends Action
'activate' => $activate,
]));
$site = $site
->setAttribute('latestDeploymentId', $deployment->getId())
->setAttribute('latestDeploymentInternalId', $deployment->getSequence())
->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt())
->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$dbForProject->updateDocument('sites', $site->getId(), new Document([
'latestDeploymentId' => $deployment->getId(),
'latestDeploymentInternalId' => $deployment->getSequence(),
'latestDeploymentCreatedAt' => $deployment->getCreatedAt(),
'latestDeploymentStatus' => $deployment->getAttribute('status', ''),
]));
$sitesDomain = $platform['sitesDomain'];
$domain = ID::unique() . "." . $sitesDomain;
@@ -303,12 +303,6 @@ class Create extends Action
'type' => $type
]));
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document([
'latestDeploymentId' => $deployment->getId(),
'latestDeploymentInternalId' => $deployment->getSequence(),
'latestDeploymentCreatedAt' => $deployment->getCreatedAt(),
'latestDeploymentStatus' => $deployment->getAttribute('status', ''),
]));
} else {
$deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([
'sourceSize' => $fileSize,
@@ -350,12 +344,6 @@ class Create extends Action
'type' => $type
]));
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document([
'latestDeploymentId' => $deployment->getId(),
'latestDeploymentInternalId' => $deployment->getSequence(),
'latestDeploymentCreatedAt' => $deployment->getCreatedAt(),
'latestDeploymentStatus' => $deployment->getAttribute('status', ''),
]));
} else {
$deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([
'sourceChunksUploaded' => $chunksUploaded,
@@ -13,6 +13,7 @@ use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Response;
use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\Exception\Transaction as TransactionException;
use Utopia\Database\Query;
use Utopia\Database\Validator\UID;
use Utopia\Platform\Action;
@@ -89,8 +90,16 @@ class Delete extends Action
throw new Exception(Exception::DEPLOYMENT_NOT_FOUND);
}
if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB');
try {
if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB');
}
} catch (TransactionException) {
$deploymentExists = !$dbForProject->getDocument('deployments', $deployment->getId())->isEmpty();
if ($deploymentExists && !$dbForProject->deleteDocument('deployments', $deployment->getId())) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB');
}
}
if (!empty($deployment->getAttribute('sourcePath', ''))) {
@@ -120,18 +120,6 @@ class Create extends Action
'buildLogs' => '',
]));
$function = $function
->setAttribute('latestDeploymentId', $deployment->getId())
->setAttribute('latestDeploymentInternalId', $deployment->getSequence())
->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt())
->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$dbForProject->updateDocument('functions', $function->getId(), new Document([
'latestDeploymentId' => $function->getAttribute('latestDeploymentId'),
'latestDeploymentInternalId' => $function->getAttribute('latestDeploymentInternalId'),
'latestDeploymentCreatedAt' => $function->getAttribute('latestDeploymentCreatedAt'),
'latestDeploymentStatus' => $function->getAttribute('latestDeploymentStatus'),
]));
$publisherForBuilds->enqueue(new BuildMessage(
project: $project,
resource: $function,
@@ -12,6 +12,7 @@ use Executor\Executor;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
use Utopia\Database\Exception\Transaction as TransactionException;
use Utopia\Database\Validator\UID;
use Utopia\Platform\Action;
use Utopia\Platform\Scope\HTTP;
@@ -91,17 +92,30 @@ class Update extends Action
$endTime = new \DateTime('now');
$duration = $endTime->getTimestamp() - $startTime->getTimestamp();
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([
'buildEndedAt' => DateTime::now(),
'buildDuration' => $duration,
'status' => 'canceled'
]));
if ($deployment->getSequence() === $function->getAttribute('latestDeploymentInternalId', '')) {
$function = $function->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$dbForProject->updateDocument('functions', $function->getId(), new Document([
'latestDeploymentStatus' => $function->getAttribute('latestDeploymentStatus'),
try {
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([
'buildEndedAt' => DateTime::now(),
'buildDuration' => $duration,
'status' => 'canceled'
]));
} catch (TransactionException) {
$deployment = $dbForProject->getDocument('deployments', $deployment->getId());
if ($deployment->isEmpty()) {
throw new Exception(Exception::DEPLOYMENT_NOT_FOUND);
}
if (\in_array($deployment->getAttribute('status'), ['ready', 'failed'])) {
throw new Exception(Exception::BUILD_ALREADY_COMPLETED);
}
if ($deployment->getAttribute('status') !== 'canceled') {
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([
'buildEndedAt' => DateTime::now(),
'buildDuration' => $duration,
'status' => 'canceled'
]));
}
}
try {
@@ -174,19 +174,6 @@ class Create extends Base
'activate' => $activate,
]));
$function = $function
->setAttribute('latestDeploymentId', $deployment->getId())
->setAttribute('latestDeploymentInternalId', $deployment->getSequence())
->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt())
->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$dbForProject->updateDocument('functions', $function->getId(), new Document([
'latestDeploymentId' => $function->getAttribute('latestDeploymentId'),
'latestDeploymentInternalId' => $function->getAttribute('latestDeploymentInternalId'),
'latestDeploymentCreatedAt' => $function->getAttribute('latestDeploymentCreatedAt'),
'latestDeploymentStatus' => $function->getAttribute('latestDeploymentStatus'),
]));
$this->updateEmptyManualRule($project, $function, $deployment, $dbForPlatform, $authorization);
$publisherForBuilds->enqueue(new BuildMessage(
@@ -344,12 +344,6 @@ class Create extends Base
referenceType: 'branch'
);
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document([
'latestDeploymentId' => $deployment->getId(),
'latestDeploymentInternalId' => $deployment->getSequence(),
'latestDeploymentCreatedAt' => $deployment->getCreatedAt(),
'latestDeploymentStatus' => $deployment->getAttribute('status', ''),
]));
} elseif (!$template->isEmpty()) {
// Deploy non-VCS from template
$deploymentId = ID::unique();
@@ -370,13 +364,6 @@ class Create extends Base
'activate' => true,
]));
$function = $dbForProject->updateDocument('functions', $function->getId(), new Document([
'latestDeploymentId' => $deployment->getId(),
'latestDeploymentInternalId' => $deployment->getSequence(),
'latestDeploymentCreatedAt' => $deployment->getCreatedAt(),
'latestDeploymentStatus' => $deployment->getAttribute('status', ''),
]));
$publisherForBuilds->enqueue(new BuildMessage(
project: $project,
resource: $function,
@@ -30,6 +30,7 @@ use Utopia\Database\Exception\Conflict;
use Utopia\Database\Exception\Duplicate;
use Utopia\Database\Exception\Restricted;
use Utopia\Database\Exception\Structure;
use Utopia\Database\Exception\Transaction as TransactionException;
use Utopia\Database\Query;
use Utopia\Detector\Detection\Rendering\SSR;
use Utopia\Detector\Detection\Rendering\XStatic;
@@ -247,6 +248,7 @@ class Builds extends Action
->setParam('deploymentId', $deployment->getId());
if ($deployment->getAttribute('status') === 'canceled') {
$resource = $this->updateLatestDeployment($dbForProject, $resource);
$this->cancelDeployment($deployment->getId(), $dbForProject, $queueForRealtime);
return;
@@ -261,9 +263,7 @@ class Builds extends Action
'status' => 'processing',
]));
if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) {
$resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')]));
}
$resource = $this->updateLatestDeployment($dbForProject, $resource);
Span::add('deployment.status', 'processing');
@@ -537,9 +537,7 @@ class Builds extends Action
]));
Span::add('deployment.status', 'building');
if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) {
$resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')]));
}
$resource = $this->updateLatestDeployment($dbForProject, $resource);
$queueForRealtime
->setPayload($deployment->getArrayCopy())
@@ -898,16 +896,21 @@ class Builds extends Action
$deployment->setAttribute('buildLogs', $logs);
/** Update the status */
$endTime = DateTime::now();
$durationEnd = \microtime(true);
$deployment->setAttribute('buildEndedAt', $endTime);
$deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart)));
$deployment->setAttribute('status', 'ready');
$deployment = $dbForProject->updateDocument('deployments', $deploymentId, new Document([
'buildEndedAt' => $deployment->getAttribute('buildEndedAt'),
'buildDuration' => $deployment->getAttribute('buildDuration'),
'buildLogs' => $deployment->getAttribute('buildLogs'),
'status' => 'ready',
]));
Span::add('deployment.status', 'ready');
Span::add('build.duration', $deployment->getAttribute('buildDuration'));
if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) {
$resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')]));
}
$resource = $this->updateLatestDeployment($dbForProject, $resource);
if ($isVcsEnabled) {
$this->runGitAction('ready', $github, $providerCommitHash, $owner, $repositoryName, $project, $resource, $deployment->getId(), $dbForProject, $dbForPlatform, $queueForRealtime, $platform);
@@ -994,6 +997,8 @@ class Builds extends Action
Span::add('build.activated', true);
}
$resource = $this->updateLatestDeployment($dbForProject, $resource);
$this->afterDeploymentSuccess(
$project,
$deployment,
@@ -1063,13 +1068,6 @@ class Builds extends Action
}
}
$endTime = DateTime::now();
$durationEnd = \microtime(true);
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([
'buildEndedAt' => $endTime,
'buildDuration' => \intval(\ceil($durationEnd - $durationStart)),
]));
Span::add('build.duration', $deployment->getAttribute('buildDuration'));
$queueForRealtime
->setPayload($deployment->getArrayCopy())
->trigger();
@@ -1150,9 +1148,7 @@ class Builds extends Action
'buildLogs' => $message,
]));
if ($deployment->getSequence() === $resource->getAttribute('latestDeploymentInternalId', '')) {
$resource = $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document(['latestDeploymentStatus' => $deployment->getAttribute('status', '')]));
}
$resource = $this->updateLatestDeployment($dbForProject, $resource);
$queueForRealtime
->setPayload($deployment->getArrayCopy())
@@ -1496,20 +1492,61 @@ class Builds extends Action
}
}
private function updateLatestDeployment(Database $dbForProject, Document $resource): Document
{
$latestDeployment = $dbForProject->findOne('deployments', [
Query::equal('resourceType', [$resource->getCollection()]),
Query::equal('resourceInternalId', [$resource->getSequence()]),
Query::orderDesc('$createdAt'),
]);
$updates = $latestDeployment->isEmpty()
? [
'latestDeploymentCreatedAt' => '',
'latestDeploymentInternalId' => '',
'latestDeploymentId' => '',
'latestDeploymentStatus' => '',
]
: [
'latestDeploymentCreatedAt' => $latestDeployment->getCreatedAt(),
'latestDeploymentInternalId' => $latestDeployment->getSequence(),
'latestDeploymentId' => $latestDeployment->getId(),
'latestDeploymentStatus' => $latestDeployment->getAttribute('status', ''),
];
return $dbForProject->updateDocument(
$resource->getCollection(),
$resource->getId(),
new Document($updates)
);
}
private function cancelDeployment(string $deploymentId, Database $dbForProject, Realtime $queueForRealtime)
{
Span::add('deployment.status', 'canceled');
$deployment = $dbForProject->getDocument('deployments', $deploymentId);
$attempts = 0;
$logs = $deployment->getAttribute('buildLogs', '');
$date = \date('H:i:s');
$logs .= "\033[90m[$date] \033[90m[\033[0mappwrite\033[90m]\033[33m Build has been canceled. \033[0m\n";
while (true) {
try {
$deployment = $dbForProject->getDocument('deployments', $deploymentId);
$deployment->setAttribute('buildLogs', $logs);
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([
'buildLogs' => $deployment->getAttribute('buildLogs'),
]));
$logs = $deployment->getAttribute('buildLogs', '');
$date = \date('H:i:s');
$logs .= "\033[90m[$date] \033[90m[\033[0mappwrite\033[90m]\033[33m Build has been canceled. \033[0m\n";
$deployment->setAttribute('buildLogs', $logs);
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([
'buildLogs' => $deployment->getAttribute('buildLogs'),
]));
break;
} catch (TransactionException $exception) {
if (++$attempts >= 5) {
throw $exception;
}
}
}
$queueForRealtime
->setPayload($deployment->getArrayCopy())
@@ -311,18 +311,6 @@ class Create extends Action
'type' => $type,
]));
$site = $site
->setAttribute('latestDeploymentId', $deployment->getId())
->setAttribute('latestDeploymentInternalId', $deployment->getSequence())
->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt())
->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$dbForProject->updateDocument('sites', $site->getId(), new Document([
'latestDeploymentId' => $deployment->getId(),
'latestDeploymentInternalId' => $deployment->getSequence(),
'latestDeploymentCreatedAt' => $deployment->getCreatedAt(),
'latestDeploymentStatus' => $deployment->getAttribute('status', ''),
]));
$sitesDomain = $platform['sitesDomain'];
$domain = ID::unique() . "." . $sitesDomain;
@@ -393,18 +381,6 @@ class Create extends Action
'type' => $type,
]));
$site = $site
->setAttribute('latestDeploymentId', $deployment->getId())
->setAttribute('latestDeploymentInternalId', $deployment->getSequence())
->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt())
->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$dbForProject->updateDocument('sites', $site->getId(), new Document([
'latestDeploymentId' => $site->getAttribute('latestDeploymentId'),
'latestDeploymentInternalId' => $site->getAttribute('latestDeploymentInternalId'),
'latestDeploymentCreatedAt' => $site->getAttribute('latestDeploymentCreatedAt'),
'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'),
]));
$sitesDomain = $platform['sitesDomain'];
$domain = ID::unique() . "." . $sitesDomain;
$ruleId = md5($domain);
@@ -13,6 +13,7 @@ use Appwrite\SDK\Response as SDKResponse;
use Appwrite\Utopia\Response;
use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\Exception\Transaction as TransactionException;
use Utopia\Database\Query;
use Utopia\Database\Validator\UID;
use Utopia\Platform\Action;
@@ -89,8 +90,16 @@ class Delete extends Action
throw new Exception(Exception::DEPLOYMENT_NOT_FOUND);
}
if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB');
try {
if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB');
}
} catch (TransactionException) {
$deploymentExists = !$dbForProject->getDocument('deployments', $deployment->getId())->isEmpty();
if ($deploymentExists && !$dbForProject->deleteDocument('deployments', $deployment->getId())) {
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB');
}
}
if (!empty($deployment->getAttribute('sourcePath', ''))) {
@@ -138,18 +138,6 @@ class Create extends Action
'type' => $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual'
]));
$site = $site
->setAttribute('latestDeploymentId', $deployment->getId())
->setAttribute('latestDeploymentInternalId', $deployment->getSequence())
->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt())
->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$dbForProject->updateDocument('sites', $site->getId(), new Document([
'latestDeploymentId' => $site->getAttribute('latestDeploymentId'),
'latestDeploymentInternalId' => $site->getAttribute('latestDeploymentInternalId'),
'latestDeploymentCreatedAt' => $site->getAttribute('latestDeploymentCreatedAt'),
'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'),
]));
// Preview deployments for sites
$sitesDomain = $platform['sitesDomain'];
$domain = ID::unique() . "." . $sitesDomain;
@@ -12,6 +12,7 @@ use Executor\Executor;
use Utopia\Database\Database;
use Utopia\Database\DateTime;
use Utopia\Database\Document;
use Utopia\Database\Exception\Transaction as TransactionException;
use Utopia\Database\Validator\UID;
use Utopia\Platform\Action;
use Utopia\Platform\Scope\HTTP;
@@ -89,17 +90,30 @@ class Update extends Action
$endTime = new \DateTime('now');
$duration = $endTime->getTimestamp() - $startTime->getTimestamp();
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([
'buildEndedAt' => DateTime::now(),
'buildDuration' => $duration,
'status' => 'canceled'
]));
if ($deployment->getSequence() === $site->getAttribute('latestDeploymentInternalId', '')) {
$site = $site->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$dbForProject->updateDocument('sites', $site->getId(), new Document([
'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'),
try {
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([
'buildEndedAt' => DateTime::now(),
'buildDuration' => $duration,
'status' => 'canceled'
]));
} catch (TransactionException) {
$deployment = $dbForProject->getDocument('deployments', $deployment->getId());
if ($deployment->isEmpty()) {
throw new Exception(Exception::DEPLOYMENT_NOT_FOUND);
}
if (\in_array($deployment->getAttribute('status'), ['ready', 'failed'])) {
throw new Exception(Exception::BUILD_ALREADY_COMPLETED);
}
if ($deployment->getAttribute('status') !== 'canceled') {
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), new Document([
'buildEndedAt' => DateTime::now(),
'buildDuration' => $duration,
'status' => 'canceled'
]));
}
}
try {
@@ -184,18 +184,6 @@ class Create extends Base
'activate' => $activate,
]));
$site = $site
->setAttribute('latestDeploymentId', $deployment->getId())
->setAttribute('latestDeploymentInternalId', $deployment->getSequence())
->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt())
->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$dbForProject->updateDocument('sites', $site->getId(), new Document([
'latestDeploymentId' => $site->getAttribute('latestDeploymentId'),
'latestDeploymentInternalId' => $site->getAttribute('latestDeploymentInternalId'),
'latestDeploymentCreatedAt' => $site->getAttribute('latestDeploymentCreatedAt'),
'latestDeploymentStatus' => $site->getAttribute('latestDeploymentStatus'),
]));
$sitesDomain = $platform['sitesDomain'];
$domain = ID::unique() . "." . $sitesDomain;
@@ -392,18 +392,6 @@ trait Deployment
'activate' => $activate,
])));
$resource = $resource
->setAttribute('latestDeploymentId', $deployment->getId())
->setAttribute('latestDeploymentInternalId', $deployment->getSequence())
->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt())
->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', ''));
$authorization->skip(fn () => $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), new Document([
'latestDeploymentId' => $resource->getAttribute('latestDeploymentId'),
'latestDeploymentInternalId' => $resource->getAttribute('latestDeploymentInternalId'),
'latestDeploymentCreatedAt' => $resource->getAttribute('latestDeploymentCreatedAt'),
'latestDeploymentStatus' => $resource->getAttribute('latestDeploymentStatus'),
])));
if ($resource->getCollection() === 'sites') {
$projectId = $project->getId();
@@ -2540,12 +2540,14 @@ final class SitesCustomServerTest extends Scope
$this->assertNotEmpty($response['cookies']['a_jwt_console']);
$this->assertEquals($jwt['body']['jwt'], $response['cookies']['a_jwt_console']);
$response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [
'cookie' => 'a_jwt_console=' . $jwt['body']['jwt']
], followRedirects: false);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertStringContainsString("Contact page", (string) $response['body']);
$this->assertStringContainsString("Preview by", (string) $response['body']);
$this->assertEventually(function () use ($proxyClient, $jwt) {
$response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [
'cookie' => 'a_jwt_console=' . $jwt['body']['jwt']
], followRedirects: false);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertStringContainsString("Contact page", (string) $response['body']);
$this->assertStringContainsString("Preview by", (string) $response['body']);
});
// Failure: Session missing (old bad, new ok)
$session = $this->client->call(Client::METHOD_DELETE, '/account/sessions/current', array_merge([
@@ -2573,12 +2575,14 @@ final class SitesCustomServerTest extends Scope
$this->assertEquals(201, $jwt['headers']['status-code']);
$this->assertNotEmpty($jwt['body']['jwt']);
$response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [
'cookie' => 'a_jwt_console=' . $jwt['body']['jwt']
], followRedirects: false);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertStringContainsString("Contact page", (string) $response['body']);
$this->assertStringContainsString("Preview by", (string) $response['body']);
$this->assertEventually(function () use ($proxyClient, $jwt) {
$response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [
'cookie' => 'a_jwt_console=' . $jwt['body']['jwt']
], followRedirects: false);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertStringContainsString("Contact page", (string) $response['body']);
$this->assertStringContainsString("Preview by", (string) $response['body']);
});
$user = $this->client->call(Client::METHOD_PATCH, '/account/status', array_merge([
'origin' => 'http://localhost',
File diff suppressed because it is too large. Load diff
@@ -9,8 +9,8 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/node": "^9.5.4",
"astro": "^5.2.5"
"@astrojs/node": "^10.1.3",
"astro": "^6.4.4"
},
"devDependencies": {
},
File diff suppressed because it is too large. Load diff
@@ -9,6 +9,6 @@
"astro": "astro"
},
"dependencies": {
"astro": "^5.2.5"
"astro": "^6.4.4"
}
}
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -9,7 +9,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/node": "^9.0.2",
"astro": "^5.2.5"
"@astrojs/node": "^10.1.3",
"astro": "^6.4.4"
}
}