summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-06-18 09:48:52 -0400
committerMatthew Heon <mheon@redhat.com>2020-06-24 14:32:43 -0400
commit37abb88aa02773e76ccb87183c8ac6cbb9cf2071 (patch)
tree404e8a950b2165e1bbcfe931e003ddd05e079f8d
parent27120bfbab65e4a423e4801a0d93bdb661779a98 (diff)
downloadpodman-37abb88aa02773e76ccb87183c8ac6cbb9cf2071.tar.gz
podman-37abb88aa02773e76ccb87183c8ac6cbb9cf2071.tar.bz2
podman-37abb88aa02773e76ccb87183c8ac6cbb9cf2071.zip
Fix podman build handling of --http-proxy flag
Also fixed a todo for handling of cgroup manager while I was in there. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
-rw-r--r--cmd/podman/images/build.go20
-rw-r--r--test/e2e/build_test.go17
2 files changed, 25 insertions, 12 deletions
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go
index 2efc795cd..23bfcab79 100644
--- a/cmd/podman/images/build.go
+++ b/cmd/podman/images/build.go
@@ -9,6 +9,7 @@ import (
"github.com/containers/buildah/imagebuildah"
buildahCLI "github.com/containers/buildah/pkg/cli"
"github.com/containers/buildah/pkg/parse"
+ "github.com/containers/common/pkg/config"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/cmd/podman/utils"
"github.com/containers/libpod/pkg/domain/entities"
@@ -396,16 +397,10 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
runtimeFlags = append(runtimeFlags, "--"+arg)
}
- // FIXME: the code below needs to be enabled (and adjusted) once the
- // global/root flags are supported.
-
- // conf, err := runtime.GetConfig()
- // if err != nil {
- // return err
- // }
- // if conf != nil && conf.Engine.CgroupManager == config.SystemdCgroupsManager {
- // runtimeFlags = append(runtimeFlags, "--systemd-cgroup")
- // }
+ containerConfig := registry.PodmanConfig()
+ if containerConfig.Engine.CgroupManager == config.SystemdCgroupsManager {
+ runtimeFlags = append(runtimeFlags, "--systemd-cgroup")
+ }
opts := imagebuildah.BuildOptions{
AddCapabilities: flags.CapAdd,
@@ -418,12 +413,13 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
CNIPluginPath: flags.CNIPlugInPath,
CommonBuildOpts: &buildah.CommonBuildOptions{
AddHost: flags.AddHost,
- CgroupParent: flags.CgroupParent,
CPUPeriod: flags.CPUPeriod,
CPUQuota: flags.CPUQuota,
- CPUShares: flags.CPUShares,
CPUSetCPUs: flags.CPUSetCPUs,
CPUSetMems: flags.CPUSetMems,
+ CPUShares: flags.CPUShares,
+ CgroupParent: flags.CgroupParent,
+ HTTPProxy: flags.HTTPProxy,
Memory: memoryLimit,
MemorySwap: memorySwap,
ShmSize: flags.ShmSize,
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index 9e41fd231..0cf5283ad 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -195,4 +195,21 @@ var _ = Describe("Podman build", func() {
Expect(session.ExitCode()).To(Equal(0))
})
+ It("podman build --http_proxy flag", func() {
+ SkipIfRemote()
+ os.Setenv("http_proxy", "1.2.3.4")
+ podmanTest.RestoreAllArtifacts()
+ dockerfile := `FROM docker.io/library/alpine:latest
+RUN printenv http_proxy`
+
+ dockerfilePath := filepath.Join(podmanTest.TempDir, "Dockerfile")
+ err := ioutil.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
+ Expect(err).To(BeNil())
+ session := podmanTest.PodmanNoCache([]string{"build", "--file", dockerfilePath, podmanTest.TempDir})
+ session.Wait(120)
+ Expect(session.ExitCode()).To(Equal(0))
+ ok, _ := session.GrepString("1.2.3.4")
+ Expect(ok).To(BeTrue())
+ os.Unsetenv("http_proxy")
+ })
})