Merge branch '1.7.x' into fix-rules-platform-check

This commit is contained in:
Matej Bačo
2025-06-25 14:44:52 +02:00
5 changed files with 25 additions and 18 deletions
+2 -2
View File
@@ -66,7 +66,7 @@ jobs:
sudo apt install oha
oha --version
- name: Benchmark PR
run: 'oha -z 180s http://localhost/v1/health/version -j > benchmark.json'
run: 'oha -z 180s http://localhost/v1/health/version --output_format json > benchmark.json'
- name: Cleaning
run: docker compose down -v
- name: Installing latest version
@@ -79,7 +79,7 @@ jobs:
docker compose up -d
sleep 10
- name: Benchmark Latest
run: oha -z 180s http://localhost/v1/health/version -j > benchmark-latest.json
run: oha -z 180s http://localhost/v1/health/version --output_format json > benchmark-latest.json
- name: Prepare comment
run: |
echo '## :sparkles: Benchmark results' > benchmark.txt
+1 -1
View File
@@ -864,7 +864,7 @@ $image = $this->getParam('image', '');
<<: *x-logging
restart: unless-stopped
stop_signal: SIGINT
image: openruntimes/executor:0.7.20
image: openruntimes/executor:0.7.22
networks:
- appwrite
- runtimes
+1 -1
View File
@@ -951,7 +951,7 @@ services:
hostname: exc1
<<: *x-logging
stop_signal: SIGINT
image: openruntimes/executor:0.7.20
image: openruntimes/executor:0.7.22
restart: unless-stopped
networks:
- appwrite
@@ -209,6 +209,9 @@ class Builds extends Action
Executor $executor,
array $plan
): void {
$startTime = DateTime::now();
$durationStart = \microtime(true);
$resourceKey = match ($resource->getCollection()) {
'functions' => 'functionId',
'sites' => 'siteId',
@@ -260,9 +263,6 @@ class Builds extends Action
->setParam($resourceKey, $resource->getId())
->setParam('deploymentId', $deployment->getId());
$startTime = DateTime::now();
$durationStart = \microtime(true);
if ($deployment->getAttribute('status') === 'canceled') {
Console::info('Build has been canceled');
return;
@@ -810,9 +810,6 @@ class Builds extends Action
throw $err;
}
$endTime = DateTime::now();
$durationEnd = \microtime(true);
$buildSizeLimit = (int)System::getEnv('_APP_COMPUTE_BUILD_SIZE_LIMIT', '2000000000');
if (isset($plan['buildSize'])) {
$buildSizeLimit = $plan['buildSize'] * 1000 * 1000;
@@ -821,10 +818,6 @@ class Builds extends Action
throw new \Exception('Build size should be less than ' . number_format($buildSizeLimit / (1000 * 1000), 2) . ' MBs.');
}
/** Update the build document */
$deployment->setAttribute('buildStartedAt', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime']))));
$deployment->setAttribute('buildEndedAt', $endTime);
$deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart)));
$deployment->setAttribute('buildPath', $response['path']);
$deployment->setAttribute('buildSize', $response['size']);
$deployment->setAttribute('totalSize', $deployment->getAttribute('buildSize', 0) + $deployment->getAttribute('sourceSize', 0));
@@ -1191,6 +1184,15 @@ class Builds extends Action
}
}
$endTime = DateTime::now();
$durationEnd = \microtime(true);
$deployment->setAttribute('buildEndedAt', $endTime);
$deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart)));
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
$queueForRealtime
->setPayload($deployment->getArrayCopy())
->trigger();
if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') {
Console::info('Build has been canceled');
return;
@@ -1234,7 +1236,7 @@ class Builds extends Action
// Combine with previous logs if deployment got past build process
$previousLogs = '';
if (!empty($deployment->getAttribute('buildEndedAt', ''))) {
if (!is_null($deployment->getAttribute('buildSize', null))) {
$previousLogs = $deployment->getAttribute('buildLogs', '');
if (!empty($previousLogs)) {
$message = $previousLogs . "\n" . $message;
@@ -607,10 +607,8 @@ class RealtimeConsoleClientTest extends Scope
$this->assertContains("projects.{$projectId}", $response['data']['channels']);
$this->assertArrayHasKey('buildLogs', $response['data']['payload']);
if (!empty($response['data']['payload']['buildEndedAt'])) {
$this->assertNotEmpty($response['data']['payload']['buildEndedAt']);
if (!empty($response['data']['payload']['buildSize'])) {
$this->assertNotEmpty($response['data']['payload']['buildStartedAt']);
$this->assertNotEmpty($response['data']['payload']['buildDuration']);
$this->assertNotEmpty($response['data']['payload']['buildPath']);
$this->assertNotEmpty($response['data']['payload']['buildSize']);
$this->assertNotEmpty($response['data']['payload']['totalSize']);
@@ -634,6 +632,13 @@ class RealtimeConsoleClientTest extends Scope
$this->assertContains("projects.{$projectId}", $response['data']['channels']);
$this->assertEquals("ready", $response['data']['payload']['status']);
$response = json_decode($client->receive(), true);
$this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.update", $response['data']['events']);
$this->assertContains('console', $response['data']['channels']);
$this->assertContains("projects.{$projectId}", $response['data']['channels']);
$this->assertNotEmpty($response['data']['payload']['buildDuration']);
$this->assertNotEmpty($response['data']['payload']['buildEndedAt']);
$client->close();
}
}