Fix --label-file weird behavior#838
Merged
thaJeztah merged 1 commit intodocker:masterfrom Jan 30, 2018
Merged
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 |
thaJeztah
requested changes
Jan 27, 2018
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) { |
Member
There was a problem hiding this comment.
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)
Collaborator
Author
There was a problem hiding this comment.
😝 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
Collaborator
Author
|
Ok this caused a regression, I'll fix it 😅 |
nobiit
pushed a commit
to nobidev/docker-cli
that referenced
this pull request
Nov 19, 2025
Fix `--label-file` weird behavior Upstream-commit: 9de1b16 Component: cli
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
--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