diff options
author | umohnani8 <umohnani@redhat.com> | 2018-08-23 14:44:38 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-23 19:11:09 +0000 |
commit | 16465007d0ea1226b63efccc98f1adc8dc279fd3 (patch) | |
tree | 3d902d4406008f9fa9cebc871ce256a95763b09d /vendor/github.com/projectatomic/buildah | |
parent | 4c00dc66dfacc214d6fff845b73a4fc4226b6747 (diff) | |
download | podman-16465007d0ea1226b63efccc98f1adc8dc279fd3.tar.gz podman-16465007d0ea1226b63efccc98f1adc8dc279fd3.tar.bz2 podman-16465007d0ea1226b63efccc98f1adc8dc279fd3.zip |
Vendor in latest projectatomic/buildah
Fixes to podman build for unknown image and ADD with url
when doing --layers.
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #1330
Approved by: mheon
Diffstat (limited to 'vendor/github.com/projectatomic/buildah')
5 files changed, 31 insertions, 16 deletions
diff --git a/vendor/github.com/projectatomic/buildah/README.md b/vendor/github.com/projectatomic/buildah/README.md index 5017672ba..8927488bc 100644 --- a/vendor/github.com/projectatomic/buildah/README.md +++ b/vendor/github.com/projectatomic/buildah/README.md @@ -1,6 +1,6 @@ ![buildah logo](https://cdn.rawgit.com/projectatomic/buildah/master/logos/buildah-logo_large.png) -# [Buildah](https://www.youtube.com/embed/YVk5NgSiUw8) - a tool that facilitates building OCI container images +# [Buildah](https://www.youtube.com/embed/YVk5NgSiUw8) - a tool that facilitates building [Open Container Initiative (OCI)](https://www.opencontainers.org/) container images [![Go Report Card](https://goreportcard.com/badge/github.com/projectatomic/buildah)](https://goreportcard.com/report/github.com/projectatomic/buildah) [![Travis](https://travis-ci.org/projectatomic/buildah.svg?branch=master)](https://travis-ci.org/projectatomic/buildah) diff --git a/vendor/github.com/projectatomic/buildah/imagebuildah/build.go b/vendor/github.com/projectatomic/buildah/imagebuildah/build.go index 547b6b249..52bbe9d8c 100644 --- a/vendor/github.com/projectatomic/buildah/imagebuildah/build.go +++ b/vendor/github.com/projectatomic/buildah/imagebuildah/build.go @@ -725,7 +725,10 @@ func (b *Executor) resolveNameToImageRef() (types.ImageReference, error) { if b.output != "" { imageRef, err = alltransports.ParseImageName(b.output) if err != nil { - candidates := util.ResolveName(b.output, "", b.systemContext, b.store) + candidates, err := util.ResolveName(b.output, "", b.systemContext, b.store) + if err != nil { + return nil, errors.Wrapf(err, "error parsing target image name %q: %v", b.output) + } if len(candidates) == 0 { return nil, errors.Errorf("error parsing target image name %q", b.output) } @@ -962,6 +965,7 @@ func (b *Executor) getFilesToCopy(node *parser.Node) ([]string, error) { } if strings.HasPrefix(currNode.Value, "http://") || strings.HasPrefix(currNode.Value, "https://") { src = append(src, currNode.Value) + currNode = currNode.Next continue } matches, err := filepath.Glob(filepath.Join(b.contextDir, currNode.Value)) @@ -1143,7 +1147,7 @@ func (b *Executor) Build(ctx context.Context, stages imagebuilder.Stages) error for _, stage := range stages { stageExecutor = b.withName(stage.Name, stage.Position) if err := stageExecutor.Prepare(ctx, stage.Builder, stage.Node, ""); err != nil { - lastErr = err + return err } // Always remove the intermediate/build containers, even if the build was unsuccessful. // If building with layers, remove all intermediate/build containers if b.forceRmIntermediateCtrs diff --git a/vendor/github.com/projectatomic/buildah/new.go b/vendor/github.com/projectatomic/buildah/new.go index 1895bae48..773e65427 100644 --- a/vendor/github.com/projectatomic/buildah/new.go +++ b/vendor/github.com/projectatomic/buildah/new.go @@ -140,7 +140,11 @@ func newContainerIDMappingOptions(idmapOptions *IDMappingOptions) storage.IDMapp func resolveImage(ctx context.Context, systemContext *types.SystemContext, store storage.Store, options BuilderOptions) (types.ImageReference, *storage.Image, error) { var ref types.ImageReference var img *storage.Image - for _, image := range util.ResolveName(options.FromImage, options.Registry, systemContext, store) { + images, err := util.ResolveName(options.FromImage, options.Registry, systemContext, store) + if err != nil { + return nil, nil, errors.Wrapf(err, "error parsing reference to image %q", options.FromImage) + } + for _, image := range images { var err error if len(image) >= minimumTruncatedIDLength { if img, err = store.Image(image); err == nil && img != nil && strings.HasPrefix(img.ID, image) { diff --git a/vendor/github.com/projectatomic/buildah/util/util.go b/vendor/github.com/projectatomic/buildah/util/util.go index 1e7361462..93323232d 100644 --- a/vendor/github.com/projectatomic/buildah/util/util.go +++ b/vendor/github.com/projectatomic/buildah/util/util.go @@ -63,17 +63,17 @@ var ( // ResolveName checks if name is a valid image name, and if that name doesn't // include a domain portion, returns a list of the names which it might // correspond to in the set of configured registries. -func ResolveName(name string, firstRegistry string, sc *types.SystemContext, store storage.Store) []string { +func ResolveName(name string, firstRegistry string, sc *types.SystemContext, store storage.Store) ([]string, error) { if name == "" { - return nil + return nil, nil } // Maybe it's a truncated image ID. Don't prepend a registry name, then. if len(name) >= minimumTruncatedIDLength { if img, err := store.Image(name); err == nil && img != nil && strings.HasPrefix(img.ID, name) { // It's a truncated version of the ID of an image that's present in local storage; - // we need to expand the ID. - return []string{img.ID} + // we need only expand the ID. + return []string{img.ID}, nil } } @@ -81,18 +81,18 @@ func ResolveName(name string, firstRegistry string, sc *types.SystemContext, sto split := strings.SplitN(name, ":", 2) if len(split) == 2 { if _, ok := Transports[split[0]]; ok { - return []string{split[1]} + return []string{split[1]}, nil } } // If the image name already included a domain component, we're done. named, err := reference.ParseNormalizedNamed(name) if err != nil { - return []string{name} + return nil, errors.Wrapf(err, "error parsing image name %q", name) } if named.String() == name { // Parsing produced the same result, so there was a domain name in there to begin with. - return []string{name} + return []string{name}, nil } if reference.Domain(named) != "" && RegistryDefaultPathPrefix[reference.Domain(named)] != "" { // If this domain can cause us to insert something in the middle, check if that happened. @@ -109,7 +109,7 @@ func ResolveName(name string, firstRegistry string, sc *types.SystemContext, sto defaultPrefix := RegistryDefaultPathPrefix[reference.Domain(named)] + "/" if strings.HasPrefix(repoPath, defaultPrefix) && path.Join(domain, repoPath[len(defaultPrefix):])+tag+digest == name { // Yup, parsing just inserted a bit in the middle, so there was a domain name there to begin with. - return []string{name} + return []string{name}, nil } } @@ -145,7 +145,7 @@ func ResolveName(name string, firstRegistry string, sc *types.SystemContext, sto candidate := path.Join(registry, middle, name) candidates = append(candidates, candidate) } - return candidates + return candidates, nil } // ExpandNames takes unqualified names, parses them as image names, and returns @@ -156,7 +156,10 @@ func ExpandNames(names []string, firstRegistry string, systemContext *types.Syst expanded := make([]string, 0, len(names)) for _, n := range names { var name reference.Named - nameList := ResolveName(n, firstRegistry, systemContext, store) + nameList, err := ResolveName(n, firstRegistry, systemContext, store) + if err != nil { + return nil, errors.Wrapf(err, "error parsing name %q", n) + } if len(nameList) == 0 { named, err := reference.ParseNormalizedNamed(n) if err != nil { @@ -189,7 +192,11 @@ func FindImage(store storage.Store, firstRegistry string, systemContext *types.S var ref types.ImageReference var img *storage.Image var err error - for _, name := range ResolveName(image, firstRegistry, systemContext, store) { + names, err := ResolveName(image, firstRegistry, systemContext, store) + if err != nil { + return nil, nil, errors.Wrapf(err, "error parsing name %q", image) + } + for _, name := range names { ref, err = is.Transport.ParseStoreReference(store, name) if err != nil { logrus.Debugf("error parsing reference to image %q: %v", name, err) diff --git a/vendor/github.com/projectatomic/buildah/vendor.conf b/vendor/github.com/projectatomic/buildah/vendor.conf index cf9f1664e..ec1d5ec9c 100644 --- a/vendor/github.com/projectatomic/buildah/vendor.conf +++ b/vendor/github.com/projectatomic/buildah/vendor.conf @@ -46,7 +46,7 @@ github.com/containers/libpod d20f3a51463ce75d139dd830e19a173906b0b0cb github.com/sirupsen/logrus master github.com/syndtr/gocapability master github.com/tchap/go-patricia master -github.com/urfave/cli fix-short-opts-parsing https://github.com/vrothberg/cli +github.com/urfave/cli 934abfb2f102315b5794e15ebc7949e4ca253920 github.com/vbatts/tar-split v0.10.2 github.com/xeipuuv/gojsonpointer master github.com/xeipuuv/gojsonreference master |