mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
support for more helm template args (#4926)
* support for more helm template args * move templateArgs and unit tests to api/types * undo package name change * use our own simple helm chart instead of forking one * add argument to AsHelmArgs * code review * lint errors
This commit is contained in:
@@ -12,12 +12,14 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/sergi/go-diff/diffmatchpatch"
|
||||
"sigs.k8s.io/kustomize/kyaml/errors"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
"sigs.k8s.io/kustomize/kyaml/sets"
|
||||
)
|
||||
|
||||
// CopyDir copies a src directory to a dst directory. CopyDir skips copying the .git directory from the src.
|
||||
func CopyDir(src string, dst string) error {
|
||||
return filepath.Walk(src, func(path string, info os.FileInfo, err error) error {
|
||||
func CopyDir(fSys filesys.FileSystem, src string, dst string) error {
|
||||
return errors.Wrap(fSys.Walk(src, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -36,21 +38,21 @@ func CopyDir(src string, dst string) error {
|
||||
|
||||
// make directories that don't exist
|
||||
if info.IsDir() {
|
||||
return os.MkdirAll(filepath.Join(dst, copyTo), info.Mode())
|
||||
return errors.Wrap(fSys.MkdirAll(filepath.Join(dst, copyTo)))
|
||||
}
|
||||
|
||||
// copy file by reading and writing it
|
||||
b, err := os.ReadFile(filepath.Join(src, copyTo))
|
||||
b, err := fSys.ReadFile(filepath.Join(src, copyTo))
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err)
|
||||
}
|
||||
err = os.WriteFile(filepath.Join(dst, copyTo), b, info.Mode())
|
||||
err = fSys.WriteFile(filepath.Join(dst, copyTo), b)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
// Diff returns a list of files that differ between the source and destination.
|
||||
|
||||
Reference in New Issue
Block a user