Skip to content

feat: skip pulling an already cloned plan when CI is set - #310

Open
MadsBogeskov wants to merge 2 commits into
masterfrom
feat/skip-pull-in-ci
Open

feat: skip pulling an already cloned plan when CI is set#310
MadsBogeskov wants to merge 2 commits into
masterfrom
feat/skip-pull-in-ci

Conversation

@MadsBogeskov

@MadsBogeskov MadsBogeskov commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Every shuttle invocation 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 a git fetch + pull that can never find anything. A job running ten shuttle commands pays nine times over.

Change

pkg/git/git.go gains skipPullFromEnv, checked next to the existing skipGitPlanPulling flag and SHUTTLE_CACHE_DURATION_MIN cache:

  • CI set to a non-empty value skips pulling an already cloned plan. Most CI systems set this, including GitHub Actions.
  • SHUTTLE_SKIP_PULL is the explicit control and takes precedence, so SHUTTLE_SKIP_PULL=false forces 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 CI so 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-pull flag and SHUTTLE_PLANS_ALREADY_VALIDATED behaviour are untouched.

Testing

Unit tests in pkg/git/skip_pull_test.go cover the precedence matrix (8 cases).

Also verified end to end against a real git plan:

Environment Result
nothing set pulls
CI=true Skipping git plan pulling because CI is set
CI= (empty) pulls
SHUTTLE_SKIP_PULL=1 Skipping git plan pulling because SHUTTLE_SKIP_PULL=1
CI=true SHUTTLE_SKIP_PULL=false pulls
CI=true, no plan cloned yet clones

go test ./... passes except TestExecute_contextCancellation, which requires a running Docker daemon and fails identically on master.


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 skipPullFromEnv check runs alongside the existing --skip-pull flag and cache logic; if it says skip, GetGitPlan returns without fetch/pull.

SHUTTLE_SKIP_PULL is the explicit switch (parsed as a boolean) and wins over CI: any non-empty CI skips pull by default, while SHUTTLE_SKIP_PULL=false forces pulling even in CI. Invalid boolean values for SHUTTLE_SKIP_PULL are treated as false. Initial clone when no local plan exists is unchanged.

README documents the behavior and env vars; pkg/git/skip_pull_test.go adds table tests for the precedence matrix.

Reviewed by Cursor Bugbot for commit baf2f99. Configure here.

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
MadsBogeskov marked this pull request as ready for review July 28, 2026 11:44
@MadsBogeskov
MadsBogeskov requested a review from a team as a code owner July 28, 2026 11:44
Comment thread pkg/git/git.go
Comment thread pkg/git/git.go Outdated
Comment thread pkg/git/git.go
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.
@MadsBogeskov

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

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