Repository navigation
Post step: skip the mirror refresh when the commit is denied, and add refresh-mirror - #66
Open
lewisl9029 wants to merge 2 commits into
Open
lewisl9029 wants to merge 2 commits into
lewisl9029 wants to merge 2 commits into
Conversation
… refresh-mirror The deferred mirror refresh (ls-remote plus a fetch of every changed branch and tag) only pays off when the sticky disk is committed afterwards. Under sticky disk branch protection the host denies the commit at mount time, yet the post step still refreshed the mirror and then discarded it, adding seconds to tens of seconds to the end of every non-default-branch job. Skip the refresh when the commit is already denied, and add a refresh-mirror input (default true) to skip it explicitly.
Hand-applied: dist/index.js needs the private buf.build vm-agent package to rebuild, so this mirrors the src/main.ts and src/mirror-refresh.ts change in the bundle. Regenerating dist with npm run build should produce the same behavior.
Author
|
Some more context: we actually ended up doing |
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.
Summary
With sticky disk branch protection on, jobs outside the default branch can't commit the git mirror. The post step still refreshes the mirror for every shallow checkout, then discards it. That refresh is a
git ls-remoteover every branch and tag plus a fetch of each changed ref. On a busy repository (about 1,500 refs) it took 3 to 29 s per job, median about 15 s, at the end of every pull-request job.This change skips the deferred refresh when the host has already denied the job's commit (
commitEarlyDenyReason). It also adds arefresh-mirrorinput (defaulttrue) so a workflow can turn the refresh off explicitly.What changed
src/main.ts: the post step checksdeferredRefreshSkipReasonbefore the deferredsyncMirrorFromRemote, and logs[git-mirror] Skipping mirror refresh: <reason>instead of syncing. Nothing else changes. The mirror stays unchanged, so the existing!mirrorChangedpath releases the disk without committing, and maintenance is skipped as before.src/mirror-refresh.ts(new): the skip decision and the input parsing, as pure functions, with tests in__test__/mirror-refresh.test.ts.action.yml,README.md: documentrefresh-mirror. It only affects the post-step refresh after shallow checkouts. Full checkouts (fetch-depth: 0) still sync before populating the workspace.dist/index.js: hand-applied. A rebuild needs the private@buf/blacksmith_vm-agentpackage, so this commit mirrors the source change in the bundle. Please regeneratedist/withnpm run buildbefore merging;check-distwill flag the difference.Validation
node --check dist/index.jspasses.npm testor the build: both needBUF_TOKEN.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need. (Staging)