Repository navigation
fix(runners): Skip runner file ownership change when user_name is unset - #5574
Merged
guicaulada merged 1 commit intoNov 3, 2026
Merged
Conversation
005f
marked this pull request as ready for review
November 3, 2026 18:23
guicaulada
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
If a custom
userdata_templatedoesn't setuser_name, the end ofinstall-runner.shrunschown -R ":"over/opt/actions-runnerand/opt/hostedtoolcache. That changes no owners, but it still visits every file in the tool cache. On a fresh instance the root volume loads lazily from its snapshot, so the walk is slow. On our Ubuntu runners it adds about one to one and a half minutes to each boot. This change skips bothchowncalls whenuser_nameis empty. Whenuser_nameis set, they run as before.The module's own
user-data.shtemplates always setuser_name, so default setups behave the same.There is a side effect change: A
chownwith an empty owner still clears setuid and setgid bits on the files it visits. With this change, those bits stay as they are whenuser_nameis unset.start-runner.shstill changes the owner of/opt/actions-runnertorun_as.Test Plan
ubuntu:24.04container, I ran the old and new snippets over a tool cache of 1,000 files and countedchowncalls withstrace.user_nameunset, the old snippet made 1,009 calls. Owners stayedroot:root, and a setuid file lost its setuid bit.user_nameunset, the new snippet made 0 calls. Owners stayedroot:root, and the setuid bit stayed.user_name=ubuntu, both snippets made 1,009 calls and left both treesubuntu:ubuntu.shellcheckreported no new findings.Related Issues
#2302 added
user_nameto the Ubuntu example so that the tool cachechownworks.