-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align eval output with render #1907
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
090047d
refactor fn runner
Shell32-Natsu 65745dc
update eval output format
Shell32-Natsu e047686
omit output when the result is printed to stdout
Shell32-Natsu b79c126
fix test
Shell32-Natsu 6e77627
improve comment
Shell32-Natsu dbc3388
always use FunctionRunner
Shell32-Natsu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
package runfn | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"io" | ||
"os" | ||
|
@@ -30,6 +31,8 @@ import ( | |
// RunFns runs the set of configuration functions in a local directory against | ||
// the Resources in that directory | ||
type RunFns struct { | ||
Ctx context.Context | ||
|
||
StorageMounts []runtimeutil.StorageMount | ||
|
||
// Path is the path to the directory containing functions | ||
|
@@ -419,6 +422,8 @@ func (r *RunFns) defaultFnFilterProvider(spec runtimeutil.FunctionSpec, fnConfig | |
return nil, err | ||
} | ||
} | ||
var fltr *runtimeutil.FunctionFilter | ||
var name string | ||
if spec.Container.Image != "" { | ||
// TODO: Add a test for this behavior | ||
uidgid, err := getUIDGID(r.AsCurrentUser, currentUser) | ||
|
@@ -438,27 +443,29 @@ func (r *RunFns) defaultFnFilterProvider(spec runtimeutil.FunctionSpec, fnConfig | |
AllowMount: true, | ||
}, | ||
} | ||
cf := &runtimeutil.FunctionFilter{ | ||
fltr = &runtimeutil.FunctionFilter{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to get away from crafting this filter here manually but it will be easier once my structured result changes are merged in. |
||
Run: c.Run, | ||
FunctionConfig: fnConfig, | ||
DeferFailure: spec.DeferFailure, | ||
ResultsFile: resultsFile, | ||
} | ||
return cf, nil | ||
name = spec.Container.Image | ||
} | ||
|
||
if spec.Exec.Path != "" { | ||
e := &fnruntime.ExecFn{ | ||
Path: spec.Exec.Path, | ||
} | ||
ef := &runtimeutil.FunctionFilter{ | ||
fltr = &runtimeutil.FunctionFilter{ | ||
Run: e.Run, | ||
FunctionConfig: fnConfig, | ||
DeferFailure: spec.DeferFailure, | ||
ResultsFile: resultsFile, | ||
} | ||
return ef, nil | ||
name = spec.Exec.Path | ||
} | ||
// if output is not nil we will write the resources to stdout | ||
disableOutput := (r.Output != nil) | ||
return fnruntime.NewFunctionRunner(r.Ctx, fltr, name, disableOutput) | ||
|
||
return nil, nil | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not happy with this name since the name represent lower level than FunctionRunner.
But unable to find a good name, not worth blocking the PR :)