diff options
author | baude <bbaude@redhat.com> | 2018-06-05 13:18:52 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-06-05 19:31:13 +0000 |
commit | 06a29f0bdeeaca1591e80aac8e08b5363fdb9977 (patch) | |
tree | c8c1a7cb4d9573e17cb2ce29fbb202af4ced7fb7 /cmd/podman | |
parent | 7965bf54048044d63f967d2b4ce8efe1e1072f05 (diff) | |
download | podman-06a29f0bdeeaca1591e80aac8e08b5363fdb9977.tar.gz podman-06a29f0bdeeaca1591e80aac8e08b5363fdb9977.tar.bz2 podman-06a29f0bdeeaca1591e80aac8e08b5363fdb9977.zip |
varlink build fixes
the varlink build was not working as designed and required some touch-ups:
* return a struct that includes logs and the new image ID
* pass namespaceoption so that networking in buildah works
Signed-off-by: baude <bbaude@redhat.com>
Closes: #903
Approved by: rhatdan
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/build.go | 12 | ||||
-rw-r--r-- | cmd/podman/varlink/io.projectatomic.podman.varlink | 12 |
2 files changed, 21 insertions, 3 deletions
diff --git a/cmd/podman/build.go b/cmd/podman/build.go index 9d5dabe9f..ae5001da5 100644 --- a/cmd/podman/build.go +++ b/cmd/podman/build.go @@ -5,7 +5,9 @@ import ( "path/filepath" "strings" + "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" + "github.com/projectatomic/buildah" "github.com/projectatomic/buildah/imagebuildah" buildahcli "github.com/projectatomic/buildah/pkg/cli" "github.com/projectatomic/buildah/pkg/parse" @@ -30,6 +32,8 @@ var ( func buildCmd(c *cli.Context) error { // The following was taken directly from projectatomic/buildah/cmd/bud.go // TODO Find a away to vendor more of this in rather than copy from bud + + var namespace []buildah.NamespaceOption output := "" tags := []string{} if c.IsSet("tag") || c.IsSet("t") { @@ -151,6 +155,13 @@ func buildCmd(c *cli.Context) error { return err } + hostNetwork := buildah.NamespaceOption{ + Name: specs.NetworkNamespace, + Host: true, + } + + namespace = append(namespace, hostNetwork) + options := imagebuildah.BuildOptions{ ContextDirectory: contextDir, PullPolicy: pullPolicy, @@ -170,6 +181,7 @@ func buildCmd(c *cli.Context) error { Squash: c.Bool("squash"), Labels: c.StringSlice("label"), Annotations: c.StringSlice("annotation"), + NamespaceOptions: namespace, } if !c.Bool("quiet") { diff --git a/cmd/podman/varlink/io.projectatomic.podman.varlink b/cmd/podman/varlink/io.projectatomic.podman.varlink index 0066e6fb2..fdc941e1a 100644 --- a/cmd/podman/varlink/io.projectatomic.podman.varlink +++ b/cmd/podman/varlink/io.projectatomic.podman.varlink @@ -320,6 +320,12 @@ type BuildInfo ( image_format: string ) +# BuildResponse is used to describe the responses for building images +type BuildResponse ( + logs: []string, + id: string +) + # Ping provides a response for developers to ensure their varlink setup is working. # #### Example # ~~~ @@ -525,9 +531,9 @@ method ListImages() -> (images: []ImageInList) method GetImage(name: string) -> (image: ImageInList) # BuildImage takes a [BuildInfo](#BuildInfo) structure and builds an image. At a minimum, you must provide the -# 'dockerfile' and 'tags' options in the BuildInfo structure. Upon a successful build, it will -# return the ID of the container. -method BuildImage(build: BuildInfo) -> (image: []string) +# 'dockerfile' and 'tags' options in the BuildInfo structure. It will return a [BuildResponse](#BuildResponse) structure +# that contains the build logs and resulting image ID. +method BuildImage(build: BuildInfo) -> (image: BuildResponse) # This function is not implemented yet. method CreateImage() -> (notimplemented: NotImplemented) |