1
0
mirror of synced 2026-02-25 01:36:56 +00:00

Merge pull request #5726 from veeceey/fix/issue-1153-windows-cross-drive-bootstrap

Fix bootstrap failure on Windows cross-drive paths
This commit is contained in:
Stefan Prodan
2026-02-24 13:21:58 +02:00
committed by GitHub

View File

@@ -169,19 +169,19 @@ func BuildWithRoot(root, base string) ([]byte, error) {
return nil, fmt.Errorf("%s not found", konfig.DefaultKustomizationFileName()) return nil, fmt.Errorf("%s not found", konfig.DefaultKustomizationFileName())
} }
// TODO(hidde): work around for a bug in kustomize causing it to // Convert absolute paths to relative when possible, for kustomize
// not properly handle absolute paths on Windows. // compatibility. If filepath.Rel fails (e.g. paths on different
// Convert the path to a relative path to the working directory // Windows drives), keep the absolute path — kustomize handles
// as a temporary fix: // absolute paths correctly since go-getter was removed.
// https://github.com/kubernetes-sigs/kustomize/issues/2789 // See: https://github.com/kubernetes-sigs/kustomize/issues/2789
// https://github.com/fluxcd/flux2/issues/1153
if filepath.IsAbs(base) { if filepath.IsAbs(base) {
wd, err := os.Getwd() wd, err := os.Getwd()
if err != nil { if err != nil {
return nil, err return nil, err
} }
base, err = filepath.Rel(wd, base) if relBase, err := filepath.Rel(wd, base); err == nil {
if err != nil { base = relBase
return nil, err
} }
} }