-
Notifications
You must be signed in to change notification settings - Fork 172
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
feat: inline Environment #403
Merged
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
993c559
allow inline Environment
Duologic 5c506a3
refactor: evalJsonnet -> eval
Duologic b18a386
refactor: use spec.Parse
Duologic ac417d3
refactor: extract Environment as k8s-like object
Duologic 2ee1696
fix(cli): `tk env list` for inline envs
Duologic 12ece72
fix: allow eval with err
Duologic 943565f
s/v1alpha1.Config/v1alpha1.Environment
Duologic 695e7a3
s/extract/extractedEnvs
Duologic b6ae81b
docs: update function descriptions
Duologic 065a3e1
fix: return env names with error
Duologic f16c942
fix: log expected errors on eval
Duologic 4ee8de7
fix: ensure metadata.name is set on loading an env
Duologic 6533972
doc: remove out of place docstring
Duologic 4f11ab2
fix: omitempty Data
Duologic 9c30b46
conditional return values
Duologic 52ba439
no switch inside if
Duologic 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
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.
I must admit I can't quite follow this code. To me this seems as encountering multiple environments is no longer a fatal thing, but only a warning, given no error is returned.
I'd expect
Eval
to behave like so:error
everytime an error occured (e.g. invalid Jsonnet, no Environment, multiple Environments, etc)This allows a naive callee to automatically abort when any error occurs. Callees aware of inline vs spec.json can react to receiving
ErrNoEnv
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.
That is what I did before, simply return both data and err from upstream to downstream, no handling here.
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.
Sure, but this is different from what I just described.
Only the specific case of "no inline environment" has a reason to return data alongside an error. Afaict, all other errors that occur here are fatal and thus return
nil, err
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.
Okay, so here you say return data+err? Gotcha.
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.
Yes, which you could simplify along those lines: