Skip to content

Enhancement: use capability-based runner detection instead of RUNNER_ENVIRONMENT#1069

Closed
mfn wants to merge 1 commit intoshivammathur:developfrom
mfn:mfn/self-hosted-clone-runner-compat
Closed

Enhancement: use capability-based runner detection instead of RUNNER_ENVIRONMENT#1069
mfn wants to merge 1 commit intoshivammathur:developfrom
mfn:mfn/self-hosted-clone-runner-compat

Conversation

@mfn
Copy link
Copy Markdown
Contributor

@mfn mfn commented Mar 19, 2026

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_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.

In case this PR edits any scripts:

  • 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:
    image
    After:
    image

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
Copy link
Copy Markdown

codecov Bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6ab9eec) to head (4f1fcab).
⚠️ Report is 1 commits behind head on develop.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shivammathur
Copy link
Copy Markdown
Owner

@mfn

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 $ImageOS and $ImageVersion, but that led to a lot of cases where these cached builds for GitHub runners were installed on self-hosted runners leading to broken setup and errors.

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.

@mfn
Copy link
Copy Markdown
Contributor Author

mfn commented Mar 19, 2026

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 🙇🏼

@mfn mfn deleted the mfn/self-hosted-clone-runner-compat branch March 20, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants