From 1930f5d7093e84cdcc9e327e296f4733f32b20c8 Mon Sep 17 00:00:00 2001 From: umohnani8 Date: Fri, 25 May 2018 11:30:57 -0400 Subject: Vendor in latest projectatomic/buildah buildah fixed its probelm where it was not pulling in the ENV of the base image. This pulls that change into libpod as well. Signed-off-by: umohnani8 Closes: #832 Approved by: mheon --- vendor/github.com/projectatomic/buildah/new.go | 35 ++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'vendor/github.com/projectatomic/buildah/new.go') diff --git a/vendor/github.com/projectatomic/buildah/new.go b/vendor/github.com/projectatomic/buildah/new.go index 82de524c0..edc1b898e 100644 --- a/vendor/github.com/projectatomic/buildah/new.go +++ b/vendor/github.com/projectatomic/buildah/new.go @@ -54,7 +54,7 @@ func reserveSELinuxLabels(store storage.Store, id string) error { } return err } - // Prevent containers from using same MCS Label + // Prevent different containers from using same MCS label if err := label.ReserveLabel(b.ProcessLabel); err != nil { return err } @@ -133,6 +133,22 @@ func imageManifestAndConfig(ctx context.Context, ref types.ImageReference, syste return nil, nil, nil } +func newContainerIDMappingOptions(idmapOptions *IDMappingOptions) storage.IDMappingOptions { + var options storage.IDMappingOptions + if idmapOptions != nil { + options.HostUIDMapping = idmapOptions.HostUIDMapping + options.HostGIDMapping = idmapOptions.HostGIDMapping + uidmap, gidmap := convertRuntimeIDMaps(idmapOptions.UIDMap, idmapOptions.GIDMap) + if len(uidmap) > 0 && len(gidmap) > 0 { + options.UIDMap = uidmap + options.GIDMap = gidmap + } else { + options.HostUIDMapping = true + options.HostGIDMapping = true + } + } + return options +} func newBuilder(ctx context.Context, store storage.Store, options BuilderOptions) (*Builder, error) { var ref types.ImageReference var img *storage.Image @@ -258,6 +274,8 @@ func newBuilder(ctx context.Context, store storage.Store, options BuilderOptions } coptions := storage.ContainerOptions{} + coptions.IDMappingOptions = newContainerIDMappingOptions(options.IDMappingOptions) + container, err := store.CreateContainer("", []string{name}, imageID, "", "", &coptions) if err != nil { return nil, errors.Wrapf(err, "error creating container") @@ -278,6 +296,9 @@ func newBuilder(ctx context.Context, store storage.Store, options BuilderOptions if err != nil { return nil, err } + uidmap, gidmap := convertStorageIDMaps(container.UIDMap, container.GIDMap) + namespaceOptions := DefaultNamespaceOptions() + namespaceOptions.AddOrReplace(options.NamespaceOptions...) builder := &Builder{ store: store, @@ -293,7 +314,17 @@ func newBuilder(ctx context.Context, store storage.Store, options BuilderOptions ProcessLabel: processLabel, MountLabel: mountLabel, DefaultMountsFilePath: options.DefaultMountsFilePath, - CommonBuildOpts: options.CommonBuildOpts, + NamespaceOptions: namespaceOptions, + ConfigureNetwork: options.ConfigureNetwork, + CNIPluginPath: options.CNIPluginPath, + CNIConfigDir: options.CNIConfigDir, + IDMappingOptions: IDMappingOptions{ + HostUIDMapping: len(uidmap) == 0, + HostGIDMapping: len(uidmap) == 0, + UIDMap: uidmap, + GIDMap: gidmap, + }, + CommonBuildOpts: options.CommonBuildOpts, } if options.Mount { -- cgit v1.2.3-54-g00ecf