use capability-based runner detection instead of RUNNER_ENVIRONMENT

Third-party runner providers (Depot, Blacksmith, Namespace, BuildJet)
mirror GitHub's official runner images but set `RUNNER_ENVIRONMENT=self-hosted`.

The existing detection treats this as a bare self-hosted runner, routing PHP
installation through the slower php-builder path (~>1min) instead of the fast
pre-built php-ubuntu binaries (few seconds).

Replace the `RUNNER_ENVIRONMENT` check with capability-based detection: if both
`ImageOS` and `ImageVersion` are set (and not ACT/container), classify as github.

This restores the pre-df8d1233 approach of trusting image markers over hosting
metadata. Also replace the fail-fast guard with an informational log for
third-party runner visibility.
This commit is contained in:
Markus Podar 2026-03-19 00:33:37 +01:00
parent 93cb3149d2
commit 4f1fcabfdc
No known key found for this signature in database
GPG key ID: D674B445C2272BD0

View file

@ -54,16 +54,17 @@ read_env() {
[ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release [ "${debug:-${DEBUG:-false}}" = "true" ] && debug=debug && update=true || debug=release
[[ "${phpts:-${PHPTS:-nts}}" = "ts" || "${phpts:-${PHPTS:-nts}}" = "zts" ]] && ts=zts && update=true || ts=nts [[ "${phpts:-${PHPTS:-nts}}" = "ts" || "${phpts:-${PHPTS:-nts}}" = "zts" ]] && ts=zts && update=true || ts=nts
fail_fast="${fail_fast:-${FAIL_FAST:-false}}" fail_fast="${fail_fast:-${FAIL_FAST:-false}}"
[[ ( -z "$ImageOS" && -z "$ImageVersion" ) || if [[ -n "$ImageOS" && -n "$ImageVersion" && -z "$ACT" && -z "$CONTAINER" ]]; then
( -n "$RUNNER_ENVIRONMENT" && "$RUNNER_ENVIRONMENT" = "self-hosted" ) || _runner=github
-n "$ACT" || -n "$CONTAINER" ]] && _runner=self-hosted || _runner=github else
_runner=self-hosted
fi
runner="${runner:-${RUNNER:-$_runner}}" runner="${runner:-${RUNNER:-$_runner}}"
tool_path_dir="${setup_php_tools_dir:-${SETUP_PHP_TOOLS_DIR:-/usr/local/bin}}" tool_path_dir="${setup_php_tools_dir:-${SETUP_PHP_TOOLS_DIR:-/usr/local/bin}}"
tool_cache_path_dir="${setup_php_tool_cache_dir:-${SETUP_PHP_TOOL_CACHE_DIR:-${RUNNER_TOOL_CACHE:-/opt/hostedtoolcache}/setup-php/tools}}" tool_cache_path_dir="${setup_php_tool_cache_dir:-${SETUP_PHP_TOOL_CACHE_DIR:-${RUNNER_TOOL_CACHE:-/opt/hostedtoolcache}/setup-php/tools}}"
if [[ "$runner" = "github" && $_runner = "self-hosted" ]]; then if [[ "$runner" = "github" && -n "$RUNNER_ENVIRONMENT" && "$RUNNER_ENVIRONMENT" = "self-hosted" ]]; then
fail_fast=true add_log "$tick" "Runner" "GitHub-compatible image detected on third-party runner"
add_log "$cross" "Runner" "Runner set as github in self-hosted environment"
fi fi
# Set Update to true if the ubuntu github image does not have PHP PPA. # Set Update to true if the ubuntu github image does not have PHP PPA.