-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add parameter-file support #966
Conversation
For workflows that have many parameters, or cases where the workflows should be run with slightly different requirements, it can be useful to have a file containing parameters instead of submitting via the command line. This commit adds support for the `--parameter-file` (`-f`) command line option to provide a new-line-delimited file of parameters. These parameters can still be overridden by the `--parameter` (`-p`) flags. Comments in parameter files are also supported and denoted by a `#` character. See argoproj#796 for more information
cmd/argo/commands/submit.go
Outdated
} | ||
for i, line := range strings.Split(string(body), "\n") { | ||
// Ignore comments | ||
fileParam := strings.TrimSpace(strings.Split(line, "#")[0]) |
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.
This would break lines like CASE_NUMBER="#12345"
Thanks for taking this on. Have you considered making the parameter file yaml/json and using https://github.com/go-yaml/yaml. I think this is more consistent with configuration in a kubernetes ecosystem and the package provides the parsing for you. |
Thanks @wookasz for the quick review! I had thought about yaml, but I decided to start simple and see where it goes. I'll push a new commit with that support! |
I updated the PR to use YAML/JSON as the format for the parameters file, which should naturally also take care of the comment parsing issue. The only caveat here is the files have to marshal into a |
Thanks for your contribution!
One approach is that you can unmarshal to a map[string]interface{}, then when setting the value from the interface object, you use |
…nstead of map[string]string
Sounds good to me 👍 |
Hi, where i can find documentation how to use it? |
For workflows that have many parameters, or cases where the workflows should be run with slightly different requirements, it can be useful to have a file containing parameters instead of submitting via the command line.
This commit adds support for the
--parameter-file
(-f
) command line option to provide a new-line-delimited file of parameters. These parameters can still be overridden by the--parameter
(-p
) flags.Comments in parameter files are also supported and denoted by a
#
character.See #796 for more information