-
Notifications
You must be signed in to change notification settings - Fork 286
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 pack config default-builder subcommand #982
Conversation
d3a9e07
to
d39f16f
Compare
cmd := &cobra.Command{ | ||
Use: "config", | ||
Short: "Interact with Pack's configuration", | ||
RunE: nil, | ||
} | ||
|
||
cmd.AddCommand(trustedBuilder(logger, cfg, cfgPath)) | ||
cmd.AddCommand(ConfigTrustedBuilder(logger, cfg, cfgPath)) |
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.
Though not strictly necessary for this PR, I changed this to make it easier to test alone, and require fewer mocks created in the trustedBuilder
tests.
h.AssertContains(t, output, command) | ||
} | ||
}) | ||
}) | ||
|
||
when("trusted-builders", func() { |
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 moved these tests to config_trusted_builder_test.go
, which made more semantic sense than testing them here, where we only need to know that the appropriate commands show up.
internal/commands/report_test.go
Outdated
|
||
tempPackHome, err = ioutil.TempDir("", "pack-home") | ||
h.AssertNil(t, err) | ||
|
||
packConfigPath = filepath.Join(tempPackHome, "config.toml") | ||
cmd = commands.Report(logger, testVersion, packConfigPath) | ||
cmd.SetArgs([]string{}) |
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.
The failure to set args was causing issues with my local tests, so I added it to ensure that it passes, and took the opportunity to do dependency injection. I can revert that if requested, though.
Codecov Report
@@ Coverage Diff @@
## main #982 +/- ##
==========================================
- Coverage 79.20% 79.07% -0.13%
==========================================
Files 128 126 -2
Lines 5581 5540 -41
==========================================
- Hits 4420 4380 -40
+ Misses 748 747 -1
Partials 413 413
Flags with carried forward coverage won't be shown. Click here to find out more. |
d39f16f
to
cabd18b
Compare
cabd18b
to
1c537c3
Compare
* This command allows users to list, set, and unset a value for a default builder in the pack config. Signed-off-by: David Freilich <dfreilich@vmware.com>
Signed-off-by: David Freilich <dfreilich@vmware.com>
e925edf
to
a68edce
Compare
Signed-off-by: David Freilich dfreilich@vmware.com
Summary
This command allows users to list, set, and unset a value for a default builder in the pack config, with the command having three forms:
pack config default-builder
→ lists the current default builder, or prints a clear message if there is nonepack config default-builder <some-builder>
→ After validating the builder exists, either locally or in a remote registry, it is added to the pack config, with a success message printedpack config default-builder --unset
→ If there is a default builder configured, it will remove that from the config, and print a success message. If not, it will print a clear message, saying that there wasn't a builder set.As part of that, I added a deprecation warning to the existing
pack set-default-builder
command. I also slightly changed the behavior, so that instead of runningpack suggest-builder
(which has some latency) if no builder is set or the builder set isn't a valid builder, we just recommend that users can runpack suggest-builder
.Additionally, as part of this PR, I configured the
rebase
command to use dependency injection for the pack config path, given that my testing setup had caused issues with it in the current format.Output
After
Documentation
Related
Resolves #924
Relates to #597