Skip to content

Commit

Permalink
Fix krm exec function working dir
Browse files Browse the repository at this point in the history
  • Loading branch information
aabouzaid committed Jul 13, 2022
1 parent d1a4bcf commit 7b8484d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 12 additions & 0 deletions api/internal/plugins/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ func (l *Loader) Config() *types.PluginConfig {
return l.pc
}

// Copy the actual values of loader instead using the pointer values.
func (l Loader) DeepCopy(ldr ifc.Loader) Loader {
l.pc = &types.PluginConfig{
PluginRestrictions: l.pc.PluginRestrictions,
BpLoadingOptions: l.pc.BpLoadingOptions,
FnpLoadingOptions: l.pc.FnpLoadingOptions,
HelmConfig: l.pc.HelmConfig,
}
l.SetWorkDir(ldr.Root())
return l
}

// SetWorkDir sets the working directory for this loader's plugins
func (l *Loader) SetWorkDir(wd string) {
l.pc.FnpLoadingOptions.WorkingDir = wd
Expand Down
3 changes: 1 addition & 2 deletions api/internal/target/kusttarget.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ func NewKustTarget(
validator ifc.Validator,
rFactory *resmap.Factory,
pLdr *loader.Loader) *KustTarget {
pLdrCopy := *pLdr
pLdrCopy.SetWorkDir(ldr.Root())
pLdrCopy := pLdr.DeepCopy(ldr)
return &KustTarget{
ldr: ldr,
validator: validator,
Expand Down

0 comments on commit 7b8484d

Please # to comment.