Repository navigation
docs(readme): add a runner setup that empties the workspace per job - #10
Merged
Merged
Conversation
A self-hosted runner reuses the clone of a repo from one job to the next, so a setting in .git/config reaches the next job. In atlas, a job with sparse-checkout left a partial clone (blob:none), and the next checkout with lfs: true failed with "missing object". The new section "Set up a runner" adds a job-started hook that empties the workspace, and keeps the Git LFS files in a shared cache outside it (lfs.storage), so a new clone does not download them again.
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.
What and why
The self-hosted runners reuse the clone of a repo from one job to the next, and
actions/checkoutkeeps what an earlier job wrote to.git/config. In atlas, the Cloudflare purge jobs usesparse-checkout, which makes a partial clone (blob:none). After such a job, every checkout withlfs: truein the same workspace failed withCould not scan for Git LFS files/missing object, on all three runners.This adds the section "Set up a runner" under "Runners" in the README:
ACTIONS_RUNNER_HOOK_JOB_STARTED) empties the workspace, so each job starts with a new clone, as on a GitHub-hosted runner.lfs.storage), so a new clone does not download them again. A weekly cron job deletes files that no job read in 14 days.container:jobs, and nogit lfs prunein jobs.The section uses
RUNNER_USERinstead of machine and user names, because this repo is public.How I checked it
.gitfolder and files, and exits 0 whenGITHUB_WORKSPACEis unset or the folder does not exist. shellcheck passes.git lfs envwith a globallfs.storageshows the LFS object folder at the new path. The source ofactions/checkout@v7copies the runner user's~/.gitconfiginto its temporary home, so checkout uses the setting.bash -n.just cipasses..envhook line, the cron job and thesvc.shrestart.Deploy
Nothing for the workflows. To apply it, follow the new steps on the runner machine, then check that a job log shows the hook in the step "Set up runner".