summaryrefslogtreecommitdiff
path: root/vendor/github.com/projectatomic/buildah/util.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-06-07 01:00:07 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-07 17:14:02 +0000
commitcf7c8295b8875ddd4fe87a4207aa302efbd90b18 (patch)
treef9358349d4574e469b72db2208a57c0f5160da91 /vendor/github.com/projectatomic/buildah/util.go
parent7d6e717dd9f8fe367b64839089db859ca6bd8a83 (diff)
downloadpodman-cf7c8295b8875ddd4fe87a4207aa302efbd90b18.tar.gz
podman-cf7c8295b8875ddd4fe87a4207aa302efbd90b18.tar.bz2
podman-cf7c8295b8875ddd4fe87a4207aa302efbd90b18.zip
Vendor in latest buildah code
Use the parsing code to properly setup podman build namespaces Fixes support for network namespace and user namespace Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #917 Approved by: rhatdan
Diffstat (limited to 'vendor/github.com/projectatomic/buildah/util.go')
-rw-r--r--vendor/github.com/projectatomic/buildah/util.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/github.com/projectatomic/buildah/util.go b/vendor/github.com/projectatomic/buildah/util.go
index 0d05aa8a2..1b8667b79 100644
--- a/vendor/github.com/projectatomic/buildah/util.go
+++ b/vendor/github.com/projectatomic/buildah/util.go
@@ -7,6 +7,9 @@ import (
"strconv"
"strings"
+ "github.com/containers/image/docker/reference"
+ "github.com/containers/image/pkg/sysregistries"
+ "github.com/containers/image/types"
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/chrootarchive"
"github.com/containers/storage/pkg/idtools"
@@ -200,3 +203,31 @@ func getHostRootIDs(spec *rspec.Spec) (uint32, uint32, error) {
}
return getHostIDs(spec.Linux.UIDMappings, spec.Linux.GIDMappings, 0, 0)
}
+
+// getRegistries obtains the list of registries defined in the global registries file.
+func getRegistries() ([]string, error) {
+ registryConfigPath := ""
+ envOverride := os.Getenv("REGISTRIES_CONFIG_PATH")
+ if len(envOverride) > 0 {
+ registryConfigPath = envOverride
+ }
+ searchRegistries, err := sysregistries.GetRegistries(&types.SystemContext{SystemRegistriesConfPath: registryConfigPath})
+ if err != nil {
+ return nil, errors.Wrapf(err, "unable to parse the registries.conf file")
+ }
+ return searchRegistries, nil
+}
+
+// hasRegistry returns a bool/err response if the image has a registry in its
+// name
+func hasRegistry(imageName string) (bool, error) {
+ imgRef, err := reference.Parse(imageName)
+ if err != nil {
+ return false, err
+ }
+ registry := reference.Domain(imgRef.(reference.Named))
+ if registry != "" {
+ return true, nil
+ }
+ return false, nil
+}