-
Notifications
You must be signed in to change notification settings - Fork 263
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: Add support to combine service create --filename with other options #937
Changes from 2 commits
42c4076
ba133ed
2c7338d
857c046
1f8bf11
d76201c
3e0a752
062345d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,8 +278,11 @@ func (p *ConfigurationEditFlags) AddCreateFlags(command *cobra.Command) { | |
p.addSharedFlags(command) | ||
command.Flags().BoolVar(&p.ForceCreate, "force", false, | ||
"Create service forcefully, replaces existing service if any.") | ||
command.Flags().StringVarP(&p.Filename, "filename", "f", "", "Create a service from file.") | ||
command.Flags().StringVarP(&p.Filename, "filename", "f", "", "Create a service from file. "+ | ||
"The created service can be further modified by combining with other options."+ | ||
"Example: -f /path/to/file --env NAME=value will also add environment variable.") | ||
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. Same as above. Use same resolution |
||
command.MarkFlagFilename("filename") | ||
p.markFlagMakesRevision("filename") | ||
} | ||
|
||
// Apply mutates the given service according to the flags in the command. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -303,12 +303,11 @@ func constructServiceFromFile(cmd *cobra.Command, editFlags ConfigurationEditFla | |
// Set namespace in case it's specified as --namespace | ||
service.ObjectMeta.Namespace = namespace | ||
|
||
// We need to generate revision to have --force replace working | ||
revName, err := servinglib.GenerateRevisionName(editFlags.RevisionName, &service) | ||
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. Why has this been removed ? 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. It's superseded by combination of https://github.com/knative/client/pull/937/files#diff-74b189b0b506d256ede4322475d950f5R285 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 see, and I think it makes sense. |
||
// Apply options provided from cmdline | ||
err = editFlags.Apply(&service, nil, cmd) | ||
if err != nil { | ||
return nil, err | ||
} | ||
Comment on lines
308
to
310
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 could comment these lines and all tests are still passing. So this tells me no test for errors when 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. But isn't 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. If I look at the overall test suite I see, that |
||
service.Spec.Template.Name = revName | ||
|
||
return &service, nil | ||
} |
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.
"options.Example:" => "options, e.g.," OR "options. For example:"
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.
"also add environment variable" --> "also add an environment variable"