feat: skip pulling an already cloned plan when CI is set - #310
Open
MadsBogeskov wants to merge 2 commits into
Open
feat: skip pulling an already cloned plan when CI is set#310MadsBogeskov wants to merge 2 commits into
MadsBogeskov wants to merge 2 commits into
Conversation
Every shuttle invocation pulls the plan again. In CI the plan was just cloned at the start of the job and cannot change during it, so every invocation after the first pays for a pull that can never find anything. Skip pulling when CI is set, which most CI systems do. SHUTTLE_SKIP_PULL is the explicit control and takes precedence, so pulling can be forced back on with a falsy value. This only affects pulling an existing clone. A plan that is not yet available locally is still cloned.
MadsBogeskov
marked this pull request as ready for review
July 28, 2026 11:44
mahlunar
reviewed
Jul 28, 2026
Per review: default an unparsable SHUTTLE_SKIP_PULL to false rather than true, so pulling stays on unless explicitly skipped. Also only log the skip message when pulling is actually being skipped, since it was logged unconditionally even for falsy values like SHUTTLE_SKIP_PULL=false.
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit baf2f99. Configure here.
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.
Every
shuttleinvocation pulls the plan again. In CI the plan is cloned at the start of the job and cannot change during it, so every invocation after the first pays for agit fetch+pullthat can never find anything. A job running ten shuttle commands pays nine times over.Change
pkg/git/git.gogainsskipPullFromEnv, checked next to the existingskipGitPlanPullingflag andSHUTTLE_CACHE_DURATION_MINcache:CIset to a non-empty value skips pulling an already cloned plan. Most CI systems set this, including GitHub Actions.SHUTTLE_SKIP_PULLis the explicit control and takes precedence, soSHUTTLE_SKIP_PULL=falseforces pulling back on in CI. An unparsable value is treated as true, matching how env vars are often used as mere presence flags.An explicit variable is offered alongside
CIso the behaviour is documented and overridable, rather than an implicit rule baked into the binary that nobody can turn off.Not affected
This only short circuits the pull of an existing clone, inside the
fileAvailable(planPath)branch. A plan that is not yet available locally is still cloned, so a fresh CI checkout works unchanged. The existing--skip-pullflag andSHUTTLE_PLANS_ALREADY_VALIDATEDbehaviour are untouched.Testing
Unit tests in
pkg/git/skip_pull_test.gocover the precedence matrix (8 cases).Also verified end to end against a real git plan:
CI=trueSkipping git plan pulling because CI is setCI=(empty)SHUTTLE_SKIP_PULL=1Skipping git plan pulling because SHUTTLE_SKIP_PULL=1CI=true SHUTTLE_SKIP_PULL=falseCI=true, no plan cloned yetgo test ./...passes exceptTestExecute_contextCancellation, which requires a running Docker daemon and fails identically onmaster.Note
Low Risk
Behavior change is limited to optional git plan refresh on existing clones, with overrides; no auth, data, or clone-path changes beyond a whitespace fix.
Overview
Speeds up repeated shuttle runs in CI by not re-pulling a git plan that is already cloned locally. When the plan directory exists and is clean, a new
skipPullFromEnvcheck runs alongside the existing--skip-pullflag and cache logic; if it says skip,GetGitPlanreturns withoutfetch/pull.SHUTTLE_SKIP_PULLis the explicit switch (parsed as a boolean) and wins overCI: any non-emptyCIskips pull by default, whileSHUTTLE_SKIP_PULL=falseforces pulling even in CI. Invalid boolean values forSHUTTLE_SKIP_PULLare treated as false. Initial clone when no local plan exists is unchanged.README documents the behavior and env vars;
pkg/git/skip_pull_test.goadds table tests for the precedence matrix.Reviewed by Cursor Bugbot for commit baf2f99. Configure here.