provide a tag when pulling images so we only pull a single image
@@ -17,15 +17,17 @@ import (
docker "github.com/fsouza/go-dockerclient"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
- "github.com/openshift/source-to-image/pkg/tar"
- s2iutil "github.com/openshift/source-to-image/pkg/util"
-
"k8s.io/kubernetes/pkg/credentialprovider"
"k8s.io/kubernetes/pkg/util/interrupt"
"github.com/openshift/imagebuilder"
"github.com/openshift/imagebuilder/dockerclient"
"github.com/openshift/imagebuilder/imageprogress"
+
+ "github.com/openshift/source-to-image/pkg/tar"
+ s2iutil "github.com/openshift/source-to-image/pkg/util"
+
+ imageapi "github.com/openshift/origin/pkg/image/apis/image"
)
var (
@@ -110,8 +112,27 @@ func pullImage(client DockerClient, name string, authConfig docker.AuthConfigura
logProgress := func(s string) {
glog.V(0).Infof("%s", s)
}
+
+ ref, err := imageapi.ParseDockerImageReference(name)
+ if err != nil {
+ return err
+ }
+ tag := ref.ID
+ if len(ref.ID) == 0 {
+ tag = imageapi.DefaultImageTag
+ if len(ref.Tag) != 0 {
+ tag = ref.Tag
+ }
+ }
+ // clear the ref.Tag and ref.ID so they do not appear in the Repository field we produce
+ // from ref.Exact(), we pass the Tag or ID (if any) explicitly in the Tag field.
+ ref.Tag = ""
+ ref.ID = ""
+
+ glog.V(4).Infof("pulling image %q with ref %#v as repository: %s and tag: %s", name, ref, ref.Exact(), tag)
opts := docker.PullImageOptions{
- Repository: name,
+ Repository: ref.Exact(),
+ Tag: tag,
OutputStream: imageprogress.NewPullWriter(logProgress),
RawJSONStream: true,
}
