Merge pull request #578 from fluxcd/rel-base-path
This commit is contained in:
@@ -323,7 +323,11 @@ func GenerateKustomizationYaml(dirPath string) error {
|
|||||||
|
|
||||||
var resources []string
|
var resources []string
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
resources = append(resources, strings.Replace(file, abs, ".", 1))
|
relP, err := filepath.Rel(abs, file)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
resources = append(resources, relP)
|
||||||
}
|
}
|
||||||
|
|
||||||
kus.Resources = resources
|
kus.Resources = resources
|
||||||
|
|||||||
@@ -105,6 +105,22 @@ func build(base, output string) error {
|
|||||||
return fmt.Errorf("%s not found", kfile)
|
return fmt.Errorf("%s not found", kfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(hidde): work around for a bug in kustomize causing it to
|
||||||
|
// not properly handle absolute paths on Windows.
|
||||||
|
// Convert the path to a relative path to the working directory
|
||||||
|
// as a temporary fix:
|
||||||
|
// https://github.com/kubernetes-sigs/kustomize/issues/2789
|
||||||
|
if filepath.IsAbs(base) {
|
||||||
|
wd, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
base, err = filepath.Rel(wd, base)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
opt := krusty.MakeDefaultOptions()
|
opt := krusty.MakeDefaultOptions()
|
||||||
k := krusty.MakeKustomizer(fs, opt)
|
k := krusty.MakeKustomizer(fs, opt)
|
||||||
m, err := k.Run(base)
|
m, err := k.Run(base)
|
||||||
|
|||||||
Reference in New Issue
Block a user