Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRAP Caching: Disable on self-hosted runners #1298

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

edoardopirovano
Copy link
Contributor

Self-hosted runners may have slow network connections, which means they are unlikely to benefit from TRAP caching. So, let's disable this feature by default on self-hosted runners (whilst still respecting what the workflow says if the user has explicitly enabled/disabled it there).

Checking of whether we're on a self-hosted runner is rather awkward. I was hoping there would just be an environment variable that tells us this, but sadly there is not. Instead, I've implemented a heuristic on the runner name which checks against the two currently possible names of GitHub-hosted runners. As a fallback, we also look for a toolcache called hostedtoolcache which is what the folder is always called on GitHub-hosted runners. Hopefully the fact we're checking two things makes this somewhat robust, although it's still more brittle than I would like and I am definitely open to a suggestion on a better solution.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

@edoardopirovano edoardopirovano requested a review from a team as a code owner October 13, 2022 13:36
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