summaryrefslogtreecommitdiff
path: root/vendor/github.com/projectatomic/buildah/new.go
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2018-05-25 11:30:57 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-25 17:03:09 +0000
commit1930f5d7093e84cdcc9e327e296f4733f32b20c8 (patch)
tree4c41a5e955b12881dc7a88dae573a36dea9982ba /vendor/github.com/projectatomic/buildah/new.go
parent8fcf1aaa29e61b9305096f61a8ba26bc81462b05 (diff)
downloadpodman-1930f5d7093e84cdcc9e327e296f4733f32b20c8.tar.gz
podman-1930f5d7093e84cdcc9e327e296f4733f32b20c8.tar.bz2
podman-1930f5d7093e84cdcc9e327e296f4733f32b20c8.zip
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 <umohnani@redhat.com> Closes: #832 Approved by: mheon
Diffstat (limited to 'vendor/github.com/projectatomic/buildah/new.go')
-rw-r--r--vendor/github.com/projectatomic/buildah/new.go35
1 files changed, 33 insertions, 2 deletions
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 {