From 2a5ecb2547c8adce3e3d421c6b20271117df10a8 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 26 May 2025 22:25:12 +1200 Subject: [PATCH 01/12] Release cli --- app/config/platforms.php | 2 +- app/config/specs/open-api3-1.7.x-client.json | 2 +- app/config/specs/open-api3-1.7.x-console.json | 30 +++++++++++++++-- app/config/specs/open-api3-1.7.x-server.json | 30 +++++++++++++++-- app/config/specs/open-api3-latest-client.json | 25 +-------------- .../specs/open-api3-latest-console.json | 13 +++----- app/config/specs/open-api3-latest-server.json | 13 +++----- app/config/specs/swagger2-1.7.x-client.json | 2 +- app/config/specs/swagger2-1.7.x-console.json | 32 +++++++++++++++++-- app/config/specs/swagger2-1.7.x-server.json | 32 +++++++++++++++++-- app/config/specs/swagger2-latest-client.json | 25 +-------------- app/config/specs/swagger2-latest-console.json | 15 ++++----- app/config/specs/swagger2-latest-server.json | 15 ++++----- app/controllers/api/databases.php | 2 +- .../examples/databases/upsert-document.md | 6 ++++ .../examples/databases/upsert-documents.md | 2 +- 16 files changed, 149 insertions(+), 97 deletions(-) create mode 100644 docs/examples/1.7.x/console-cli/examples/databases/upsert-document.md diff --git a/app/config/platforms.php b/app/config/platforms.php index 358edd0cf8..7d481d508e 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -217,7 +217,7 @@ return [ [ 'key' => 'cli', 'name' => 'Command Line', - 'version' => '6.2.3', + 'version' => '7.0.0', 'url' => 'https://github.com/appwrite/sdk-for-cli', 'package' => 'https://www.npmjs.com/package/appwrite-cli', 'enabled' => true, diff --git a/app/config/specs/open-api3-1.7.x-client.json b/app/config/specs/open-api3-1.7.x-client.json index abeab8a56f..bbb78c6c66 100644 --- a/app/config/specs/open-api3-1.7.x-client.json +++ b/app/config/specs/open-api3-1.7.x-client.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.7.0", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", diff --git a/app/config/specs/open-api3-1.7.x-console.json b/app/config/specs/open-api3-1.7.x-console.json index 19ce78915c..90ef137fc2 100644 --- a/app/config/specs/open-api3-1.7.x-console.json +++ b/app/config/specs/open-api3-1.7.x-console.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.7.0", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -8049,6 +8049,29 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." + }, + { + "name": "createDocuments", + "auth": { + "Key": [] + }, + "parameters": [ + "databaseId", + "collectionId", + "documents" + ], + "required": [ + "databaseId", + "collectionId", + "documents" + ], + "responses": [ + { + "code": 201, + "model": "#\/components\/schemas\/documentList" + } + ], + "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." } ], "auth": { @@ -8204,7 +8227,10 @@ "type": "object" } } - } + }, + "required": [ + "documents" + ] } } } diff --git a/app/config/specs/open-api3-1.7.x-server.json b/app/config/specs/open-api3-1.7.x-server.json index db615d642c..1ae9328864 100644 --- a/app/config/specs/open-api3-1.7.x-server.json +++ b/app/config/specs/open-api3-1.7.x-server.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.7.0", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -7530,6 +7530,29 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." + }, + { + "name": "createDocuments", + "auth": { + "Key": [] + }, + "parameters": [ + "databaseId", + "collectionId", + "documents" + ], + "required": [ + "databaseId", + "collectionId", + "documents" + ], + "responses": [ + { + "code": 201, + "model": "#\/components\/schemas\/documentList" + } + ], + "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." } ], "auth": { @@ -7688,7 +7711,10 @@ "type": "object" } } - } + }, + "required": [ + "documents" + ] } } } diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index e87a892063..bbb78c6c66 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.7.3", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -4490,29 +4490,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "auth": { - "Key": [] - }, - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/components\/schemas\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." } ], "auth": { diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index ad500a8811..90ef137fc2 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.7.3", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -8227,7 +8227,10 @@ "type": "object" } } - } + }, + "required": [ + "documents" + ] } } } @@ -36587,12 +36590,6 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "default", "nullable": true - }, - "encrypt": { - "type": "boolean", - "description": "Defines whether this attribute is encrypted or not.", - "x-example": false, - "nullable": true } }, "required": [ diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 8ac05cb97b..1ae9328864 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -1,7 +1,7 @@ { "openapi": "3.0.0", "info": { - "version": "1.7.3", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -7711,7 +7711,10 @@ "type": "object" } } - } + }, + "required": [ + "documents" + ] } } } @@ -26555,12 +26558,6 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "default", "nullable": true - }, - "encrypt": { - "type": "boolean", - "description": "Defines whether this attribute is encrypted or not.", - "x-example": false, - "nullable": true } }, "required": [ diff --git a/app/config/specs/swagger2-1.7.x-client.json b/app/config/specs/swagger2-1.7.x-client.json index 5c1b764e1e..92132151b4 100644 --- a/app/config/specs/swagger2-1.7.x-client.json +++ b/app/config/specs/swagger2-1.7.x-client.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.7.0", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", diff --git a/app/config/specs/swagger2-1.7.x-console.json b/app/config/specs/swagger2-1.7.x-console.json index 96705f3e61..e53a0dfb0b 100644 --- a/app/config/specs/swagger2-1.7.x-console.json +++ b/app/config/specs/swagger2-1.7.x-console.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.7.0", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -8178,6 +8178,29 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." + }, + { + "name": "createDocuments", + "auth": { + "Key": [] + }, + "parameters": [ + "databaseId", + "collectionId", + "documents" + ], + "required": [ + "databaseId", + "collectionId", + "documents" + ], + "responses": [ + { + "code": 201, + "model": "#\/definitions\/documentList" + } + ], + "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." } ], "auth": { @@ -8323,13 +8346,16 @@ "documents": { "type": "array", "description": "Array of document data as JSON objects. May contain partial documents.", - "default": [], + "default": null, "x-example": null, "items": { "type": "object" } } - } + }, + "required": [ + "documents" + ] } } ] diff --git a/app/config/specs/swagger2-1.7.x-server.json b/app/config/specs/swagger2-1.7.x-server.json index c033008417..083290bcc0 100644 --- a/app/config/specs/swagger2-1.7.x-server.json +++ b/app/config/specs/swagger2-1.7.x-server.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.7.0", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -7649,6 +7649,29 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." + }, + { + "name": "createDocuments", + "auth": { + "Key": [] + }, + "parameters": [ + "databaseId", + "collectionId", + "documents" + ], + "required": [ + "databaseId", + "collectionId", + "documents" + ], + "responses": [ + { + "code": 201, + "model": "#\/definitions\/documentList" + } + ], + "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." } ], "auth": { @@ -7797,13 +7820,16 @@ "documents": { "type": "array", "description": "Array of document data as JSON objects. May contain partial documents.", - "default": [], + "default": null, "x-example": null, "items": { "type": "object" } } - } + }, + "required": [ + "documents" + ] } } ] diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index 972b4a34da..92132151b4 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.7.3", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -4636,29 +4636,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "auth": { - "Key": [] - }, - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/definitions\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." } ], "auth": { diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index a52f09d691..e53a0dfb0b 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.7.3", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -8346,13 +8346,16 @@ "documents": { "type": "array", "description": "Array of document data as JSON objects. May contain partial documents.", - "default": [], + "default": null, "x-example": null, "items": { "type": "object" } } - } + }, + "required": [ + "documents" + ] } } ] @@ -36816,12 +36819,6 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "default", "x-nullable": true - }, - "encrypt": { - "type": "boolean", - "description": "Defines whether this attribute is encrypted or not.", - "x-example": false, - "x-nullable": true } }, "required": [ diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index a37c972aae..083290bcc0 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -1,7 +1,7 @@ { "swagger": "2.0", "info": { - "version": "1.7.3", + "version": "1.7.4", "title": "Appwrite", "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https:\/\/appwrite.io\/docs](https:\/\/appwrite.io\/docs)", "termsOfService": "https:\/\/appwrite.io\/policy\/terms", @@ -7820,13 +7820,16 @@ "documents": { "type": "array", "description": "Array of document data as JSON objects. May contain partial documents.", - "default": [], + "default": null, "x-example": null, "items": { "type": "object" } } - } + }, + "required": [ + "documents" + ] } } ] @@ -26851,12 +26854,6 @@ "description": "Default value for attribute when not provided. Cannot be set when attribute is required.", "x-example": "default", "x-nullable": true - }, - "encrypt": { - "type": "boolean", - "description": "Defines whether this attribute is encrypted or not.", - "x-example": false, - "x-nullable": true } }, "required": [ diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 277bfae16a..dcf547b688 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -4581,7 +4581,7 @@ App::put('/v1/databases/:databaseId/collections/:collectionId/documents') )) ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID.') - ->param('documents', [], fn (array $plan) => new ArrayList(new JSON(), $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH), 'Array of document data as JSON objects. May contain partial documents.', true, ['plan']) + ->param('documents', [], fn (array $plan) => new ArrayList(new JSON(), $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH), 'Array of document data as JSON objects. May contain partial documents.', false, ['plan']) ->inject('response') ->inject('dbForProject') ->inject('queueForStatsUsage') diff --git a/docs/examples/1.7.x/console-cli/examples/databases/upsert-document.md b/docs/examples/1.7.x/console-cli/examples/databases/upsert-document.md new file mode 100644 index 0000000000..40932014ba --- /dev/null +++ b/docs/examples/1.7.x/console-cli/examples/databases/upsert-document.md @@ -0,0 +1,6 @@ +appwrite databases upsertDocument \ + --databaseId \ + --collectionId \ + --documentId \ + --data '{ "key": "value" }' \ + diff --git a/docs/examples/1.7.x/console-cli/examples/databases/upsert-documents.md b/docs/examples/1.7.x/console-cli/examples/databases/upsert-documents.md index 3d0bd165d5..cb1677b14c 100644 --- a/docs/examples/1.7.x/console-cli/examples/databases/upsert-documents.md +++ b/docs/examples/1.7.x/console-cli/examples/databases/upsert-documents.md @@ -1,4 +1,4 @@ appwrite databases upsertDocuments \ --databaseId \ --collectionId \ - + --documents one two three From 968b6302d0c54b50a7d143eccf8d0f8b1e19f1dc Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 27 May 2025 07:36:28 +0000 Subject: [PATCH 02/12] Feat: add flutter 3.32 and dart 3.8 --- .env | 2 +- app/config/template-runtimes.php | 4 ++-- app/views/install/compose.phtml | 2 +- docker-compose.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.env b/.env index d7aa8b8d9e..b7dd9e24f3 100644 --- a/.env +++ b/.env @@ -85,7 +85,7 @@ _APP_COMPUTE_RUNTIMES_NETWORK=runtimes _APP_EXECUTOR_SECRET=your-secret-key _APP_EXECUTOR_HOST=http://exc1/v1 _APP_FUNCTIONS_RUNTIMES=php-8.0,node-18.0,python-3.9,ruby-3.1 -_APP_SITES_RUNTIMES=static-1,node-22,flutter-3.29 +_APP_SITES_RUNTIMES=static-1,node-22,flutter-3.32 _APP_MAINTENANCE_INTERVAL=86400 _APP_MAINTENANCE_START_TIME=12:00 _APP_MAINTENANCE_RETENTION_CACHE=2592000 diff --git a/app/config/template-runtimes.php b/app/config/template-runtimes.php index 8f1c0198c2..d1bb1a5b6a 100644 --- a/app/config/template-runtimes.php +++ b/app/config/template-runtimes.php @@ -14,7 +14,7 @@ return [ ], 'DART' => [ 'name' => 'dart', - 'versions' => ['3.5', '3.3', '3.1', '3.0', '2.19', '2.18', '2.17', '2.16'] + 'versions' => ['3.8', '3.5', '3.3', '3.1', '3.0', '2.19', '2.18', '2.17', '2.16'] ], 'GO' => [ 'name' => 'go', @@ -38,6 +38,6 @@ return [ ], 'FLUTTER' => [ 'name' => 'flutter', - 'versions' => ['3.24'] + 'versions' => ['3.32', '3.24'] ], ]; diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 7a25898647..2d8f2b35ab 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -864,7 +864,7 @@ $image = $this->getParam('image', ''); <<: *x-logging restart: unless-stopped stop_signal: SIGINT - image: openruntimes/executor:0.7.14 + image: openruntimes/executor:0.7.20 networks: - appwrite - runtimes diff --git a/docker-compose.yml b/docker-compose.yml index 18dc0aa7b7..cefd082c2f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -951,7 +951,7 @@ services: hostname: exc1 <<: *x-logging stop_signal: SIGINT - image: openruntimes/executor:0.7.16 + image: openruntimes/executor:0.7.20 restart: unless-stopped networks: - appwrite From 852c6fc3fe84e79fad7bbc6dc0e12309378780b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 27 May 2025 10:35:08 +0200 Subject: [PATCH 03/12] Fix rules non-updated --- src/Appwrite/Platform/Modules/Compute/Base.php | 2 +- .../Modules/Functions/Http/Functions/Deployment/Update.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index 47529a142b..14acacb89a 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -251,7 +251,7 @@ class Base extends Action $queries[] = Query::cursorAfter($cursor); } - $results = $database->find('rules', $queries); + $results = Authorization::skip(fn () => $database->find('rules', $queries)); $total = \count($results); if ($total > 0) { diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php index d97bb92b73..c52be0d95f 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php @@ -115,7 +115,7 @@ class Update extends Base $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) ->setAttribute('deploymentInternalId', $deployment->getInternalId()); - $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + Authorization::skip(fn () => $dbForPlatform->updateDocument('rules', $rule->getId(), $rule)); }); $queueForEvents From 64cea46183362172fd5f155f3f8e0e2699d253bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 27 May 2025 10:47:28 +0200 Subject: [PATCH 04/12] Permissiosn fix for sites --- .../Platform/Modules/Sites/Http/Sites/Deployment/Update.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php index aa36b52c5a..d28113c303 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php @@ -12,6 +12,7 @@ use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -106,7 +107,7 @@ class Update extends Base $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) ->setAttribute('deploymentInternalId', $deployment->getInternalId()); - $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + Authorization::skip(fn () => $dbForPlatform->updateDocument('rules', $rule->getId(), $rule)); }); $queueForEvents From cedc4eb2df7cec743d261df84c05f0d311a44c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 27 May 2025 11:06:08 +0200 Subject: [PATCH 05/12] Add logging --- src/Appwrite/Platform/Modules/Compute/Base.php | 5 +++++ .../Functions/Http/Functions/Deployment/Update.php | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index 14acacb89a..d09daa29da 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -251,7 +251,9 @@ class Base extends Action $queries[] = Query::cursorAfter($cursor); } + \var_dump("Actual find"); $results = Authorization::skip(fn () => $database->find('rules', $queries)); + \var_dump($results); $total = \count($results); if ($total > 0) { @@ -263,8 +265,11 @@ class Base extends Action } foreach ($results as $document) { + \var_dump("In foreach"); if (is_callable($callback)) { + \var_dump("Callback start"); $callback($document); + \var_dump("Callback end"); } } } while (!\is_null($cursor)); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php index c52be0d95f..726c1dec2b 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php @@ -111,12 +111,21 @@ class Update extends Base Query::equal("deploymentVcsProviderBranch", [""]), ]; + \var_dump("About to set to deployment ID " . $deployment->getId()); + \var_dump("Project ID: " . $project->getId()); + \var_dump("Project internal ID: " . $project->getInternalId()); + \var_dump("Function internal ID: " . $function->getInternalId()); + $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { + \var_dump("Updating rule" . $rule->getId()); $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) ->setAttribute('deploymentInternalId', $deployment->getInternalId()); Authorization::skip(fn () => $dbForPlatform->updateDocument('rules', $rule->getId(), $rule)); + \var_dump("Successfully updated " . $rule->getId()); }); + + \var_dump("Post update"); $queueForEvents ->setParam('functionId', $function->getId()) From 675179def889829556956f2f83f564cfa8a3d804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 27 May 2025 11:41:46 +0200 Subject: [PATCH 06/12] Improve logs --- src/Appwrite/Platform/Modules/Compute/Base.php | 10 ++++------ .../Functions/Http/Functions/Deployment/Update.php | 9 --------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index d09daa29da..46f82af661 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -240,8 +240,10 @@ class Base extends Action { $limit = 100; $cursor = null; - + do { + \var_dump("Project internal ID: " . $project->getInternalId()); + $queries = \array_merge([ Query::limit($limit), Query::equal("projectInternalId", [$project->getInternalId()]) @@ -251,9 +253,8 @@ class Base extends Action $queries[] = Query::cursorAfter($cursor); } - \var_dump("Actual find"); + \var_dump($queries); $results = Authorization::skip(fn () => $database->find('rules', $queries)); - \var_dump($results); $total = \count($results); if ($total > 0) { @@ -265,11 +266,8 @@ class Base extends Action } foreach ($results as $document) { - \var_dump("In foreach"); if (is_callable($callback)) { - \var_dump("Callback start"); $callback($document); - \var_dump("Callback end"); } } } while (!\is_null($cursor)); diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php index 726c1dec2b..f57ec8483c 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php @@ -110,22 +110,13 @@ class Update extends Base Query::equal("deploymentResourceInternalId", [$function->getInternalId()]), Query::equal("deploymentVcsProviderBranch", [""]), ]; - - \var_dump("About to set to deployment ID " . $deployment->getId()); - \var_dump("Project ID: " . $project->getId()); - \var_dump("Project internal ID: " . $project->getInternalId()); - \var_dump("Function internal ID: " . $function->getInternalId()); $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { - \var_dump("Updating rule" . $rule->getId()); $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) ->setAttribute('deploymentInternalId', $deployment->getInternalId()); Authorization::skip(fn () => $dbForPlatform->updateDocument('rules', $rule->getId(), $rule)); - \var_dump("Successfully updated " . $rule->getId()); }); - - \var_dump("Post update"); $queueForEvents ->setParam('functionId', $function->getId()) From 501d29f696ab84dce85e9749aa07d94bc66ea409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 27 May 2025 11:54:34 +0200 Subject: [PATCH 07/12] Implement a fix --- .../Platform/Modules/Compute/Base.php | 38 ------------- .../Http/Functions/Deployment/Update.php | 9 ++-- .../Modules/Functions/Workers/Builds.php | 53 +++++-------------- .../Sites/Http/Sites/Deployment/Update.php | 7 +-- 4 files changed, 21 insertions(+), 86 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index 46f82af661..0541df551a 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -4,7 +4,6 @@ namespace Appwrite\Platform\Modules\Compute; use Appwrite\Event\Build; use Appwrite\Extend\Exception; -use Appwrite\Query; use Utopia\Database\Database; use Utopia\Database\Document; use Utopia\Database\Helpers\ID; @@ -235,41 +234,4 @@ class Base extends Action return $deployment; } - - protected function listRules(Document $project, array $queries, Database $database, callable $callback): void - { - $limit = 100; - $cursor = null; - - do { - \var_dump("Project internal ID: " . $project->getInternalId()); - - $queries = \array_merge([ - Query::limit($limit), - Query::equal("projectInternalId", [$project->getInternalId()]) - ], $queries); - - if ($cursor !== null) { - $queries[] = Query::cursorAfter($cursor); - } - - \var_dump($queries); - $results = Authorization::skip(fn () => $database->find('rules', $queries)); - - $total = \count($results); - if ($total > 0) { - $cursor = $results[$total - 1]; - } - - if ($total < $limit) { - $cursor = null; - } - - foreach ($results as $document) { - if (is_callable($callback)) { - $callback($document); - } - } - } while (!\is_null($cursor)); - } } diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php index f57ec8483c..e840441774 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php @@ -5,7 +5,6 @@ namespace Appwrite\Platform\Modules\Functions\Http\Functions\Deployment; use Appwrite\Event\Event; use Appwrite\Extend\Exception; use Appwrite\Platform\Modules\Compute\Base; -use Appwrite\Query; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; @@ -13,6 +12,7 @@ use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; +use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; @@ -109,14 +109,15 @@ class Update extends Base Query::equal("deploymentResourceType", ["function"]), Query::equal("deploymentResourceInternalId", [$function->getInternalId()]), Query::equal("deploymentVcsProviderBranch", [""]), + Query::equal("projectInternalId", [$project->getInternalId()]) ]; - - $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { + + Authorization::skip(fn () => $dbForPlatform->foreach('rules', function (Document $rule) use ($dbForPlatform, $deployment) { $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) ->setAttribute('deploymentInternalId', $deployment->getInternalId()); Authorization::skip(fn () => $dbForPlatform->updateDocument('rules', $rule->getId(), $rule)); - }); + }, $queries)); $queueForEvents ->setParam('functionId', $function->getId()) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index b5bd2ee8e6..b05da8485b 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -1087,16 +1087,17 @@ class Builds extends Action Query::equal('deploymentResourceType', ['function']), Query::equal('trigger', ['manual']), Query::equal('deploymentVcsProviderBranch', ['']), + Query::equal("projectInternalId", [$project->getInternalId()]) ]; $rulesUpdated = false; - $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment, &$rulesUpdated) { + $dbForPlatform->forEach('rules', function (Document $rule) use ($dbForPlatform, $deployment, &$rulesUpdated) { $rulesUpdated = true; $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) ->setAttribute('deploymentInternalId', $deployment->getInternalId()); $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); - }); + }, $queries); break; case 'sites': $resource->setAttribute('deploymentId', $deployment->getId()); @@ -1112,14 +1113,15 @@ class Builds extends Action Query::equal('deploymentResourceType', ['site']), Query::equal('trigger', ['manual']), Query::equal('deploymentVcsProviderBranch', ['']), + Query::equal("projectInternalId", [$project->getInternalId()]) ]; - $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { + $dbForPlatform->forEach('rules', function (Document $rule) use ($dbForPlatform, $deployment) { $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) ->setAttribute('deploymentInternalId', $deployment->getInternalId()); $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); - }); + }, $queries); break; } @@ -1161,19 +1163,22 @@ class Builds extends Action $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); } - $this->listRules($project, [ + $queries = [ Query::equal("projectInternalId", [$project->getInternalId()]), Query::equal("type", ["deployment"]), Query::equal("deploymentResourceInternalId", [$resource->getInternalId()]), Query::equal('deploymentResourceType', ['site']), Query::equal("deploymentVcsProviderBranch", [$branchName]), Query::equal("trigger", ['manual']), - ], $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { + Query::equal("projectInternalId", [$project->getInternalId()]) + ]; + + $dbForPlatform->foreach('rules', function (Document $rule) use ($dbForPlatform, $deployment) { $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) ->setAttribute('deploymentInternalId', $deployment->getInternalId()); $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); - }); + }, $queries); } } @@ -1476,38 +1481,4 @@ class Builds extends Action } } } - - protected function listRules(Document $project, array $queries, Database $database, callable $callback): void - { - $limit = 100; - $cursor = null; - - do { - $queries = \array_merge([ - Query::limit($limit), - Query::equal("projectInternalId", [$project->getInternalId()]) - ], $queries); - - if ($cursor !== null) { - $queries[] = Query::cursorAfter($cursor); - } - - $results = $database->find('rules', $queries); - - $total = \count($results); - if ($total > 0) { - $cursor = $results[$total - 1]; - } - - if ($total < $limit) { - $cursor = null; - } - - foreach ($results as $document) { - if (is_callable($callback)) { - $callback($document); - } - } - } while (!\is_null($cursor)); - } } diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php index d28113c303..a54d0c7889 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php @@ -5,13 +5,13 @@ namespace Appwrite\Platform\Modules\Sites\Http\Sites\Deployment; use Appwrite\Event\Event; use Appwrite\Extend\Exception; use Appwrite\Platform\Modules\Compute\Base; -use Appwrite\Query; use Appwrite\SDK\AuthType; use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; @@ -101,14 +101,15 @@ class Update extends Base Query::equal("deploymentResourceType", ["site"]), Query::equal("deploymentResourceInternalId", [$site->getInternalId()]), Query::equal("deploymentVcsProviderBranch", [""]), + Query::equal("projectInternalId", [$project->getInternalId()]) ]; - $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { + Authorization::skip(fn () => $dbForPlatform->foreach('rules', function (Document $rule) use ($dbForPlatform, $deployment) { $rule = $rule ->setAttribute('deploymentId', $deployment->getId()) ->setAttribute('deploymentInternalId', $deployment->getInternalId()); Authorization::skip(fn () => $dbForPlatform->updateDocument('rules', $rule->getId(), $rule)); - }); + }, $queries)); $queueForEvents ->setParam('siteId', $site->getId()) From 320bf69208e743b9a9e3ac03f7da65f30bc0a49b Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Wed, 28 May 2025 12:50:47 +0530 Subject: [PATCH 08/12] Shorten commit url --- app/controllers/api/vcs.php | 8 ++++++- composer.lock | 24 +++++++++---------- .../Modules/Functions/Workers/Builds.php | 8 ++++++- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index a986d1004b..2529425bd1 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -293,7 +293,13 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId // VCS branch preview if (!empty($providerBranch)) { - $domain = "branch-{$providerBranch}-{$resource->getId()}-{$project->getId()}.{$sitesDomain}"; + $branchPrefix = substr($providerBranch, 0, 16); + if (strlen($providerBranch) > 16) { + $remainingChars = substr($providerBranch, 16); + $branchPrefix .= substr(hash('sha256', $remainingChars), 0, 7); + } + $resourceProjectHash = substr(hash('sha256', $resource->getId() . $project->getId()), 0, 7); + $domain = "branch-{$branchPrefix}{$resourceProjectHash}.{$sitesDomain}"; $ruleId = md5($domain); try { Authorization::skip( diff --git a/composer.lock b/composer.lock index f5b3f796c8..7f1799ac73 100644 --- a/composer.lock +++ b/composer.lock @@ -157,16 +157,16 @@ }, { "name": "appwrite/php-runtimes", - "version": "0.19.0", + "version": "0.19.1", "source": { "type": "git", "url": "https://github.com/appwrite/runtimes.git", - "reference": "8d21483efc19b9d977e323188989ee67a188464b" + "reference": "7bd0cc3cb97de625d7b07230bd91b121f88e72ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/runtimes/zipball/8d21483efc19b9d977e323188989ee67a188464b", - "reference": "8d21483efc19b9d977e323188989ee67a188464b", + "url": "https://api.github.com/repos/appwrite/runtimes/zipball/7bd0cc3cb97de625d7b07230bd91b121f88e72ae", + "reference": "7bd0cc3cb97de625d7b07230bd91b121f88e72ae", "shasum": "" }, "require": { @@ -206,9 +206,9 @@ ], "support": { "issues": "https://github.com/appwrite/runtimes/issues", - "source": "https://github.com/appwrite/runtimes/tree/0.19.0" + "source": "https://github.com/appwrite/runtimes/tree/0.19.1" }, - "time": "2025-03-25T22:37:51+00:00" + "time": "2025-05-27T07:12:56+00:00" }, { "name": "beberlei/assert", @@ -4378,16 +4378,16 @@ }, { "name": "utopia-php/storage", - "version": "0.18.12", + "version": "0.18.13", "source": { "type": "git", "url": "https://github.com/utopia-php/storage.git", - "reference": "9a2556c39b5f4d9f8e79111fd34ec889b7bb1e97" + "reference": "3d8ce53ae042173bf230445e996056c5f65ded22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/storage/zipball/9a2556c39b5f4d9f8e79111fd34ec889b7bb1e97", - "reference": "9a2556c39b5f4d9f8e79111fd34ec889b7bb1e97", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/3d8ce53ae042173bf230445e996056c5f65ded22", + "reference": "3d8ce53ae042173bf230445e996056c5f65ded22", "shasum": "" }, "require": { @@ -4430,9 +4430,9 @@ ], "support": { "issues": "https://github.com/utopia-php/storage/issues", - "source": "https://github.com/utopia-php/storage/tree/0.18.12" + "source": "https://github.com/utopia-php/storage/tree/0.18.13" }, - "time": "2025-05-15T07:55:58+00:00" + "time": "2025-05-26T13:10:35+00:00" }, { "name": "utopia-php/swoole", diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index b05da8485b..40e1aa1547 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -1132,7 +1132,13 @@ class Builds extends Action $branchName = $deployment->getAttribute('providerBranch'); if (!empty($branchName)) { $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); - $domain = "branch-{$branchName}-{$resource->getId()}-{$project->getId()}.{$sitesDomain}"; + $branchPrefix = substr($branchName, 0, 16); + if (strlen($branchName) > 16) { + $remainingChars = substr($branchName, 16); + $branchPrefix .= substr(hash('sha256', $remainingChars), 0, 7); + } + $resourceProjectHash = substr(hash('sha256', $resource->getId() . $project->getId()), 0, 7); + $domain = "branch-{$branchPrefix}{$resourceProjectHash}.{$sitesDomain}"; $ruleId = md5($domain); try { From 66ac440f9da16c82c656df7b8c8b7824ac1d6d0b Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Wed, 28 May 2025 12:55:50 +0530 Subject: [PATCH 09/12] Add missing separator --- app/controllers/api/vcs.php | 2 +- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index 2529425bd1..85c071151d 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -299,7 +299,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId $branchPrefix .= substr(hash('sha256', $remainingChars), 0, 7); } $resourceProjectHash = substr(hash('sha256', $resource->getId() . $project->getId()), 0, 7); - $domain = "branch-{$branchPrefix}{$resourceProjectHash}.{$sitesDomain}"; + $domain = "branch-{$branchPrefix}-{$resourceProjectHash}.{$sitesDomain}"; $ruleId = md5($domain); try { Authorization::skip( diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 40e1aa1547..b3d11d8b54 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -1138,7 +1138,7 @@ class Builds extends Action $branchPrefix .= substr(hash('sha256', $remainingChars), 0, 7); } $resourceProjectHash = substr(hash('sha256', $resource->getId() . $project->getId()), 0, 7); - $domain = "branch-{$branchPrefix}{$resourceProjectHash}.{$sitesDomain}"; + $domain = "branch-{$branchPrefix}-{$resourceProjectHash}.{$sitesDomain}"; $ruleId = md5($domain); try { From aa07ba002787826bd9a3f193b94cc46d7bcd85cb Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Wed, 28 May 2025 14:01:55 +0530 Subject: [PATCH 10/12] Update app/controllers/api/vcs.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matej Bačo --- app/controllers/api/vcs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index 85c071151d..f80a51d497 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -296,7 +296,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId $branchPrefix = substr($providerBranch, 0, 16); if (strlen($providerBranch) > 16) { $remainingChars = substr($providerBranch, 16); - $branchPrefix .= substr(hash('sha256', $remainingChars), 0, 7); + $branchPrefix .= '-' . substr(hash('sha256', $remainingChars), 0, 7); } $resourceProjectHash = substr(hash('sha256', $resource->getId() . $project->getId()), 0, 7); $domain = "branch-{$branchPrefix}-{$resourceProjectHash}.{$sitesDomain}"; From 707ef16f79caefd47c6d29ebaa4a94e6c98e5efc Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Wed, 28 May 2025 14:02:03 +0530 Subject: [PATCH 11/12] Update src/Appwrite/Platform/Modules/Functions/Workers/Builds.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matej Bačo --- src/Appwrite/Platform/Modules/Functions/Workers/Builds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index b3d11d8b54..de5543c9f3 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -1135,7 +1135,7 @@ class Builds extends Action $branchPrefix = substr($branchName, 0, 16); if (strlen($branchName) > 16) { $remainingChars = substr($branchName, 16); - $branchPrefix .= substr(hash('sha256', $remainingChars), 0, 7); + $branchPrefix .= '-' . substr(hash('sha256', $remainingChars), 0, 7); } $resourceProjectHash = substr(hash('sha256', $resource->getId() . $project->getId()), 0, 7); $domain = "branch-{$branchPrefix}-{$resourceProjectHash}.{$sitesDomain}"; From 814abddf937e773aafe04141ab7c849ee2c7310f Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Wed, 28 May 2025 14:10:12 +0530 Subject: [PATCH 12/12] Truncate commit hash to 16 chars --- app/controllers/api/vcs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index f80a51d497..588ca417cf 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -330,7 +330,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId // VCS commit preview if (!empty($providerCommitHash)) { - $domain = "commit-{$providerCommitHash}.{$sitesDomain}"; + $domain = "commit-" . substr($providerCommitHash, 0, 16) . ".{$sitesDomain}"; $ruleId = md5($domain); try { Authorization::skip(