Repository navigation
fix: fetch each import source only once per command - #3367
Open
shawkitajima wants to merge 2 commits into
Open
shawkitajima wants to merge 2 commits into
shawkitajima wants to merge 2 commits into
Conversation
✅ Deploy Preview for devspace-docs canceled.Built without sensitive environment variables
|
A single command reads the config several times and resolves every import, nested import and dependency again, so each cached git import ran git pull (and URL imports re-downloaded) on every read. Record the sources already fetched in this process and skip the remote for later reads while the cached copy exists. A missing cache still clones or downloads fresh. Signed-off-by: Shaw Kitajima <41173553+shawkitajima@users.noreply.github.com>
Download and check the HTTP status before writing the cached file, and mark the source fetched only after the download succeeded, so a failed download neither empties a good cached import nor stops retries in the same command. Cover URL sources, disablePull and a failed pull in tests, and build file URLs that are valid on Windows. Signed-off-by: Shaw Kitajima <41173553+shawkitajima@users.noreply.github.com>
shawkitajima
force-pushed
the
inf/fetch-imports-once-per-run
branch
from
December 3, 2026 22:42
6ba11b1 to
d2f169b
Compare
shawkitajima
marked this pull request as ready for review
December 3, 2026 22:49
shawkitajima
requested review from
FabianKramm and
LukasGentele
as code owners
December 3, 2026 22:49
This branch has not been deployed
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 issue type does this pull request address?
/kind bugfix
What does this pull request do? Which issues does it resolve?
A single DevSpace command reads the config more than once (a preload at startup, the command's own read, and one more read per dependency). Each read resolves every import, nested import and dependency again. For each cached git import that means a
git pullevery time, and for URLpath:imports a fresh download every time, even though the same source was just fetched earlier in the same command. With chained imports a command runs the same pull many times.This change records, in the existing
downloadMutex-guarded dependency downloader, the source ids already cloned, pulled or downloaded in the current process. Later reads of the same source skip the remote while the cached copy exists. A missing cache still clones or downloads fresh, anddisablePull,revision,branchandtagbehave as before. Each new command still pulls once, so updates are picked up on the next run. The same downloader also serves helm git and URL chart sources, so they get the same behavior.Two details: a failed
git pullis logged once and not retried within the same command, and a URL source is marked fetched only after a successful download. The URL download now completes and checks the HTTP status before it replaces the cached file, so a failed download no longer empties a good cached import.Measured against local git repos chained by imports, on repeat runs: pulls fell from 9 to 3 with one dependency, from 10 to 3 with shared nested imports, and from 9 to 3 with
tagimports. A commit pushed to the deepest import between runs still appeared on the next run.Please provide a short message that should be published in the DevSpace release notes
Fixed an issue where DevSpace pulled the same git import (and re-downloaded URL imports) repeatedly within a single command, instead of once per command.
What else do we need to know?
pkg/devspace/dependency/utilfor git,disablePull, a failed pull, URL sources, and URL download errors with and without a cached copy. They fail without the change and pass with it.go test ./pkg/devspace/dependency/... ./pkg/devspace/config/loader/...,gofmtandgo veton the package: all clean../hack/coverage.bash,golangci-lintand the e2e suite (needs a kind cluster).devspace devkeep the version fetched at start; before this change they also read imports only when the config was read.