-
Notifications
You must be signed in to change notification settings - Fork 80
begin: added docker2aci support for both local and remote images #138
Conversation
@@ -49,9 +51,9 @@ func runBegin(cmd *cobra.Command, args []string) (exit int) { | |||
|
|||
var err error | |||
if len(args) == 0 { | |||
err = newACBuild().Begin("", insecure) | |||
err = newACBuild().Begin("", insecure, "") |
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.
To me, this indicates Begin()
should start taking a single parameter, which is a struct containing config values. Lots of potentially empty positional arguments will only continue to grow most likely as use-cases develop.
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 was actually thinking of exposing all of the helper functions for Begin
(beginWithRemoteImage
, beginWithEmptyImage
, ...) to the world, removing the Begin
function, and having the github.com/appc/acbuild/acbuild
package contain the logic for which one to call.
Think that would make more sense?
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.
Potentially. Just making a note that providing "zero values" as positional arguments usually indicates that as the function grows in scope, it's parameter list will get very long, with lots more zero values being provided, so a struct does will in that scenario.
If you're breaking it apart and having callers call the appropriate Begin*()
function then it's probably unneeded.
Shameless cross post, I'd really like to see rkt/rkt#795 (comment) happen and am wondering if we can use this as an excuse to drive it so we can just share code. |
052827e
to
09ea2ab
Compare
bump on this, I'd like to see this finished and then if the rkt fetch plugins land and look like they'd work here I can tear it out again later. I also just refactored all of
For some reason though beginning from local docker files doesn't appear to work for me:
|
} | ||
}() | ||
|
||
renderedACIs, err := docker2aci.ConvertFile(dockerImageName, start, true, a.ContextPath, "") |
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.
IMO de-dupe all the boilerplate around this line by having:
type renderFunc func() (string, error)
func (a *ACBuild) beginFromDocker(rf renderFunc) (err error) { ... }
func (a *ACBuild) BeginFromLocalDockerImage(start string, dockerImageName string) (err error) {
return a.beginFromDocker(func() (string, error) {
return docker2aci.ConvertFile(dockerImageName, start, true, a.ContextPath, "")
})
}
etc
Maybe this is OK but I am a bit worried about the UX, it is a total mishmash. I almost wonder if we could instead encourage people to use the
that seems like a blocker for exposing that..? |
It's broken for me too, and it's definitely a blocker. Wasn't able to dig into why it's broken yet.
|
Given that starting with a docker image is really the only reasonable way The ecosystem is already so built around docker and base images are a huge
|
09ea2ab
to
f4a7392
Compare
This commit pulls in docker2aci to add support for commands such as: acbuild begin docker://alpine Beginning from local docker images remains unimplemented, and will be added in a future commit.
f4a7392
to
8f99880
Compare
Revisited this. I dropped support for loading in docker images from disk to side step that issue for now, and everything appears to be working. I think baking docker2aci support into acbuild is worthwhile over just telling users to use docker2aci, as it lowers the barrier for people to be able to get up and running building ACIs. I also think the UX right now around beginning from stuff is fine, you call Begin from nothing:
Begin from a rootfs tar file:
Begin from a local ACI:
Begin from a remote ACI:
Begin from a remote docker image:
|
Seems OK. This is with latest upstream docker2aci? |
Yup, v0.11.1. |
LGTM for now. |
For the record, I see this is in acbuild v0.3.1. |
Yeah I screwed up the release's changelog (the time between me writing it and it being merged was longer than I expected). Since it's an enhancement, doesn't impact people who don't know about it, and doesn't show up in the help pages, I figured I'd just include it in the next release's changelog. |
acbuild begin can now be passed a remote docker image, via
docker://image/name
, or a local docker image, via a file path and thenew
--docker-image-name
flag.Currently importing local docker files is not completely functional, putting this up for feedback anyway.