Skip to content

Commit

Permalink
remove stat based logic as components are always directories containi…
Browse files Browse the repository at this point in the history
…ng a kustomization file
  • Loading branch information
kallangerard committed Jan 8, 2025
1 parent 841ab37 commit f70979e
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions pkg/skaffold/render/renderer/kustomize/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,18 @@ func (k Kustomize) mirrorResources(kusDir string, fs TmpFS, resources []string)
return nil
}

func (k Kustomize) mirrorComponents(kusDir string, fs TmpFS, components []string) error {
for _, c := range components {
// note that c is relative to kustomization file not working dir here
cPath := filepath.Join(kusDir, c)

if err := k.mirror(cPath, fs); err != nil {
return err
}
}
return nil
}

func (k Kustomize) mirrorFile(kusDir string, fs TmpFS, path string) error {
if sUtil.IsURL(path) {
return nil
Expand Down Expand Up @@ -408,27 +420,6 @@ func (k Kustomize) mirrorConfigMapGenerators(kusDir string, fs TmpFS, args []typ
return nil
}

func (k Kustomize) mirrorComponents(kusDir string, fs TmpFS, components []string) error {
for _, r := range components {
// note that r is relative to kustomization file not working dir here
rPath := filepath.Join(kusDir, r)
stat, err := os.Stat(rPath)
if err != nil {
return err
}
if stat.IsDir() {
if err := k.mirror(rPath, fs); err != nil {
return err
}
} else {
if err := k.mirrorFile(kusDir, fs, r); err != nil {
return err
}
}
}
return nil
}

func kustomizeDependencies(workdir string, paths []string) ([]string, error) {
deps := stringset.New()
for _, kustomizePath := range paths {
Expand Down

0 comments on commit f70979e

Please sign in to comment.