-
Notifications
You must be signed in to change notification settings - Fork 294
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 config trusted-builders subcommands #959
Conversation
d48010b
to
b5162dc
Compare
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.
Looking great! Functionality I think is there. My request for changes are primarily cleanup.
internal/commands/config/config.go
Outdated
"github.com/buildpacks/pack/logging" | ||
) | ||
|
||
func Config(logger logging.Logger, cfg config.Config, cfgPath string) *cobra.Command { |
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.
func Config(logger logging.Logger, cfg config.Config, cfgPath string) *cobra.Command { | |
func NewConfigCommand(logger logging.Logger, cfg config.Config, cfgPath string) *cobra.Command { |
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'm happy to change that, but in my initial comment
to the stack cmd PR (#937 (comment)), I had urged away from doing that.
Our command pattern is typically to do the command name itself (e.g. command.Build), so I think this would fit the pattern a bit more.
Just want to confirm whether this should be the new pattern. It does make more sense (because then it will be used as rootCmd.AddCommand(config.NewCommand(...))
e0d9378
to
03975ae
Compare
2d18b9c
to
8f17f9c
Compare
Blocked on #964 |
8f17f9c
to
8d10749
Compare
Codecov Report
@@ Coverage Diff @@
## main #959 +/- ##
==========================================
+ Coverage 77.63% 77.92% +0.29%
==========================================
Files 105 107 +2
Lines 5060 5116 +56
==========================================
+ Hits 3928 3986 +58
+ Misses 731 730 -1
+ Partials 401 400 -1
Flags with carried forward coverage won't be shown. Click here to find out more. |
8d10749
to
9023079
Compare
} | ||
|
||
// Technically the creator is supported as of platform API version 0.3 (lifecycle version 0.7.0+) but earlier versions | ||
// have bugs that make using the creator problematic. | ||
creatorSupported := lifecycle.SupportsFeature(config.CreatorInLifecycle) && | ||
pack.SupportsFeature(invoke.CreatorInPack) | ||
|
||
usingCreator = creatorSupported && trustBuilder | ||
usingCreator = creatorSupported |
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.
trust-builder
is supported by all versions tested
9023079
to
48483b6
Compare
…ng to subcommands Signed-off-by: David Freilich <dfreilich@vmware.com>
Signed-off-by: David Freilich <dfreilich@vmware.com>
* Create config command generators, and replace list-trusted/trust/untrust builder funcs Signed-off-by: David Freilich <dfreilich@vmware.com>
…mands Signed-off-by: David Freilich <dfreilich@vmware.com>
* Add acceptance test for deprecation warning * Fix linting errors * Add command to rootCmd Signed-off-by: David Freilich <dfreilich@vmware.com>
Signed-off-by: David Freilich <dfreilich@vmware.com>
command Signed-off-by: David Freilich <dfreilich@vmware.com> Signed-off-by: David Freilich <dfreilich@vmware.com>
* Rename trusted-builder to trusted-builders, to follow RFC * Change Config to NewConfigCommand Signed-off-by: David Freilich <dfreilich@vmware.com>
Signed-off-by: David Freilich <dfreilich@vmware.com>
48483b6
to
c67b0fb
Compare
@@ -73,13 +72,17 @@ func NewPackCommand(logger ConfigurableLogger) (*cobra.Command, error) { | |||
rootCmd.AddCommand(commands.SetDefaultBuilder(logger, cfg, &packClient)) | |||
rootCmd.AddCommand(commands.InspectBuilder(logger, cfg, &packClient, writer.NewFactory())) | |||
rootCmd.AddCommand(commands.SuggestBuilders(logger, &packClient)) | |||
//nolint:staticcheck |
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.
Out of curiosity, what lint warning are we suppressing?
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.
Using a deprecated command.
✅ Accepted
|
Signed-off-by: David Freilich <dfreilich@vmware.com> Co-authored-by: Javier Romero <rjavier@vmware.com>
Signed-off-by: David Freilich <dfreilich@vmware.com>
Summary
This PR adds 4
pack config trusted-builders
subcommands:pack config trusted-builders
→ Lists trusted builderspack config trusted-builders list
pack config trusted-builders add <builder>
pack config trusted-builders remove <builder>
As part of it, it also hid the commands
pack trust-builder
,pack untrust-builder
, andpack list-trusted-builders
, and aliased them to the respective new commands.In order to accomplish this cleanly, I also made some of the funcs/items in the
commands
package public, which changed a fair number of files.Output
Before
After
Documentation
Related
Resolves #921
Relates to (and partially accomplishes) #597