diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-06-01 16:05:54 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-06-01 20:58:39 +0000 |
commit | b6753238bcf2e996b1116c6f91e25a6688f835ea (patch) | |
tree | 45de8aeb0fd0d694c77b20dc676c9c7830ab6dc7 | |
parent | c2e3058b3b35695a134b1dfdb4167632a3c767cf (diff) | |
download | podman-b6753238bcf2e996b1116c6f91e25a6688f835ea.tar.gz podman-b6753238bcf2e996b1116c6f91e25a6688f835ea.tar.bz2 podman-b6753238bcf2e996b1116c6f91e25a6688f835ea.zip |
Bump Buildah vendor to pick up fix for tests
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #878
Approved by: mheon
-rw-r--r-- | vendor.conf | 2 | ||||
-rw-r--r-- | vendor/github.com/projectatomic/buildah/run.go | 67 |
2 files changed, 45 insertions, 24 deletions
diff --git a/vendor.conf b/vendor.conf index e53d04523..5f9391b08 100644 --- a/vendor.conf +++ b/vendor.conf @@ -88,7 +88,7 @@ k8s.io/kube-openapi 275e2ce91dec4c05a4094a7b1daee5560b555ac9 https://github.com/ k8s.io/utils 258e2a2fa64568210fbd6267cf1d8fd87c3cb86e https://github.com/kubernetes/utils github.com/mrunalp/fileutils master github.com/varlink/go master -github.com/projectatomic/buildah b66e8531456e2986ffc409f591c9005813589a34 +github.com/projectatomic/buildah 01a443f7382025264e27ec95ea203ab9314677a2 github.com/Nvveen/Gotty master github.com/fsouza/go-dockerclient master github.com/openshift/imagebuilder master diff --git a/vendor/github.com/projectatomic/buildah/run.go b/vendor/github.com/projectatomic/buildah/run.go index 4a962a0d6..6c85d735b 100644 --- a/vendor/github.com/projectatomic/buildah/run.go +++ b/vendor/github.com/projectatomic/buildah/run.go @@ -285,8 +285,7 @@ func addCommonOptsToSpec(commonOpts *CommonBuildOptions, g *generate.Generator) func (b *Builder) setupMounts(mountPoint string, spec *specs.Spec, optionMounts []specs.Mount, bindFiles map[string]string, builtinVolumes, volumeMounts []string, shmSize string, namespaceOptions NamespaceOptions) error { // Start building a new list of mounts. - mounts := make([]specs.Mount, len(optionMounts)) - copy(mounts, optionMounts) + var mounts []specs.Mount haveMount := func(destination string) bool { for _, mount := range mounts { if mount.Destination == destination { @@ -396,7 +395,7 @@ func (b *Builder) setupMounts(mountPoint string, spec *specs.Spec, optionMounts } // Get the list of explicitly-specified volume mounts. - volumes, err := runSetupVolumeMounts(spec.Linux.MountLabel, volumeMounts) + volumes, err := runSetupVolumeMounts(spec.Linux.MountLabel, volumeMounts, optionMounts) if err != nil { return err } @@ -460,17 +459,10 @@ func runSetupBuiltinVolumes(mountLabel, mountPoint, containerDir string, copyWit return mounts, nil } -func runSetupVolumeMounts(mountLabel string, volumeMounts []string) ([]specs.Mount, error) { +func runSetupVolumeMounts(mountLabel string, volumeMounts []string, optionMounts []specs.Mount) ([]specs.Mount, error) { var mounts []specs.Mount - // Bind mount volumes given by the user at execution - for _, i := range volumeMounts { - var options []string - spliti := strings.Split(i, ":") - if len(spliti) > 2 { - options = strings.Split(spliti[2], ",") - } - options = append(options, "rbind") + parseMount := func(host, container string, options []string) (specs.Mount, error) { var foundrw, foundro, foundz, foundZ bool var rootProp string for _, opt := range options { @@ -491,25 +483,46 @@ func runSetupVolumeMounts(mountLabel string, volumeMounts []string) ([]specs.Mou options = append(options, "rw") } if foundz { - if err := label.Relabel(spliti[0], mountLabel, true); err != nil { - return nil, errors.Wrapf(err, "relabeling %q failed", spliti[0]) + if err := label.Relabel(host, mountLabel, true); err != nil { + return specs.Mount{}, errors.Wrapf(err, "relabeling %q failed", host) } } if foundZ { - if err := label.Relabel(spliti[0], mountLabel, false); err != nil { - return nil, errors.Wrapf(err, "relabeling %q failed", spliti[0]) + if err := label.Relabel(host, mountLabel, false); err != nil { + return specs.Mount{}, errors.Wrapf(err, "relabeling %q failed", host) } } if rootProp == "" { options = append(options, "private") } - - mounts = append(mounts, specs.Mount{ - Destination: spliti[1], + return specs.Mount{ + Destination: container, Type: "bind", - Source: spliti[0], + Source: host, Options: options, - }) + }, nil + } + // Bind mount volumes specified for this particular Run() invocation + for _, i := range optionMounts { + mount, err := parseMount(i.Source, i.Destination, append(i.Options, "rbind")) + if err != nil { + return nil, err + } + mounts = append(mounts, mount) + } + // Bind mount volumes given by the user when the container was created + for _, i := range volumeMounts { + var options []string + spliti := strings.Split(i, ":") + if len(spliti) > 2 { + options = strings.Split(spliti[2], ",") + } + options = append(options, "rbind") + mount, err := parseMount(spliti[0], spliti[1], options) + if err != nil { + return nil, err + } + mounts = append(mounts, mount) } return mounts, nil } @@ -692,7 +705,13 @@ func setupNamespaces(g *generate.Generator, namespaceOptions NamespaceOptions, i // Run runs the specified command in the container's root filesystem. func (b *Builder) Run(command []string, options RunOptions) error { var user specs.User - path, err := ioutil.TempDir(os.TempDir(), Package) + p, err := ioutil.TempDir(os.TempDir(), Package) + if err != nil { + return err + } + // On some hosts like AH, /tmp is a symlink and we need an + // absolute path. + path, err := filepath.EvalSymlinks(p) if err != nil { return err } @@ -976,6 +995,7 @@ func runUsingRuntime(options RunOptions, configureNetwork bool, configureNetwork // Figure out how we're doing stdio handling, and create pipes and sockets. var stdio sync.WaitGroup var consoleListener *net.UnixListener + var errorFds []int stdioPipe := make([][]int, 3) copyConsole := false copyStdio := false @@ -1006,6 +1026,7 @@ func runUsingRuntime(options RunOptions, configureNetwork bool, configureNetwork if stdioPipe, err = runMakeStdioPipe(int(uid), int(gid)); err != nil { return 1, err } + errorFds = []int{stdioPipe[unix.Stdout][0], stdioPipe[unix.Stderr][0]} // Set stdio to our pipes. getCreateStdio = func() (*os.File, *os.File, *os.File) { stdin := os.NewFile(uintptr(stdioPipe[unix.Stdin][0]), "/dev/stdin") @@ -1056,7 +1077,7 @@ func runUsingRuntime(options RunOptions, configureNetwork bool, configureNetwork // Actually create the container. err = create.Run() if err != nil { - return 1, errors.Wrapf(err, "error creating container for %v: %s", spec.Process.Args, runCollectOutput(stdioPipe[unix.Stdout][0], stdioPipe[unix.Stderr][0])) + return 1, errors.Wrapf(err, "error creating container for %v: %s", spec.Process.Args, runCollectOutput(errorFds...)) } defer func() { err2 := del.Run() |