-
Notifications
You must be signed in to change notification settings - Fork 221
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
cmd/root: Add support for configuration files #828
Closed
HarryMichal
wants to merge
4
commits into
containers:main
from
HarryMichal:cmd/add-config-file-support
Closed
cmd/root: Add support for configuration files #828
HarryMichal
wants to merge
4
commits into
containers:main
from
HarryMichal:cmd/add-config-file-support
Conversation
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
HarryMichal
added
5. Help Wanted
Extra attention is needed
6. Major Change
May cause breakage
2. Design
Design discussion
3. New Feature
New feature
2. Under The Hood
Multiple areas of the app are influenced by this ticket
labels
Jul 3, 2021
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 3, 2021
Some aspects of Toolbox could be configured (e.g., the default used image). Let's enable that! containers#828
HarryMichal
force-pushed
the
cmd/add-config-file-support
branch
from
July 3, 2021 22:05
d8ece80
to
740eb63
Compare
Build failed.
|
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 8, 2021
It was not apparent on first glance that the second parameter represented a release (resp. tag). containers#828
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 8, 2021
Some aspects of Toolbox could be configured (e.g., the default used image). containers#828
HarryMichal
force-pushed
the
cmd/add-config-file-support
branch
from
July 8, 2021 13:43
740eb63
to
d751368
Compare
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 8, 2021
It was not apparent on first glance that the second parameter represented a release (resp. tag). containers#828
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 8, 2021
ResolveContainerAndImageNames() function does too much work. It makes more sense to have two functions: one for image name resolving and other for container name resolving. containers#828
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 8, 2021
The file format is TOML[0] but the file extension is .conf to follow the convention set by Podman. containers#828
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 8, 2021
Some aspects of Toolbox could be configured (e.g., the default used image). containers#828
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 8, 2021
HarryMichal
force-pushed
the
cmd/add-config-file-support
branch
from
July 8, 2021 13:47
d751368
to
0df5933
Compare
Build failed.
|
debarshiray
requested changes
Jul 11, 2021
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 for working on this, @HarryMichal ! Some quick comments:
debarshiray
requested changes
Jul 13, 2021
debarshiray
pushed a commit
to debarshiray/toolbox
that referenced
this pull request
Jul 13, 2021
The ResolveContainerAndImageNames() function does too much work. It makes more sense to have two functions: one for resolving the image name and another for resolving the container name. containers#828
debarshiray
pushed a commit
to debarshiray/toolbox
that referenced
this pull request
Jul 13, 2021
The ResolveContainerAndImageNames() function does too much work. It makes more sense to have two functions: one for resolving the image name and another for resolving the container name. containers#828 containers#838
debarshiray
pushed a commit
to debarshiray/toolbox
that referenced
this pull request
Jul 13, 2021
The ResolveContainerAndImageNames() function does too much work. It makes more sense to have two functions: one for resolving the image name and another for resolving the container name. containers#828 containers#838
I split out the break-up of |
debarshiray
reviewed
Jul 21, 2021
debarshiray
reviewed
Jul 21, 2021
debarshiray
reviewed
Jul 21, 2021
Figuring out the default toolbox image for a given distribution only needs to happen as part of resolving the final toolbox image name from the given command line options. Fallout from c990fb4 containers#828
debarshiray
pushed a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 21, 2021
The file format is TOML[0] but the file extension is .conf to follow the convention set by Podman. containers#828
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Jul 23, 2021
A subsequent commit will add support for configuration files, which can override the default toolbox image. Since this override affects all commands, it effectively ends up adding a fourth option to the 'enter' command, other than the existing options to change the distribution, release and container. This makes it a lot more difficult to reason when only 'toolbox enter --release N' is enough to enter the created container. containers#828 containers#851
debarshiray
pushed a commit
to debarshiray/toolbox
that referenced
this pull request
Jul 23, 2021
The file format is TOML[0] but the file extension is .conf to follow the convention set by Podman. containers#828 containers#851
debarshiray
pushed a commit
to debarshiray/toolbox
that referenced
this pull request
Jul 23, 2021
It looks like there are some oddities with Viper [1]. The errors can't be examined with errors.As [2] and Viper doesn't actually throw ConfigFileNotFoundError if a configuration file is not found. Secondly, there's no way to find out if a key was actually specified in a configuration file. The InConfig API doesn't return 'true' even if a key was mentioned in a configuration file, and the IsSet API returns 'true' even if the key was only set via SetDefault in the code. Some changes by Debarshi Ray. [1] https://pkg.go.dev/github.com/spf13/viper [2] https://blog.golang.org/go1.13-errors containers#828 containers#851
debarshiray
pushed a commit
to debarshiray/toolbox
that referenced
this pull request
Jul 23, 2021
The file format is TOML[0] but the file extension is .conf to follow the convention set by Podman. containers#828 containers#851
debarshiray
pushed a commit
to debarshiray/toolbox
that referenced
this pull request
Jul 23, 2021
It looks like there are some oddities with Viper [1]. The errors can't be examined with errors.As [2] and Viper doesn't actually throw ConfigFileNotFoundError if a configuration file is not found. Secondly, there's no way to find out if a key was actually specified in a configuration file. The InConfig API doesn't return 'true' even if a key was mentioned in a configuration file, and the IsSet API returns 'true' even if the key was only set via SetDefault in the code. Some changes by Debarshi Ray. [1] https://pkg.go.dev/github.com/spf13/viper [2] https://blog.golang.org/go1.13-errors containers#828 containers#851
Closing. The work on tests can be done in a separate PR. |
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 29, 2021
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 29, 2021
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 29, 2021
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 29, 2021
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 29, 2021
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 29, 2021
HarryMichal
added a commit
to HarryMichal/toolbox
that referenced
this pull request
Jul 29, 2021
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Jul 31, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. Splitting things even further might make it worse. A better approach might be to (re-)unify the code further. This is the first step towards that. This reverts the following commits: * 5c8ad7a * 02f45fd * 8b6418d ... but retains the test cases that were not tied to the changes in those commits. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Jul 31, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. It pushed the burden on the callers, who needed to carefully call the split functions in the right order, because the container, distro, image and release values are very tightly related. This opens the door for mistakes. A better approach would be to restore ResolveContainerAndImageNames as the single public API. If necessary it could be internally split into smaller private functions. It would keep things simple for the callers. Note that this commit doesn't include the private split. If necessary, it can be done in future. This reverts commit fd75608. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Aug 1, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. Splitting things even further might make it worse. A better approach might be to (re-)unify the code further. This is the first step towards that. This reverts the following commits: * 5c8ad7a * 02f45fd * 8b6418d ... but retains the test cases that were not tied to the changes in those commits. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Aug 1, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. It pushed the burden on the callers, who needed to carefully call the split functions in the right order, because the container, distro, image and release values are very tightly related. This opens the door for mistakes. A better approach would be to restore ResolveContainerAndImageNames as the single public API. If necessary it could be internally split into smaller private functions. It would keep things simple for the callers. Note that this commit doesn't include the private split. If necessary, it can be done in future. This reverts commit fd75608. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Aug 31, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. Splitting things even further might make it worse. A better approach might be to (re-)unify the code further. This is the first step towards that. This reverts the following commits: * 5c8ad7a * 02f45fd * 8b6418d ... but retains the test cases that were not tied to the changes in those commits. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Aug 31, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. It pushed the burden on the callers, who needed to carefully call the split functions in the right order, because the container, distro, image and release values are very tightly related. This opens the door for mistakes. A better approach would be to restore ResolveContainerAndImageNames as the single public API. If necessary it could be internally split into smaller private functions. It would keep things simple for the callers. Note that this commit doesn't include the private split. If necessary, it can be done in future. This reverts commit fd75608. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Aug 31, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. Splitting things even further might make it worse. A better approach might be to (re-)unify the code further. This is the first step towards that. This reverts the following commits: * 5c8ad7a * 02f45fd * 8b6418d ... but retains the test cases that were not tied to the changes in those commits. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Aug 31, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. It pushed the burden on the callers, who needed to carefully call the split functions in the right order, because the container, distro, image and release values are very tightly related. This opens the door for mistakes. A better approach would be to restore ResolveContainerAndImageNames as the single public API. If necessary it could be internally split into smaller private functions. It would keep things simple for the callers. Note that this commit doesn't include the private split. If necessary, it can be done in future. This reverts commit fd75608. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Sep 1, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. Splitting things even further might make it worse. A better approach might be to (re-)unify the code further. This is the first step towards that. This reverts the following commits: * 5c8ad7a * 02f45fd * 8b6418d ... but retains the test cases that were not tied to the changes in those commits. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Sep 1, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. It pushed the burden on the callers, who needed to carefully call the split functions in the right order, because the container, distro, image and release values are very tightly related. This opens the door for mistakes. A better approach would be to restore ResolveContainerAndImageNames as the single public API. If necessary it could be internally split into smaller private functions. It would keep things simple for the callers. Note that this commit doesn't include the private split. If necessary, it can be done in future. This reverts commit fd75608. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Sep 1, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. Splitting things even further might make it worse. A better approach might be to (re-)unify the code further. This is the first step towards that. This reverts the following commits: * 5c8ad7a * 02f45fd * 8b6418d ... but retains the test cases that were not tied to the changes in those commits. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937 containers#1080
debarshiray
added a commit
to debarshiray/toolbox
that referenced
this pull request
Sep 1, 2022
The idea of splitting ResolveContainerAndImageNames into two public functions [1] didn't turn out to be so useful [2]. It pushed the burden on the callers, who needed to carefully call the split functions in the right order, because the container, distro, image and release values are very tightly related. This opens the door for mistakes. A better approach would be to restore ResolveContainerAndImageNames as the single public API. If necessary it could be internally split into smaller private functions. It would keep things simple for the callers. Note that this commit doesn't include the private split. If necessary, it can be done in future. This reverts commit fd75608. [1] Commit fd75608 containers#828 containers#838 [2] containers#977 containers#937 containers#1080
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
2. Design
Design discussion
2. Under The Hood
Multiple areas of the app are influenced by this ticket
3. New Feature
New feature
5. Help Wanted
Extra attention is needed
6. Major Change
May cause breakage
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.
Some aspects of Toolbox could be configured (e.g., the default used
image). Let's enable that!