Enhancement: use capability-based runner detection instead of RUNNER_ENVIRONMENT#1069
Enhancement: use capability-based runner detection instead of RUNNER_ENVIRONMENT#1069mfn wants to merge 1 commit intoshivammathur:developfrom
RUNNER_ENVIRONMENT#1069Conversation
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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1069 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 8 8
Lines 853 853
Branches 305 305
=========================================
Hits 853 853 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The cached builds for GitHub that we have are only tested on GitHub runners and this change leads to people getting those builds on self-hosted runners. I had initially based on the self-hosted check same as this PR just using While this might work for certain commercial runners that have the same libraries as GitHub images, it breaks a lot of cases and increases the maintenance burden on my end. |
|
Ok got it, I thought so; what a pity. I figure this would require an opt-in from third party runner companies to declare somehow "compatible with github runner caches for setup-php", which is unlikely. Welp. I'm out of ideas. Appreciated the summary 🙇🏼 |
Related discussion: #1056
Description
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 or at least <30s).
Replace the
RUNNER_ENVIRONMENTcheck with capability-based detection: if bothImageOSandImageVersionare 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.
I have checked the edited scripts for syntax.
I have tested the changes in an integration test (If yes, provide workflow YAML and link).
I can't provide a public link, I tested this in a private org owned repo with depot-hosted runners (and also with github runners, making sure both directions worked)


Before:
After: