Support Git Sparse Checkouts
Our Company uses a monorepo. All company code, including terraform, is in this repo. Because of this, the repo is quite large, and can take time to checkout / download. We’d love it if we could sparse checkout the terraform subdirectory since that’s all Spacelift needs. Maybe add it as a stack setting under source control.
Scenario:
An engineer needs to touch multiple stacks in their PR. That means they need to wait for all stacks to terraform plan before merging. Each stack has to pull their branch and run terraform… which means that every second we can shave off pulling their branch, the faster they can get feedback.
Log in to comment and vote
Comments7
Bronze Bay
Aug 1, 2025
Great to see this was marked as complete! Is there any documentation for how we should utilize this new feature?
Natalia Gazda
Aug 4, 2025
Sure! Here it is :) Happy using!
Blue Pinwheel
May 12, 2025
Nice @Marcin Wyszynski . Let us know if you guys need any testers once you have some POC or anything :)
Natalia Gazda
Aug 1, 2025
@Sam Kirsch let me know in case you had any feedback :)
Black Breeze
May 10, 2025
The team will be looking into it.
Blue Pinwheel
Mar 17, 2025
I ran a few timings on the differences… For our monorepo, it takes 1-2 (even sometimes 5mins) to git checkout from a blank slate. Using sparse, 10-20ms tops
Blue Pinwheel
Mar 17, 2025
Something like the below would be amazing:
TERRAFORM_SUBDIR=<some-dir-input>
git clone git@github.com:<some-repo> --depth 1 --filter=tree:0 -n
cd <repo>
git sparse-checkout set --no-cone /${TERRAFORM_SUBDIR}
git checkout