summaryrefslogtreecommitdiff
path: root/vendor/github.com/projectatomic/buildah/imagebuildah/build.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-05-03 08:59:19 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-03 13:12:46 +0000
commitfae5033a01b78d3e8f23c1c9438bc5534dfe0fa3 (patch)
treee2a140a0493f23a8e3a1a6cfff04a826ef9fe12e /vendor/github.com/projectatomic/buildah/imagebuildah/build.go
parente6ec1aaffe791a265ca7716813de47dacc4b70e8 (diff)
downloadpodman-fae5033a01b78d3e8f23c1c9438bc5534dfe0fa3.tar.gz
podman-fae5033a01b78d3e8f23c1c9438bc5534dfe0fa3.tar.bz2
podman-fae5033a01b78d3e8f23c1c9438bc5534dfe0fa3.zip
Make podman commit to localhost rather then docker.io
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #715 Approved by: mheon
Diffstat (limited to 'vendor/github.com/projectatomic/buildah/imagebuildah/build.go')
-rw-r--r--vendor/github.com/projectatomic/buildah/imagebuildah/build.go31
1 files changed, 21 insertions, 10 deletions
diff --git a/vendor/github.com/projectatomic/buildah/imagebuildah/build.go b/vendor/github.com/projectatomic/buildah/imagebuildah/build.go
index 81e8108a0..dd8421807 100644
--- a/vendor/github.com/projectatomic/buildah/imagebuildah/build.go
+++ b/vendor/github.com/projectatomic/buildah/imagebuildah/build.go
@@ -23,6 +23,7 @@ import (
"github.com/openshift/imagebuilder"
"github.com/pkg/errors"
"github.com/projectatomic/buildah"
+ "github.com/projectatomic/buildah/util"
"github.com/sirupsen/logrus"
)
@@ -623,22 +624,25 @@ func (b *Executor) Execute(ib *imagebuilder.Builder, node *parser.Node) error {
// the name if there is one, generating a unique ID-based one otherwise.
func (b *Executor) Commit(ctx context.Context, ib *imagebuilder.Builder) (err error) {
var imageRef types.ImageReference
+
if b.output != "" {
imageRef, err = alltransports.ParseImageName(b.output)
if err != nil {
- imageRef2, err2 := is.Transport.ParseStoreReference(b.store, b.output)
- if err2 == nil {
- imageRef = imageRef2
- err = nil
- } else {
- err = err2
+ candidates := util.ResolveName(b.output, "", b.systemContext, b.store)
+ if len(candidates) == 0 {
+ return errors.Errorf("error parsing target image name %q", b.output)
+ }
+ imageRef2, err2 := is.Transport.ParseStoreReference(b.store, candidates[0])
+ if err2 != nil {
+ return errors.Wrapf(err, "error parsing target image name %q", b.output)
}
+ imageRef = imageRef2
}
} else {
imageRef, err = is.Transport.ParseStoreReference(b.store, "@"+stringid.GenerateRandomID())
- }
- if err != nil {
- return errors.Wrapf(err, "error parsing reference for image to be written")
+ if err != nil {
+ return errors.Wrapf(err, "error parsing reference for image to be written")
+ }
}
if ib.Author != "" {
b.builder.SetMaintainer(ib.Author)
@@ -689,7 +693,14 @@ func (b *Executor) Commit(ctx context.Context, ib *imagebuilder.Builder) (err er
PreferredManifestType: b.outputFormat,
IIDFile: b.iidfile,
}
- return b.builder.Commit(ctx, imageRef, options)
+ imgID, err := b.builder.Commit(ctx, imageRef, options)
+ if err != nil {
+ return err
+ }
+ if options.IIDFile == "" && imgID != "" {
+ fmt.Printf("%s\n", imgID)
+ }
+ return nil
}
// Build takes care of the details of running Prepare/Execute/Commit/Delete