-
Notifications
You must be signed in to change notification settings - Fork 495
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
builder: move builder creation logic to builder package #2150
Conversation
2f87d1c
to
61cfb22
Compare
if opts.Name == "default" { | ||
return nil, errors.Errorf("default is a reserved name and cannot be used to identify builder instance") | ||
} else if opts.Append && opts.Name == "" { | ||
return nil, errors.Errorf("append requires a builder name") |
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.
Now returns an error instead of a warning log:
Line 67 in b2f705a
logrus.Warnf("append used without name, creating a new instance instead") |
I think being more strict about it is fine but let me know if we should typed this kind error and handle it it differently in command
package when invoked through the CLI to still log a warning or just pass a logger to Create
.
} | ||
for _, c := range contexts { | ||
if c.Name == name { | ||
return nil, errors.Errorf("instance name %q already exists as context builder", name) |
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.
Same as #2150 (comment)
61cfb22
to
c9daf3d
Compare
switch { | ||
case driverName == "kubernetes": | ||
if opts.Endpoint != "" { | ||
return nil, errors.Errorf("kubernetes driver does not support endpoint args %q", opts.Endpoint) |
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.
Same as #2150 (comment)
err2 = txn.Save(ngOriginal) | ||
} | ||
if err2 != nil { | ||
return nil, errors.Errorf("could not rollback to previous state: %s", err2) |
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.
Same as #2150 (comment)
This moves the builder creation logic to the builder package as we plan to allow builder creation in the build ui of Docker Desktop so we avoid drifting with the same logic in command package. Signed-off-by: CrazyMax <[email protected]>
c9daf3d
to
ceb5bc8
Compare
var ep string | ||
var setEp bool | ||
switch { | ||
case driverName == "kubernetes": |
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.
Ideally, these driver specifics can be removed from this package eventually, but not new code as this is how it was in commands
as well.
This moves the builder creation logic to the builder package as we plan to allow builder creation in the build UI of Docker Desktop so we avoid drifting with the same logic in
command
package.