Fix bootstrap failure on Windows cross-drive paths#5726
Open
veeceey wants to merge 1 commit intofluxcd:mainfrom
Open
Fix bootstrap failure on Windows cross-drive paths#5726veeceey wants to merge 1 commit intofluxcd:mainfrom
veeceey wants to merge 1 commit intofluxcd:mainfrom
Conversation
…nt drive than TEMP When running flux bootstrap from a drive (e.g. D:\) different from where %TEMP% lives (typically C:\), filepath.Rel fails because Go can't compute relative paths across different drive letters. The original code converted absolute paths to relative as a workaround for a kustomize bug (kubernetes-sigs/kustomize#2789) that was caused by go-getter. Since kustomize dropped go-getter in 2021, absolute paths work fine now. Instead of hard-failing when filepath.Rel errors, keep the absolute path as a fallback. Signed-off-by: Varun Chawla <varun_6april@hotmail.com>
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.
Fixes #1153
When running
flux bootstrap(orflux install) from a drive different than where%TEMP%lives (e.g. working dir onD:\, temp onC:\), Go'sfilepath.Relreturns an error because it can't compute a relative path across Windows drive letters. The CLI just propagated that error and died.The relative path conversion was originally added as a workaround for kubernetes-sigs/kustomize#2789, which was caused by kustomize's old
go-getterdependency. Kustomize droppedgo-getterback in 2021 (kubernetes-sigs/kustomize#3586), so absolute paths work fine now.The fix: when
filepath.Relfails, keep the absolute path instead of returning an error. The relative conversion still happens when possible (same drive), so behavior on Linux/macOS is unchanged.I don't have a Windows box to test on directly, but the code path is straightforward — the change is from
if err != nil { return nil, err }to just skipping the relative conversion on error. @kitforbes or @domoran mentioned being able to test on Windows if someone provides the fix.Signed-off-by: Varun Chawla varun_6april@hotmail.com