jdecool/scaleway-runtimepublic Fork
⑂ 5bab469
Commits
⬇ Clone ▾
git clone https://git.rickub.com/jdecool/scaleway-runtime.git
git clone ssh://git@rickub.com/jdecool/scaleway-runtime.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

probe: report the PHP version and extension versions of a Function RuntimeUnverified

Jérémy DECOOL committed 2026-11-22T12:35:19+01:00 Browse files
5bab469 parent: b445035
modified probe/README.md +6 -0
@@ -72,6 +72,12 @@ curl -sS -I "$PROBE_URL/" > 08-head.txt
7272 sleep 330; curl -sS "$PROBE_URL/?mode=history" > 09-history.ndjson
7373 ```
7474
75+To update the [Function Runtime Catalogue](../docs/probe-results.md#function-runtime-catalogue), save the PHP version and the extensions of each Function Runtime, dated, in the fixtures it is generated from:
76+
77+```sh
78+curl -sS "$PROBE_URL/?mode=runtime" > ../tests/Fixtures/FunctionRuntimes/php85.json
79+```
80+
7581 10. Export the function's logs of the last hour, CRON lines included, from Cockpit's Grafana or with the Loki query of the [README](../README.md#logs).
7682
7783 11. Compare a CRON Event (step 9 or 10) with the HTTP one of `01-facts.json`, `event` and `context` alike, and list what only the CRON one has or lacks: headers (a trigger name or id, a token, `User-Agent`, `X-Forwarded-For`), method, path, context fields.
@@ -72,6 +72,12 @@ curl -sS -I "$PROBE_URL/" > 08-head.txt
72 sleep 330; curl -sS "$PROBE_URL/?mode=history" > 09-history.ndjson72 sleep 330; curl -sS "$PROBE_URL/?mode=history" > 09-history.ndjson
73 ```73 ```
74 74
75+To update the [Function Runtime Catalogue](../docs/probe-results.md#function-runtime-catalogue), save the PHP version and the extensions of each Function Runtime, dated, in the fixtures it is generated from:
76+
77+```sh
78+curl -sS "$PROBE_URL/?mode=runtime" > ../tests/Fixtures/FunctionRuntimes/php85.json
79+```
80+
75 10. Export the function's logs of the last hour, CRON lines included, from Cockpit's Grafana or with the Loki query of the [README](../README.md#logs).81 10. Export the function's logs of the last hour, CRON lines included, from Cockpit's Grafana or with the Loki query of the [README](../README.md#logs).
76 82
77 11. Compare a CRON Event (step 9 or 10) with the HTTP one of `01-facts.json`, `event` and `context` alike, and list what only the CRON one has or lacks: headers (a trigger name or id, a token, `User-Agent`, `X-Forwarded-For`), method, path, context fields.83 11. Compare a CRON Event (step 9 or 10) with the HTTP one of `01-facts.json`, `event` and `context` alike, and list what only the CRON one has or lacks: headers (a trigger name or id, a token, `User-Agent`, `X-Forwarded-For`), method, path, context fields.
modified probe/function/handler.php +9 -0
@@ -112,6 +112,15 @@ function handle($event, $context)
112112 case 'exception':
113113 throw new RuntimeException('probe: exception escaping the handler');
114114
115+ case 'runtime':
116+ // Only what the Function Runtime Catalogue is generated from, so that its output can be committed as it is.
117+ return json_response([
118+ 'measuredAt' => gmdate('Y-m-d\\TH:i:s\\Z'),
119+ 'phpVersion' => PHP_VERSION,
120+ // false when an extension reports no version: Platform Requirements on its version stay unknown.
121+ 'extensions' => array_combine($extensions = get_loaded_extensions(), array_map(static fn (string $name) => phpversion($name), $extensions)),
122+ ]);
123+
115124 case 'history':
116125 return ['statusCode' => 200, 'headers' => ['Content-Type' => 'application/x-ndjson'], 'body' => (string) @file_get_contents(PROBE_HISTORY)];
117126
@@ -112,6 +112,15 @@ function handle($event, $context)
112 case 'exception':112 case 'exception':
113 throw new RuntimeException('probe: exception escaping the handler');113 throw new RuntimeException('probe: exception escaping the handler');
114 114
115+ case 'runtime':
116+ // Only what the Function Runtime Catalogue is generated from, so that its output can be committed as it is.
117+ return json_response([
118+ 'measuredAt' => gmdate('Y-m-d\\TH:i:s\\Z'),
119+ 'phpVersion' => PHP_VERSION,
120+ // false when an extension reports no version: Platform Requirements on its version stay unknown.
121+ 'extensions' => array_combine($extensions = get_loaded_extensions(), array_map(static fn (string $name) => phpversion($name), $extensions)),
122+ ]);
123+
115 case 'history':124 case 'history':
116 return ['statusCode' => 200, 'headers' => ['Content-Type' => 'application/x-ndjson'], 'body' => (string) @file_get_contents(PROBE_HISTORY)];125 return ['statusCode' => 200, 'headers' => ['Content-Type' => 'application/x-ndjson'], 'body' => (string) @file_get_contents(PROBE_HISTORY)];
117 126