docs: document the compatibility check and the Function Runtime CatalogueUnverified
7df8b59 parent: 37de7fd modified
README.md +55 -2 | @@ -20,6 +20,7 @@ Vocabulary (Invocation, Event, Warm Process...) is defined in [GLOSSARY.md](GLOS | ||
| 20 | 20 | - [Supported Applications](#supported-applications) |
| 21 | 21 | - [Static Files](#static-files) |
| 22 | 22 | - [CRON triggers and Command Invocations](#cron-triggers-and-command-invocations) |
| 23 | +- [Compatibility check](#compatibility-check) | |
| 23 | 24 | - [Packaging](#packaging) |
| 24 | 25 | - [Deployment](#deployment) |
| 25 | 26 | - [Logs](#logs) |
| @@ -410,12 +411,62 @@ Keep in mind that: | ||
| 410 | 411 | |
| 411 | 412 | See [ADR 0005](docs/adr/0005-authenticate-command-invocations-with-a-shared-secret.md) for the alternatives considered. |
| 412 | 413 | |
| 414 | +## Compatibility check | |
| 415 | + | |
| 416 | +```sh | |
| 417 | +vendor/bin/scaleway-doctor --runtime=php84 | |
| 418 | +``` | |
| 419 | + | |
| 420 | +A Platform Requirement (`php` or `ext-*`) the Function Runtime does not meet makes Scaleway's `composer install` fail at deploy time, without failing the deployment: every Invocation then answers a `500` (see [Composer at deploy time](#composer-at-deploy-time)). | |
| 421 | +`scaleway-doctor` checks, before you deploy, the Platform Requirements that install checks, against the Function Runtime the function declares, named by `--runtime` (`php84` or `php85`). | |
| 422 | +It never guesses it from your local PHP. | |
| 423 | +It reads `composer.json` and `composer.lock`, needs neither Scaleway credentials nor network access, and refuses a stale lock as [`scaleway-package`](#packaging) does. | |
| 424 | + | |
| 425 | +It checks what `composer install --no-dev` checks on Scaleway: | |
| 426 | + | |
| 427 | +- the root requirements the lock records, and those of every locked production package, development ones excluded; | |
| 428 | +- each one met by the Function Runtime, or by a `provide` or `replace` of the application or of a locked package; | |
| 429 | +- constraints evaluated by Composer's own engine, against the PHP and extension versions Composer would see on Scaleway. | |
| 430 | + | |
| 431 | +Each requirement is: | |
| 432 | + | |
| 433 | +- **satisfied**, when the measured version matches; | |
| 434 | +- **incompatible**, when the extension is not loaded, or the measured version of PHP or of the extension does not match; | |
| 435 | +- **unknown**, for the platform packages the catalogue does not measure, as `lib-icu` or `php-64bit`. | |
| 436 | + | |
| 437 | +Composer's own APIs (`composer`, `composer-plugin-api`, `composer-runtime-api`) are not checked: Scaleway installs with Composer 2. | |
| 438 | + | |
| 439 | +The report, on stderr, lists the incompatible and unknown requirements, with what declares them and what the Function Runtime provides: | |
| 440 | + | |
| 441 | +```text | |
| 442 | +INCOMPATIBLE ext-foo * required by acme/bar v2.1.0 php84: not loaded (measured 2026-11-22) | |
| 443 | + php85 meets it: deploy on php85, or use Serverless Containers for custom extensions or versions. | |
| 444 | +UNKNOWN lib-icu >=72 required by symfony/intl v8.0.3 not in the Function Runtime Catalogue | |
| 445 | + | |
| 446 | +48 satisfied, 1 unknown, 1 incompatible on php84 (measured 2026-11-22) | |
| 447 | +This covers declared Platform Requirements only, not whether the application runs. | |
| 448 | +``` | |
| 449 | + | |
| 450 | +It exits with `0` when every requirement is satisfied or only unknowns remain, and with `1` on an incompatible requirement or an invalid input. | |
| 451 | +For an incompatible requirement, it names the other Function Runtimes that meet it, if any. | |
| 452 | +Otherwise, custom extensions or versions need [Serverless Containers](https://www.scaleway.com/en/serverless-containers/), which this package does not target. | |
| 453 | + | |
| 454 | +What each Function Runtime provides comes from the Function Runtime Catalogue shipped with the package, [resources/function-runtimes.php](resources/function-runtimes.php). | |
| 455 | +It holds measurements only, made on Scaleway with the [probe](probe), each a complete inventory: an extension it does not list is not loaded. | |
| 456 | +A measurement describes the Function Runtime on its date, which the report shows, not a guarantee that Scaleway keeps the same versions. | |
| 457 | +The measured PHP patch version is authoritative: if Scaleway has upgraded PHP since, update the package for a newer catalogue. | |
| 458 | + | |
| 459 | +The [Emulator](#local-development-with-the-emulator) runs on your local PHP, which may load extensions or versions the Function Runtime lacks: an application working locally can still fail to install on Scaleway, which is what this check catches. | |
| 460 | +A successful check covers declared Platform Requirements only: an extension used without being required is not checked, and calling a route after the deployment, as [Composer at deploy time](#composer-at-deploy-time) shows, remains the proof that it works. | |
| 461 | + | |
| 413 | 462 | ## Packaging |
| 414 | 463 | |
| 415 | 464 | ```sh |
| 416 | -vendor/bin/scaleway-package [function.zip] | |
| 465 | +vendor/bin/scaleway-package [--runtime=php84] [function.zip] | |
| 417 | 466 | ``` |
| 418 | 467 | |
| 468 | +With `--runtime`, it first runs the [compatibility check](#compatibility-check) against that Function Runtime, and refuses to build the zip on an incompatible Platform Requirement. | |
| 469 | + | |
| 419 | 470 | It zips your application as it is, `composer.json` and `composer.lock` included, but without `vendor/` nor `var/`: Scaleway runs `composer install --no-dev` from the shipped lock at deploy time, Composer scripts included, and replaces any shipped `vendor/` ([ADR 0008](docs/adr/0008-let-scaleway-install-the-dependencies.md)). |
| 420 | 471 | Executable bits are kept, and symbolic links are followed: their target is zipped. |
| 421 | 472 | |
| @@ -590,6 +641,7 @@ Headers whose name holds an underscore (`X_Real_Ip`) are dropped, as nginx and A | ||
| 590 | 641 | Scaleway runs `composer install --no-dev` in the function's directory when the zip holds a `composer.json` at its root, replacing any shipped `vendor/`. |
| 591 | 642 | Every locked package must therefore be downloadable from Scaleway, and the function's environment variables are not available to Composer scripts. |
| 592 | 643 | The lock must also install on the function's runtime: set `config.platform.php` in `composer.json` to its PHP version (`8.4` for `php84`, `8.5` for `php85`) so that `composer update` resolves for it. |
| 644 | +`config.platform` only steers Composer's resolution: run the [compatibility check](#compatibility-check), or package with `--runtime`, to check the lock against what Scaleway provides. | |
| 593 | 645 | A failing install or script does not fail the deployment, and Scaleway serves the new code anyway, never the previous version ([measured](docs/probe-results.md#failed-scripts-and-installs)): |
| 594 | 646 | |
| 595 | 647 | - a failing script runs once `vendor/` and its autoloader are complete, so the new code works, without what the script should have done (a warmed cache, generated files...); |
| @@ -620,13 +672,14 @@ composer cs-fix # applies the coding style | ||
| 620 | 672 | CI runs `composer validate --strict` and `composer check` on PHP 8.4 and 8.5, each against Symfony 7.4 and 8.x, the whole Symfony stack being pinned through Flex's `SYMFONY_REQUIRE`. |
| 621 | 673 | It also runs the [end-to-end scenarios](example/e2e/run.sh) of the [example application](example) through the Emulator, in dev and on its zip installed like Scaleway does ([e2e/deploy-locally.sh](example/e2e/deploy-locally.sh)). |
| 622 | 674 | The example installs the runtime of the checkout with `composer link-runtime`, see its [README](example/README.md#run-it-locally). |
| 675 | +A weekly workflow measures the Function Runtimes on Scaleway again, and opens a pull request when the catalogue changes, see [docs/probe-results.md](docs/probe-results.md#function-runtime-catalogue). | |
| 623 | 676 | |
| 624 | 677 | The repository holds: |
| 625 | 678 | |
| 626 | 679 | - `src/`, `bin/`, `resources/`: the package; |
| 627 | 680 | - `tests/`: PHPUnit tests, packaging included; |
| 628 | 681 | - `example/`: a demo Symfony application requiring the package, with Terraform code to deploy it; |
| 629 | -- `probe/`: a dependency-free function measuring the platform facts, and its [results](docs/probe-results.md); | |
| 682 | +- `probe/`: a dependency-free function measuring the platform facts, its [results](docs/probe-results.md), and the generator of the [Function Runtime Catalogue](docs/probe-results.md#function-runtime-catalogue); | |
| 630 | 683 | - `docs/`: the [ADRs](docs/adr). |
| 631 | 684 | |
| 632 | 685 | ## License |
| @@ -20,6 +20,7 @@ Vocabulary (Invocation, Event, Warm Process...) is defined in [GLOSSARY.md](GLOS | |||
| 20 | - [Supported Applications](#supported-applications) | 20 | - [Supported Applications](#supported-applications) |
| 21 | - [Static Files](#static-files) | 21 | - [Static Files](#static-files) |
| 22 | - [CRON triggers and Command Invocations](#cron-triggers-and-command-invocations) | 22 | - [CRON triggers and Command Invocations](#cron-triggers-and-command-invocations) |
| 23 | +- [Compatibility check](#compatibility-check) | ||
| 23 | - [Packaging](#packaging) | 24 | - [Packaging](#packaging) |
| 24 | - [Deployment](#deployment) | 25 | - [Deployment](#deployment) |
| 25 | - [Logs](#logs) | 26 | - [Logs](#logs) |
| @@ -410,12 +411,62 @@ Keep in mind that: | |||
| 410 | 411 | ||
| 411 | See [ADR 0005](docs/adr/0005-authenticate-command-invocations-with-a-shared-secret.md) for the alternatives considered. | 412 | See [ADR 0005](docs/adr/0005-authenticate-command-invocations-with-a-shared-secret.md) for the alternatives considered. |
| 412 | 413 | ||
| 414 | +## Compatibility check | ||
| 415 | + | ||
| 416 | +```sh | ||
| 417 | +vendor/bin/scaleway-doctor --runtime=php84 | ||
| 418 | +``` | ||
| 419 | + | ||
| 420 | +A Platform Requirement (`php` or `ext-*`) the Function Runtime does not meet makes Scaleway's `composer install` fail at deploy time, without failing the deployment: every Invocation then answers a `500` (see [Composer at deploy time](#composer-at-deploy-time)). | ||
| 421 | +`scaleway-doctor` checks, before you deploy, the Platform Requirements that install checks, against the Function Runtime the function declares, named by `--runtime` (`php84` or `php85`). | ||
| 422 | +It never guesses it from your local PHP. | ||
| 423 | +It reads `composer.json` and `composer.lock`, needs neither Scaleway credentials nor network access, and refuses a stale lock as [`scaleway-package`](#packaging) does. | ||
| 424 | + | ||
| 425 | +It checks what `composer install --no-dev` checks on Scaleway: | ||
| 426 | + | ||
| 427 | +- the root requirements the lock records, and those of every locked production package, development ones excluded; | ||
| 428 | +- each one met by the Function Runtime, or by a `provide` or `replace` of the application or of a locked package; | ||
| 429 | +- constraints evaluated by Composer's own engine, against the PHP and extension versions Composer would see on Scaleway. | ||
| 430 | + | ||
| 431 | +Each requirement is: | ||
| 432 | + | ||
| 433 | +- **satisfied**, when the measured version matches; | ||
| 434 | +- **incompatible**, when the extension is not loaded, or the measured version of PHP or of the extension does not match; | ||
| 435 | +- **unknown**, for the platform packages the catalogue does not measure, as `lib-icu` or `php-64bit`. | ||
| 436 | + | ||
| 437 | +Composer's own APIs (`composer`, `composer-plugin-api`, `composer-runtime-api`) are not checked: Scaleway installs with Composer 2. | ||
| 438 | + | ||
| 439 | +The report, on stderr, lists the incompatible and unknown requirements, with what declares them and what the Function Runtime provides: | ||
| 440 | + | ||
| 441 | +```text | ||
| 442 | +INCOMPATIBLE ext-foo * required by acme/bar v2.1.0 php84: not loaded (measured 2026-11-22) | ||
| 443 | + php85 meets it: deploy on php85, or use Serverless Containers for custom extensions or versions. | ||
| 444 | +UNKNOWN lib-icu >=72 required by symfony/intl v8.0.3 not in the Function Runtime Catalogue | ||
| 445 | + | ||
| 446 | +48 satisfied, 1 unknown, 1 incompatible on php84 (measured 2026-11-22) | ||
| 447 | +This covers declared Platform Requirements only, not whether the application runs. | ||
| 448 | +``` | ||
| 449 | + | ||
| 450 | +It exits with `0` when every requirement is satisfied or only unknowns remain, and with `1` on an incompatible requirement or an invalid input. | ||
| 451 | +For an incompatible requirement, it names the other Function Runtimes that meet it, if any. | ||
| 452 | +Otherwise, custom extensions or versions need [Serverless Containers](https://www.scaleway.com/en/serverless-containers/), which this package does not target. | ||
| 453 | + | ||
| 454 | +What each Function Runtime provides comes from the Function Runtime Catalogue shipped with the package, [resources/function-runtimes.php](resources/function-runtimes.php). | ||
| 455 | +It holds measurements only, made on Scaleway with the [probe](probe), each a complete inventory: an extension it does not list is not loaded. | ||
| 456 | +A measurement describes the Function Runtime on its date, which the report shows, not a guarantee that Scaleway keeps the same versions. | ||
| 457 | +The measured PHP patch version is authoritative: if Scaleway has upgraded PHP since, update the package for a newer catalogue. | ||
| 458 | + | ||
| 459 | +The [Emulator](#local-development-with-the-emulator) runs on your local PHP, which may load extensions or versions the Function Runtime lacks: an application working locally can still fail to install on Scaleway, which is what this check catches. | ||
| 460 | +A successful check covers declared Platform Requirements only: an extension used without being required is not checked, and calling a route after the deployment, as [Composer at deploy time](#composer-at-deploy-time) shows, remains the proof that it works. | ||
| 461 | + | ||
| 413 | ## Packaging | 462 | ## Packaging |
| 414 | 463 | ||
| 415 | ```sh | 464 | ```sh |
| 416 | -vendor/bin/scaleway-package [function.zip] | 465 | +vendor/bin/scaleway-package [--runtime=php84] [function.zip] |
| 417 | ``` | 466 | ``` |
| 418 | 467 | ||
| 468 | +With `--runtime`, it first runs the [compatibility check](#compatibility-check) against that Function Runtime, and refuses to build the zip on an incompatible Platform Requirement. | ||
| 469 | + | ||
| 419 | It zips your application as it is, `composer.json` and `composer.lock` included, but without `vendor/` nor `var/`: Scaleway runs `composer install --no-dev` from the shipped lock at deploy time, Composer scripts included, and replaces any shipped `vendor/` ([ADR 0008](docs/adr/0008-let-scaleway-install-the-dependencies.md)). | 470 | It zips your application as it is, `composer.json` and `composer.lock` included, but without `vendor/` nor `var/`: Scaleway runs `composer install --no-dev` from the shipped lock at deploy time, Composer scripts included, and replaces any shipped `vendor/` ([ADR 0008](docs/adr/0008-let-scaleway-install-the-dependencies.md)). |
| 420 | Executable bits are kept, and symbolic links are followed: their target is zipped. | 471 | Executable bits are kept, and symbolic links are followed: their target is zipped. |
| 421 | 472 | ||
| @@ -590,6 +641,7 @@ Headers whose name holds an underscore (`X_Real_Ip`) are dropped, as nginx and A | |||
| 590 | Scaleway runs `composer install --no-dev` in the function's directory when the zip holds a `composer.json` at its root, replacing any shipped `vendor/`. | 641 | Scaleway runs `composer install --no-dev` in the function's directory when the zip holds a `composer.json` at its root, replacing any shipped `vendor/`. |
| 591 | Every locked package must therefore be downloadable from Scaleway, and the function's environment variables are not available to Composer scripts. | 642 | Every locked package must therefore be downloadable from Scaleway, and the function's environment variables are not available to Composer scripts. |
| 592 | The lock must also install on the function's runtime: set `config.platform.php` in `composer.json` to its PHP version (`8.4` for `php84`, `8.5` for `php85`) so that `composer update` resolves for it. | 643 | The lock must also install on the function's runtime: set `config.platform.php` in `composer.json` to its PHP version (`8.4` for `php84`, `8.5` for `php85`) so that `composer update` resolves for it. |
| 644 | +`config.platform` only steers Composer's resolution: run the [compatibility check](#compatibility-check), or package with `--runtime`, to check the lock against what Scaleway provides. | ||
| 593 | A failing install or script does not fail the deployment, and Scaleway serves the new code anyway, never the previous version ([measured](docs/probe-results.md#failed-scripts-and-installs)): | 645 | A failing install or script does not fail the deployment, and Scaleway serves the new code anyway, never the previous version ([measured](docs/probe-results.md#failed-scripts-and-installs)): |
| 594 | 646 | ||
| 595 | - a failing script runs once `vendor/` and its autoloader are complete, so the new code works, without what the script should have done (a warmed cache, generated files...); | 647 | - a failing script runs once `vendor/` and its autoloader are complete, so the new code works, without what the script should have done (a warmed cache, generated files...); |
| @@ -620,13 +672,14 @@ composer cs-fix # applies the coding style | |||
| 620 | CI runs `composer validate --strict` and `composer check` on PHP 8.4 and 8.5, each against Symfony 7.4 and 8.x, the whole Symfony stack being pinned through Flex's `SYMFONY_REQUIRE`. | 672 | CI runs `composer validate --strict` and `composer check` on PHP 8.4 and 8.5, each against Symfony 7.4 and 8.x, the whole Symfony stack being pinned through Flex's `SYMFONY_REQUIRE`. |
| 621 | It also runs the [end-to-end scenarios](example/e2e/run.sh) of the [example application](example) through the Emulator, in dev and on its zip installed like Scaleway does ([e2e/deploy-locally.sh](example/e2e/deploy-locally.sh)). | 673 | It also runs the [end-to-end scenarios](example/e2e/run.sh) of the [example application](example) through the Emulator, in dev and on its zip installed like Scaleway does ([e2e/deploy-locally.sh](example/e2e/deploy-locally.sh)). |
| 622 | The example installs the runtime of the checkout with `composer link-runtime`, see its [README](example/README.md#run-it-locally). | 674 | The example installs the runtime of the checkout with `composer link-runtime`, see its [README](example/README.md#run-it-locally). |
| 675 | +A weekly workflow measures the Function Runtimes on Scaleway again, and opens a pull request when the catalogue changes, see [docs/probe-results.md](docs/probe-results.md#function-runtime-catalogue). | ||
| 623 | 676 | ||
| 624 | The repository holds: | 677 | The repository holds: |
| 625 | 678 | ||
| 626 | - `src/`, `bin/`, `resources/`: the package; | 679 | - `src/`, `bin/`, `resources/`: the package; |
| 627 | - `tests/`: PHPUnit tests, packaging included; | 680 | - `tests/`: PHPUnit tests, packaging included; |
| 628 | - `example/`: a demo Symfony application requiring the package, with Terraform code to deploy it; | 681 | - `example/`: a demo Symfony application requiring the package, with Terraform code to deploy it; |
| 629 | -- `probe/`: a dependency-free function measuring the platform facts, and its [results](docs/probe-results.md); | 682 | +- `probe/`: a dependency-free function measuring the platform facts, its [results](docs/probe-results.md), and the generator of the [Function Runtime Catalogue](docs/probe-results.md#function-runtime-catalogue); |
| 630 | - `docs/`: the [ADRs](docs/adr). | 683 | - `docs/`: the [ADRs](docs/adr). |
| 631 | 684 | ||
| 632 | ## License | 685 | ## License |
modified
docs/probe-results.md +33 -0 | @@ -45,6 +45,39 @@ Measured on 2026-11-14 on `php85` with a scratch function requiring `psr/log`, w | ||
| 45 | 45 | - Nothing tells a failed deployment from a successful one: the status, `error_message`, `build_message` and `runtime_message` (empty) are the same, and Composer's output reaches neither Cockpit (no entry under the function's `resource_id`, nor anywhere in the project's logs) nor any `scw function` command. |
| 46 | 46 | - The new instance logs `Function is not ready to serve requests yet...` and `Function is now ready to serve requests!` as usual, and the previous one `Forked function has terminated` about 40 seconds later. |
| 47 | 47 | |
| 48 | +## Function Runtime Catalogue | |
| 49 | + | |
| 50 | +Measured on 2026-11-22 with the probe's `runtime` mode on `php84` and `php85`, region `fr-par`, the probe deployed with its Terraform for each, then destroyed. | |
| 51 | + | |
| 52 | +| Function Runtime | PHP | Loaded extensions | Without `phpversion()` | | |
| 53 | +| --- | --- | --- | --- | | |
| 54 | +| `php84` | 8.4.28 | 123 | none | | |
| 55 | +| `php85` | 8.5.13 | 120 | none | | |
| 56 | + | |
| 57 | +- `php84` loads `geospatial`, `memcache`, `parle`, `php_trie` and `Stomp`, which `php85` does not; `php85` loads `lexbor` and `uri`, new in PHP 8.5. | |
| 58 | +- Bundled extensions report the PHP version; `dom` reports `20031129`, and `mysqlnd` reports `mysqlnd 8.4.28`, which Composer cannot parse and sees as version `0`, as the catalogue records it. | |
| 59 | +- Scaleway upgraded PHP on both Function Runtimes within eight days, without notice: `php84` from 8.4.27 to 8.4.28, `php85` from 8.5.12 to 8.5.13. | |
| 60 | + | |
| 61 | +The raw outputs are [tests/Fixtures/FunctionRuntimes](../tests/Fixtures/FunctionRuntimes), from which [probe/catalogue.php](../probe/catalogue.php) generates [resources/function-runtimes.php](../resources/function-runtimes.php), naming and versioning PHP and its extensions as Composer's `PlatformRepository` does. | |
| 62 | +A test fails when the catalogue is not the one the fixtures generate. | |
| 63 | +The list of Function Runtimes follows [Scaleway's runtime reference](https://www.scaleway.com/en/docs/serverless-functions/reference-content/functions-runtimes/), restricted to those the package's `php` requirement allows. | |
| 64 | + | |
| 65 | +### Updating the catalogue | |
| 66 | + | |
| 67 | +The [Function Runtime Catalogue workflow](../.github/workflows/function-runtimes.yml) runs every Monday, and by hand from the Actions tab before each release: | |
| 68 | + | |
| 69 | +1. it deploys the probe on each Function Runtime, saves its `?mode=runtime` output as the fixture, and destroys the probe whatever the outcome; | |
| 70 | +2. it regenerates the catalogue, and does nothing more when only the measurement dates changed; | |
| 71 | +3. otherwise it opens a pull request from the `catalogue-update` branch, or force-pushes the open one, listing the changes. | |
| 72 | + | |
| 73 | +It needs the repository secrets `SCW_ACCESS_KEY`, `SCW_SECRET_KEY` and `SCW_DEFAULT_PROJECT_ID`, for an API key limited to Serverless Functions in a project dedicated to the probe. | |
| 74 | +Pull requests opened with the default token do not trigger the CI: set a `CATALOGUE_PR_TOKEN` secret, a fine-grained token with the contents and pull requests permissions, for the CI to check them. | |
| 75 | +A failed deployment or query fails the job, without retry. | |
| 76 | +Merging does not release: users get the new catalogue with the next version. | |
| 77 | + | |
| 78 | +By hand, deploy the probe as its [README](../probe/README.md) says, save `curl -sS "$PROBE_URL/?mode=runtime"` as `tests/Fixtures/FunctionRuntimes/<runtime>.json` for each Function Runtime, and run `php probe/catalogue.php`, which prints what changed. | |
| 79 | +A new Function Runtime gets its own fixture; the script names it after the PHP version measured, and refuses two fixtures of the same one. | |
| 80 | + | |
| 48 | 81 | ## HTTP Event |
| 49 | 82 | |
| 50 | 83 | Keys: `resource`, `path`, `httpMethod`, `headers`, `multiValueHeaders` (null), `queryStringParameters`, `multiValueQueryStringParameters` (null), `pathParameters` (null), `stageVariables`, `requestContext` (with `httpMethod`), `body`, `isBase64Encoded`. |
| @@ -45,6 +45,39 @@ Measured on 2026-11-14 on `php85` with a scratch function requiring `psr/log`, w | |||
| 45 | - Nothing tells a failed deployment from a successful one: the status, `error_message`, `build_message` and `runtime_message` (empty) are the same, and Composer's output reaches neither Cockpit (no entry under the function's `resource_id`, nor anywhere in the project's logs) nor any `scw function` command. | 45 | - Nothing tells a failed deployment from a successful one: the status, `error_message`, `build_message` and `runtime_message` (empty) are the same, and Composer's output reaches neither Cockpit (no entry under the function's `resource_id`, nor anywhere in the project's logs) nor any `scw function` command. |
| 46 | - The new instance logs `Function is not ready to serve requests yet...` and `Function is now ready to serve requests!` as usual, and the previous one `Forked function has terminated` about 40 seconds later. | 46 | - The new instance logs `Function is not ready to serve requests yet...` and `Function is now ready to serve requests!` as usual, and the previous one `Forked function has terminated` about 40 seconds later. |
| 47 | 47 | ||
| 48 | +## Function Runtime Catalogue | ||
| 49 | + | ||
| 50 | +Measured on 2026-11-22 with the probe's `runtime` mode on `php84` and `php85`, region `fr-par`, the probe deployed with its Terraform for each, then destroyed. | ||
| 51 | + | ||
| 52 | +| Function Runtime | PHP | Loaded extensions | Without `phpversion()` | | ||
| 53 | +| --- | --- | --- | --- | | ||
| 54 | +| `php84` | 8.4.28 | 123 | none | | ||
| 55 | +| `php85` | 8.5.13 | 120 | none | | ||
| 56 | + | ||
| 57 | +- `php84` loads `geospatial`, `memcache`, `parle`, `php_trie` and `Stomp`, which `php85` does not; `php85` loads `lexbor` and `uri`, new in PHP 8.5. | ||
| 58 | +- Bundled extensions report the PHP version; `dom` reports `20031129`, and `mysqlnd` reports `mysqlnd 8.4.28`, which Composer cannot parse and sees as version `0`, as the catalogue records it. | ||
| 59 | +- Scaleway upgraded PHP on both Function Runtimes within eight days, without notice: `php84` from 8.4.27 to 8.4.28, `php85` from 8.5.12 to 8.5.13. | ||
| 60 | + | ||
| 61 | +The raw outputs are [tests/Fixtures/FunctionRuntimes](../tests/Fixtures/FunctionRuntimes), from which [probe/catalogue.php](../probe/catalogue.php) generates [resources/function-runtimes.php](../resources/function-runtimes.php), naming and versioning PHP and its extensions as Composer's `PlatformRepository` does. | ||
| 62 | +A test fails when the catalogue is not the one the fixtures generate. | ||
| 63 | +The list of Function Runtimes follows [Scaleway's runtime reference](https://www.scaleway.com/en/docs/serverless-functions/reference-content/functions-runtimes/), restricted to those the package's `php` requirement allows. | ||
| 64 | + | ||
| 65 | +### Updating the catalogue | ||
| 66 | + | ||
| 67 | +The [Function Runtime Catalogue workflow](../.github/workflows/function-runtimes.yml) runs every Monday, and by hand from the Actions tab before each release: | ||
| 68 | + | ||
| 69 | +1. it deploys the probe on each Function Runtime, saves its `?mode=runtime` output as the fixture, and destroys the probe whatever the outcome; | ||
| 70 | +2. it regenerates the catalogue, and does nothing more when only the measurement dates changed; | ||
| 71 | +3. otherwise it opens a pull request from the `catalogue-update` branch, or force-pushes the open one, listing the changes. | ||
| 72 | + | ||
| 73 | +It needs the repository secrets `SCW_ACCESS_KEY`, `SCW_SECRET_KEY` and `SCW_DEFAULT_PROJECT_ID`, for an API key limited to Serverless Functions in a project dedicated to the probe. | ||
| 74 | +Pull requests opened with the default token do not trigger the CI: set a `CATALOGUE_PR_TOKEN` secret, a fine-grained token with the contents and pull requests permissions, for the CI to check them. | ||
| 75 | +A failed deployment or query fails the job, without retry. | ||
| 76 | +Merging does not release: users get the new catalogue with the next version. | ||
| 77 | + | ||
| 78 | +By hand, deploy the probe as its [README](../probe/README.md) says, save `curl -sS "$PROBE_URL/?mode=runtime"` as `tests/Fixtures/FunctionRuntimes/<runtime>.json` for each Function Runtime, and run `php probe/catalogue.php`, which prints what changed. | ||
| 79 | +A new Function Runtime gets its own fixture; the script names it after the PHP version measured, and refuses two fixtures of the same one. | ||
| 80 | + | ||
| 48 | ## HTTP Event | 81 | ## HTTP Event |
| 49 | 82 | ||
| 50 | Keys: `resource`, `path`, `httpMethod`, `headers`, `multiValueHeaders` (null), `queryStringParameters`, `multiValueQueryStringParameters` (null), `pathParameters` (null), `stageVariables`, `requestContext` (with `httpMethod`), `body`, `isBase64Encoded`. | 83 | Keys: `resource`, `path`, `httpMethod`, `headers`, `multiValueHeaders` (null), `queryStringParameters`, `multiValueQueryStringParameters` (null), `pathParameters` (null), `stageVariables`, `requestContext` (with `httpMethod`), `body`, `isBase64Encoded`. |