Update vendor of Buildah and imagebuilder

Fixes the testing issues we are hitting.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2019-03-13 08:01:28 -04:00
parent 8b637bd78c
commit adad93342c
16 changed files with 118 additions and 59 deletions

View File

@ -9,6 +9,7 @@ import (
"github.com/spf13/cobra"
"net"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
@ -319,7 +320,7 @@ func getDockerAuth(creds string) (*types.DockerAuthConfig, error) {
}
// IDMappingOptions parses the build options related to user namespaces and ID mapping.
func IDMappingOptions(c *cobra.Command) (usernsOptions buildah.NamespaceOptions, idmapOptions *buildah.IDMappingOptions, err error) {
func IDMappingOptions(c *cobra.Command, isolation buildah.Isolation) (usernsOptions buildah.NamespaceOptions, idmapOptions *buildah.IDMappingOptions, err error) {
user := c.Flag("userns-uid-map-user").Value.String()
group := c.Flag("userns-gid-map-group").Value.String()
// If only the user or group was specified, use the same value for the
@ -391,11 +392,26 @@ func IDMappingOptions(c *cobra.Command) (usernsOptions buildah.NamespaceOptions,
if len(gidmap) == 0 && len(uidmap) != 0 {
gidmap = uidmap
}
useSlirp4netns := false
if isolation == buildah.IsolationOCIRootless {
_, err := exec.LookPath("slirp4netns")
if execerr, ok := err.(*exec.Error); ok && !strings.Contains(execerr.Error(), "not found") {
return nil, nil, errors.Wrapf(err, "cannot lookup slirp4netns %v", execerr)
}
if err == nil {
useSlirp4netns = true
} else {
logrus.Warningf("could not find slirp4netns. Using host network namespace")
}
}
// By default, having mappings configured means we use a user
// namespace. Otherwise, we don't.
usernsOption := buildah.NamespaceOption{
Name: string(specs.UserNamespace),
Host: len(uidmap) == 0 && len(gidmap) == 0,
Host: len(uidmap) == 0 && len(gidmap) == 0 && !useSlirp4netns,
}
// If the user specifically requested that we either use or don't use
// user namespaces, override that default.