diff --git a/.env b/.env index 8f7d7996e7..7c928f7715 100644 --- a/.env +++ b/.env @@ -78,7 +78,7 @@ _APP_FUNCTIONS_MAINTENANCE_INTERVAL=600 _APP_FUNCTIONS_RUNTIMES_NETWORK=runtimes _APP_EXECUTOR_SECRET=your-secret-key _APP_EXECUTOR_HOST=http://proxy/v1 -_APP_FUNCTIONS_RUNTIMES=php-8.0,node-18.0,python-3.9,ruby-3.1 +_APP_FUNCTIONS_RUNTIMES=php-8.3,php-8.0,node-18.0,python-3.9,ruby-3.1 _APP_MAINTENANCE_INTERVAL=86400 _APP_MAINTENANCE_DELAY= _APP_MAINTENANCE_RETENTION_CACHE=2592000 diff --git a/app/config/runtimes-active.php b/app/config/runtimes-active.php new file mode 100644 index 0000000000..e1b63fa208 --- /dev/null +++ b/app/config/runtimes-active.php @@ -0,0 +1,9 @@ +getAll(deprecated: false); diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index d4d5fc64cf..78418c4edb 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -151,7 +151,7 @@ App::post('/v1/functions') ->label('sdk.response.model', Response::MODEL_FUNCTION) ->param('functionId', '', new CustomId(), 'Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') ->param('name', '', new Text(128), 'Function name. Max length: 128 chars.') - ->param('runtime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Execution runtime.') + ->param('runtime', '', new WhiteList(array_keys(Config::getParam('runtimes-active')), true), 'Execution runtime.') ->param('execute', [], new Roles(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 64 characters long.', true) ->param('events', [], new ArrayList(new FunctionEvent(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Events list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' events are allowed.', true) ->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true) @@ -808,7 +808,7 @@ App::put('/v1/functions/:functionId') ->label('sdk.response.model', Response::MODEL_FUNCTION) ->param('functionId', '', new UID(), 'Function ID.') ->param('name', '', new Text(128), 'Function name. Max length: 128 chars.') - ->param('runtime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Execution runtime.', true) + ->param('runtime', '', new WhiteList(array_keys(Config::getParam('runtimes-active')), true), 'Execution runtime.', true) ->param('execute', [], new Roles(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 64 characters long.', true) ->param('events', [], new ArrayList(new FunctionEvent(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Events list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' events are allowed.', true) ->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true) @@ -2631,7 +2631,7 @@ App::get('/v1/functions/templates') ->label('sdk.response.code', Response::STATUS_CODE_OK) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_TEMPLATE_FUNCTION_LIST) - ->param('runtimes', [], new ArrayList(new WhiteList(array_keys(Config::getParam('runtimes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of runtimes allowed for filtering function templates. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' runtimes are allowed.', true) + ->param('runtimes', [], new ArrayList(new WhiteList(array_keys(Config::getParam('runtimes-active')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of runtimes allowed for filtering function templates. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' runtimes are allowed.', true) ->param('useCases', [], new ArrayList(new WhiteList(['dev-tools','starter','databases','ai','messaging','utilities']), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of use cases allowed for filtering function templates. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' use cases are allowed.', true) ->param('limit', 25, new Range(1, 5000), 'Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.', true) ->param('offset', 0, new Range(0, 5000), 'Offset the list of returned templates. Maximum offset is 5000.', true) diff --git a/app/init.php b/app/init.php index 51d9c38239..4234473f4b 100644 --- a/app/init.php +++ b/app/init.php @@ -334,6 +334,7 @@ Config::load('oAuthProviders', __DIR__ . '/config/oAuthProviders.php'); Config::load('platforms', __DIR__ . '/config/platforms.php'); Config::load('collections', __DIR__ . '/config/collections.php'); Config::load('runtimes', __DIR__ . '/config/runtimes.php'); +Config::load('runtimes-active', __DIR__ . '/config/runtimes-active.php'); Config::load('runtimes-v2', __DIR__ . '/config/runtimes-v2.php'); Config::load('usage', __DIR__ . '/config/usage.php'); Config::load('roles', __DIR__ . '/config/roles.php'); // User roles and scopes diff --git a/composer.json b/composer.json index 2612403c1a..6157b07ca0 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "ext-openssl": "*", "ext-zlib": "*", "ext-sockets": "*", - "appwrite/php-runtimes": "0.16.*", + "appwrite/php-runtimes": "dev-feat-deprecated-runtimes as 0.16.99", "appwrite/php-clamav": "2.0.*", "utopia-php/abuse": "0.46.*", "utopia-php/analytics": "0.10.*", diff --git a/composer.lock b/composer.lock index 045ef31ffa..94385108bb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7b5b5926b452186543903eb539f59c2d", + "content-hash": "dd79c2b955102247a6bd75e34969425b", "packages": [ { "name": "adhocore/jwt", @@ -157,16 +157,16 @@ }, { "name": "appwrite/php-runtimes", - "version": "0.16.5", + "version": "dev-feat-deprecated-runtimes", "source": { "type": "git", "url": "https://github.com/appwrite/runtimes.git", - "reference": "1e430646fdf847a7caf3c611dcf3d6d5a28c3fd9" + "reference": "3248bf647f53c0ed3dc3a92679f4877de7b29fc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/runtimes/zipball/1e430646fdf847a7caf3c611dcf3d6d5a28c3fd9", - "reference": "1e430646fdf847a7caf3c611dcf3d6d5a28c3fd9", + "url": "https://api.github.com/repos/appwrite/runtimes/zipball/3248bf647f53c0ed3dc3a92679f4877de7b29fc6", + "reference": "3248bf647f53c0ed3dc3a92679f4877de7b29fc6", "shasum": "" }, "require": { @@ -206,9 +206,9 @@ ], "support": { "issues": "https://github.com/appwrite/runtimes/issues", - "source": "https://github.com/appwrite/runtimes/tree/0.16.5" + "source": "https://github.com/appwrite/runtimes/tree/feat-deprecated-runtimes" }, - "time": "2024-11-25T15:17:06+00:00" + "time": "2025-01-09T11:36:01+00:00" }, { "name": "beberlei/assert", @@ -709,16 +709,16 @@ }, { "name": "google/protobuf", - "version": "v4.29.2", + "version": "v4.29.3", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "79aa5014efeeec3d137df5cdb0ae2fc163953945" + "reference": "ab5077c2cfdd1f415f42d11fdbdf903ba8e3d9b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/79aa5014efeeec3d137df5cdb0ae2fc163953945", - "reference": "79aa5014efeeec3d137df5cdb0ae2fc163953945", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/ab5077c2cfdd1f415f42d11fdbdf903ba8e3d9b7", + "reference": "ab5077c2cfdd1f415f42d11fdbdf903ba8e3d9b7", "shasum": "" }, "require": { @@ -747,9 +747,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.29.2" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.29.3" }, - "time": "2024-12-18T14:11:12+00:00" + "time": "2025-01-08T21:00:13+00:00" }, { "name": "jean85/pretty-package-versions", @@ -1237,16 +1237,16 @@ }, { "name": "open-telemetry/api", - "version": "1.1.2", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "04c85a1e41a3d59fa9bdc801a5de1df6624b95ed" + "reference": "351a30baa79699de3de3a814c8ccc7b52ccdfb1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/04c85a1e41a3d59fa9bdc801a5de1df6624b95ed", - "reference": "04c85a1e41a3d59fa9bdc801a5de1df6624b95ed", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/351a30baa79699de3de3a814c8ccc7b52ccdfb1d", + "reference": "351a30baa79699de3de3a814c8ccc7b52ccdfb1d", "shasum": "" }, "require": { @@ -1303,7 +1303,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-11-16T04:32:30+00:00" + "time": "2025-01-08T23:50:34+00:00" }, { "name": "open-telemetry/context", @@ -1366,16 +1366,16 @@ }, { "name": "open-telemetry/exporter-otlp", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/exporter-otlp.git", - "reference": "9b6de12204f25f8ab9540b46d6e7b5151897ce18" + "reference": "243d9657c44a06f740cf384f486afe954c2b725f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/9b6de12204f25f8ab9540b46d6e7b5151897ce18", - "reference": "9b6de12204f25f8ab9540b46d6e7b5151897ce18", + "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/243d9657c44a06f740cf384f486afe954c2b725f", + "reference": "243d9657c44a06f740cf384f486afe954c2b725f", "shasum": "" }, "require": { @@ -1426,7 +1426,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-04-30T18:28:30+00:00" + "time": "2025-01-08T23:50:03+00:00" }, { "name": "open-telemetry/gen-otlp-protobuf", @@ -1493,16 +1493,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.1.2", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "fb0ff8d8279a3776bd604791e2531dd0cc147e8b" + "reference": "9a1c3b866239dbff291e5cc555bb7793eab08127" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/fb0ff8d8279a3776bd604791e2531dd0cc147e8b", - "reference": "fb0ff8d8279a3776bd604791e2531dd0cc147e8b", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/9a1c3b866239dbff291e5cc555bb7793eab08127", + "reference": "9a1c3b866239dbff291e5cc555bb7793eab08127", "shasum": "" }, "require": { @@ -1579,7 +1579,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-10-18T21:01:35+00:00" + "time": "2025-01-08T23:50:34+00:00" }, { "name": "open-telemetry/sem-conv", @@ -8554,9 +8554,18 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "appwrite/php-runtimes", + "version": "dev-feat-deprecated-runtimes", + "alias": "0.16.99", + "alias_normalized": "0.16.99.0" + } + ], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": { + "appwrite/php-runtimes": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/Appwrite/Utopia/Response/Model/Runtime.php b/src/Appwrite/Utopia/Response/Model/Runtime.php index 3c328c4d40..cc0cd63d62 100644 --- a/src/Appwrite/Utopia/Response/Model/Runtime.php +++ b/src/Appwrite/Utopia/Response/Model/Runtime.php @@ -59,6 +59,13 @@ class Runtime extends Model 'example' => 'amd64', 'array' => true, ]) + ->addRule('deprecated', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Deprecated runtimes cannot be used during creation.', + 'default' => false, + 'example' => false, + 'array' => false, + ]) ; } diff --git a/tests/e2e/General/UsageTest.php b/tests/e2e/General/UsageTest.php index c50a15fd3f..6fe3eef427 100644 --- a/tests/e2e/General/UsageTest.php +++ b/tests/e2e/General/UsageTest.php @@ -862,7 +862,7 @@ class UsageTest extends Scope [ 'functionId' => 'unique()', 'name' => 'Test', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'vars' => [ 'funcKey1' => 'funcValue1', 'funcKey2' => 'funcValue2', diff --git a/tests/e2e/Services/Functions/FunctionsBase.php b/tests/e2e/Services/Functions/FunctionsBase.php index a1bb8f2b21..4db3ebdadb 100644 --- a/tests/e2e/Services/Functions/FunctionsBase.php +++ b/tests/e2e/Services/Functions/FunctionsBase.php @@ -72,6 +72,16 @@ trait FunctionsBase return $function; } + protected function updateFunction(string $functionId, mixed $params): mixed + { + $function = $this->client->call(Client::METHOD_PUT, '/functions/' . $functionId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $function; + } + protected function createVariable(string $functionId, mixed $params): mixed { $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', array_merge([ diff --git a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php index 3a02cbcba2..1883a283b1 100644 --- a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php @@ -21,7 +21,7 @@ class FunctionsConsoleClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -39,7 +39,7 @@ class FunctionsConsoleClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test Failure', 'execute' => ['some-random-string'], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', ]); diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index 914a255663..977b90644f 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -42,7 +42,7 @@ class FunctionsCustomClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -85,7 +85,7 @@ class FunctionsCustomClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::any()->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 10, ]); @@ -145,7 +145,7 @@ class FunctionsCustomClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::any()->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'vars' => [ 'funcKey1' => 'funcValue1', @@ -176,7 +176,7 @@ class FunctionsCustomClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 10, ]); @@ -196,7 +196,7 @@ class FunctionsCustomClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::any()->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 10, ]); diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 9b9f03a100..0cd00d700e 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -29,7 +29,7 @@ class FunctionsCustomServerTest extends Scope $function = $this->createFunction([ 'functionId' => ID::unique(), 'name' => 'Test', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [ 'buckets.*.create', @@ -44,7 +44,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); $this->assertNotEmpty($function['body']['$id']); $this->assertEquals('Test', $function['body']['name']); - $this->assertEquals('php-8.0', $function['body']['runtime']); + $this->assertEquals('php-8.3', $function['body']['runtime']); $this->assertEquals(true, $dateValidator->isValid($function['body']['$createdAt'])); $this->assertEquals(true, $dateValidator->isValid($function['body']['$updatedAt'])); $this->assertEquals('', $function['body']['deployment']); @@ -145,7 +145,7 @@ class FunctionsCustomServerTest extends Scope // Test search runtime $functions = $this->listFunctions([ - 'search' => 'php-8.0' + 'search' => 'php-8.3' ]); $this->assertEquals($functions['headers']['status-code'], 200); @@ -158,7 +158,7 @@ class FunctionsCustomServerTest extends Scope $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test 2', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [ 'buckets.*.create', @@ -251,7 +251,7 @@ class FunctionsCustomServerTest extends Scope ], 'schedule' => '0 0 1 1 *', 'timeout' => 15, - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', ]); @@ -287,7 +287,7 @@ class FunctionsCustomServerTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -328,7 +328,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(200, $starterTemplate['headers']['status-code']); $phpRuntime = array_values(array_filter($starterTemplate['body']['runtimes'], function ($runtime) { - return $runtime['name'] === 'php-8.0'; + return $runtime['name'] === 'php-8.3'; }))[0]; // If this fails, the template has variables, and this test needs to be updated @@ -338,7 +338,7 @@ class FunctionsCustomServerTest extends Scope [ 'functionId' => ID::unique(), 'name' => $starterTemplate['body']['name'], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'execute' => $starterTemplate['body']['permissions'], 'entrypoint' => $phpRuntime['entrypoint'], 'events' => $starterTemplate['body']['events'], @@ -683,7 +683,7 @@ class FunctionsCustomServerTest extends Scope $this->assertCount(0, $deployments['body']['deployments']); $deployments = $this->listDeployments($functionId, [ - 'search' => 'php-8.0' + 'search' => 'php-8.3' ]); $this->assertEquals($deployments['headers']['status-code'], 200); @@ -1076,7 +1076,7 @@ class FunctionsCustomServerTest extends Scope 'users.*.update.email', ], 'timeout' => 15, - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'specification' => Specification::S_1VCPU_1GB, ]); @@ -1104,7 +1104,7 @@ class FunctionsCustomServerTest extends Scope 'users.*.update.email', ], 'timeout' => 15, - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'specification' => Specification::S_1VCPU_512MB, ]); @@ -1134,7 +1134,7 @@ class FunctionsCustomServerTest extends Scope 'users.*.update.email', ], 'timeout' => 15, - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'specification' => 's-2vcpu-512mb', // Invalid specification ]); @@ -1192,8 +1192,8 @@ class FunctionsCustomServerTest extends Scope { $functionId = $this->setupFunction([ 'functionId' => ID::unique(), - 'name' => 'Test php-8.0', - 'runtime' => 'php-8.0', + 'name' => 'Test php-8.3', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [], 'schedule' => '', @@ -1237,7 +1237,7 @@ class FunctionsCustomServerTest extends Scope public function provideCustomExecutions(): array { return [ - ['folder' => 'php-fn', 'name' => 'php-8.0', 'entrypoint' => 'index.php', 'runtimeName' => 'PHP', 'runtimeVersion' => '8.0'], + ['folder' => 'php-fn', 'name' => 'php-8.3', 'entrypoint' => 'index.php', 'runtimeName' => 'PHP', 'runtimeVersion' => '8.0'], ['folder' => 'node', 'name' => 'node-18.0', 'entrypoint' => 'index.js', 'runtimeName' => 'Node.js', 'runtimeVersion' => '18.0'], ['folder' => 'python', 'name' => 'python-3.9', 'entrypoint' => 'main.py', 'runtimeName' => 'Python', 'runtimeVersion' => '3.9'], ['folder' => 'ruby', 'name' => 'ruby-3.1', 'entrypoint' => 'main.rb', 'runtimeName' => 'Ruby', 'runtimeVersion' => '3.1'], @@ -1323,7 +1323,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test PHP Binary executions', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 15, 'execute' => ['any'] @@ -1372,7 +1372,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test PHP Binary executions', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 15, 'execute' => ['any'] @@ -1422,7 +1422,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test PHP V2', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [], 'timeout' => 15, @@ -1488,7 +1488,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test PHP Event executions', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -1542,7 +1542,7 @@ class FunctionsCustomServerTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test PHP Scopes executions', 'commands' => 'sh setup.sh && composer install', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'scopes' => ['users.read'], 'timeout' => 15, @@ -1600,7 +1600,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test PHP Cookie executions', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 15, ]); @@ -1632,7 +1632,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test PHP Cookie executions', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 15, 'execute' => ['any'] @@ -1708,7 +1708,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test PHP Binary executions', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 15, 'execute' => ['any'] @@ -1758,7 +1758,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test PHP Binary executions', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 15, 'execute' => ['any'] @@ -1810,7 +1810,7 @@ class FunctionsCustomServerTest extends Scope ], $this->getHeaders()), [ 'functionId' => ID::unique(), 'name' => 'Test', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 15, ]); @@ -1845,7 +1845,7 @@ class FunctionsCustomServerTest extends Scope $function1Id = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 15, 'execute' => ['any'] @@ -1854,7 +1854,7 @@ class FunctionsCustomServerTest extends Scope $function2Id = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test2', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 15, 'execute' => ['any'] @@ -1984,4 +1984,37 @@ class FunctionsCustomServerTest extends Scope $this->cleanupFunction($functionId); } + + public function testFunctionDeprecatedRuntime(): void + { + $function = $this->createFunction([ + 'functionId' => ID::unique(), + 'name' => 'Deprecated runtime', + 'execute' => [Role::user($this->getUser()['$id'])->toString()], + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + ]); + + $this->assertEquals(400, $function['headers']['status-code']); + + $function = $this->createFunction([ + 'functionId' => ID::unique(), + 'name' => 'Active runtime', + 'execute' => [Role::user($this->getUser()['$id'])->toString()], + 'runtime' => 'php-8.3', + 'entrypoint' => 'index.php', + ]); + + $this->assertEquals(201, $function['headers']['status-code']); + $functionId = $function['body']['$id']; + + $function = $this->updateFunction($functionId, [ + 'name' => 'Active runtime', + 'execute' => [Role::user($this->getUser()['$id'])->toString()], + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + ]); + + $this->assertEquals(400, $function['headers']['status-code']); + } } diff --git a/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php b/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php index 4f4b0c960d..87bf0d9842 100644 --- a/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php +++ b/tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php @@ -25,7 +25,7 @@ class FunctionsScheduleTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -77,7 +77,7 @@ class FunctionsScheduleTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 10, 'logging' => true, @@ -179,7 +179,7 @@ class FunctionsScheduleTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 10, 'logging' => true, diff --git a/tests/e2e/Services/GraphQL/FunctionsClientTest.php b/tests/e2e/Services/GraphQL/FunctionsClientTest.php index e7e8421254..c799d5d918 100644 --- a/tests/e2e/Services/GraphQL/FunctionsClientTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsClientTest.php @@ -24,7 +24,7 @@ class FunctionsClientTest extends Scope 'variables' => [ 'functionId' => ID::unique(), 'name' => 'Test Function', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'execute' => [Role::any()->toString()], ] diff --git a/tests/e2e/Services/GraphQL/FunctionsServerTest.php b/tests/e2e/Services/GraphQL/FunctionsServerTest.php index c3606244c4..918444a3d2 100644 --- a/tests/e2e/Services/GraphQL/FunctionsServerTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsServerTest.php @@ -25,7 +25,7 @@ class FunctionsServerTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test Function', 'entrypoint' => 'index.php', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'execute' => [Role::any()->toString()], ] ]; @@ -410,7 +410,7 @@ class FunctionsServerTest extends Scope 'name' => 'Test Function Updated', 'execute' => [Role::any()->toString()], 'entrypoint' => 'index.php', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'vars' => [ 'name' => 'John Doe', 'age' => 42, diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index e4c7ba7712..d25272ae99 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -799,7 +799,7 @@ trait MigrationsBase $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php' ]); @@ -849,7 +849,7 @@ trait MigrationsBase $this->assertEquals($functionId, $response['body']['$id']); $this->assertEquals('Test', $response['body']['name']); - $this->assertEquals('php-8.0', $response['body']['runtime']); + $this->assertEquals('php-8.3', $response['body']['runtime']); $this->assertEquals('index.php', $response['body']['entrypoint']); diff --git a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php index 0155d251f2..49cfe068a3 100644 --- a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php @@ -524,7 +524,7 @@ class RealtimeConsoleClientTest extends Scope ], $this->getHeaders()), [ 'functionId' => ID::unique(), 'name' => 'Test', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', diff --git a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php index dda524fc7c..011847e827 100644 --- a/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeCustomClientTest.php @@ -1286,7 +1286,7 @@ class RealtimeCustomClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => ['users'], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 10, ]); diff --git a/tests/e2e/Services/VCS/VCSConsoleClientTest.php b/tests/e2e/Services/VCS/VCSConsoleClientTest.php index f04667a0f5..24ae4a5055 100644 --- a/tests/e2e/Services/VCS/VCSConsoleClientTest.php +++ b/tests/e2e/Services/VCS/VCSConsoleClientTest.php @@ -279,7 +279,7 @@ class VCSConsoleClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -294,7 +294,7 @@ class VCSConsoleClientTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); $this->assertEquals('Test', $function['body']['name']); - $this->assertEquals('php-8.0', $function['body']['runtime']); + $this->assertEquals('php-8.3', $function['body']['runtime']); $this->assertEquals('index.php', $function['body']['entrypoint']); $this->assertEquals('705764267', $function['body']['providerRepositoryId']); $this->assertEquals('main', $function['body']['providerBranch']); @@ -317,7 +317,7 @@ class VCSConsoleClientTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::user($this->getUser()['$id'])->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'events' => [ 'users.*.create', @@ -332,7 +332,7 @@ class VCSConsoleClientTest extends Scope $this->assertEquals(200, $function['headers']['status-code']); $this->assertEquals('Test', $function['body']['name']); - $this->assertEquals('php-8.0', $function['body']['runtime']); + $this->assertEquals('php-8.3', $function['body']['runtime']); $this->assertEquals('index.php', $function['body']['entrypoint']); $this->assertEquals('708688544', $function['body']['providerRepositoryId']); $this->assertEquals('main', $function['body']['providerBranch']); diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index d2f132e960..dd6c5ab659 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -399,7 +399,7 @@ class WebhooksCustomServerTest extends Scope 'functionId' => ID::unique(), 'name' => 'Test', 'execute' => [Role::any()->toString()], - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'timeout' => 10, ]); @@ -439,7 +439,7 @@ class WebhooksCustomServerTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ 'name' => 'Test', - 'runtime' => 'php-8.0', + 'runtime' => 'php-8.3', 'entrypoint' => 'index.php', 'execute' => [Role::any()->toString()], 'vars' => [