mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
exec function working dir is the kustomization that referenced it (#4125)
* exec function working dir is the kustomization that referenced it * suggested changes * more code review * use a field instead of an annotation * more code review
This commit is contained in:
@@ -101,6 +101,9 @@ type RunFns struct {
|
||||
// If it is true, the empty result will be provided as input to the next
|
||||
// function in the list.
|
||||
ContinueOnEmptyResult bool
|
||||
|
||||
// WorkingDir specifies which working directory an exec function should run in.
|
||||
WorkingDir string
|
||||
}
|
||||
|
||||
// Execute runs the command
|
||||
@@ -507,7 +510,14 @@ func (r *RunFns) ffp(spec runtimeutil.FunctionSpec, api *yaml.RNode, currentUser
|
||||
}
|
||||
|
||||
if r.EnableExec && spec.Exec.Path != "" {
|
||||
ef := &exec.Filter{Path: spec.Exec.Path}
|
||||
if r.WorkingDir == "" {
|
||||
return nil, fmt.Errorf("no working directory set for exec function")
|
||||
}
|
||||
|
||||
ef := &exec.Filter{
|
||||
Path: spec.Exec.Path,
|
||||
WorkingDir: r.WorkingDir,
|
||||
}
|
||||
|
||||
ef.FunctionConfig = api
|
||||
ef.GlobalScope = r.GlobalScope
|
||||
|
||||
Reference in New Issue
Block a user