-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix --label-file weird behavior
#838
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #838 +/- ##
==========================================
- Coverage 52.95% 52.93% -0.02%
==========================================
Files 244 245 +1
Lines 15839 15837 -2
==========================================
- Hits 8387 8384 -3
- Misses 6898 6899 +1
Partials 554 554 |
dnephin
left a comment
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.
LGTM
thaJeztah
left a comment
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.
Thanks! Left a suggestion
opts/parse.go
Outdated
| // ReadKVStrings reads a file of line terminated key=value pairs, and overrides any keys | ||
| // present in the file with additional pairs specified in the override parameter | ||
| func ReadKVStrings(files []string, override []string) ([]string, error) { | ||
| func ReadKVStrings(files []string, override []string, emptyFn func(string) string) ([]string, error) { |
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.
A couple of lines below, this still refers to environment variables.
Perhaps we should (for now)
- un-export
ParseKeyValueFile - have two wrappers; one variation of
ReadKVStringfor labels, and one for environment variables - those wrappers don't need the
emptyFnas an argument (while nice, we don't really need that functionality at this point)
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 can take care of that 👼
`--label-file` has the exact same behavior as `--env-file`, meaning any placeholder (i.e. a simple key, no `=` sign, no value), it will get the value from the environment variable. For `--label-file` it should just add an empty label. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
9308ca8 to
2b17f4c
Compare
thaJeztah
left a comment
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.
LGTM, thanks!
|
Ok this caused a regression, I'll fix it 😅 |
Fix `--label-file` weird behavior Upstream-commit: 9de1b16 Component: cli
--label-filehas the exact same behavior as--env-file, meaning anyplaceholder (i.e. a simple key, no
=sign, no value), it will get thevalue from the environment variable.
For
--label-fileit should just add an empty label.(Same for
--label, it should never get value from the environment variables).Fix moby/moby#31087.
🐅 🦁
Signed-off-by: Vincent Demeester vincent@sbr.pm