@@ -65,18 +65,18 @@ func (p *v1Puller) Pull(ctx context.Context, ref reference.Named) (fallback bool
6565 // TODO(dmcgowan): Check if should fallback
6666 return false , err
6767 }
68- progress .Message (p .config .ProgressOutput , "" , p .repoInfo .CanonicalName . Name ()+ ": this image was pulled from a legacy registry. Important: This registry version will not be supported in future versions of docker." )
68+ progress .Message (p .config .ProgressOutput , "" , p .repoInfo .FullName ()+ ": this image was pulled from a legacy registry. Important: This registry version will not be supported in future versions of docker." )
6969
7070 return false , nil
7171}
7272
7373func (p * v1Puller ) pullRepository (ctx context.Context , ref reference.Named ) error {
74- progress .Message (p .config .ProgressOutput , "" , "Pulling repository " + p .repoInfo .CanonicalName . Name ())
74+ progress .Message (p .config .ProgressOutput , "" , "Pulling repository " + p .repoInfo .FullName ())
7575
76- repoData , err := p .session .GetRepositoryData (p .repoInfo . RemoteName )
76+ repoData , err := p .session .GetRepositoryData (p .repoInfo )
7777 if err != nil {
7878 if strings .Contains (err .Error (), "HTTP code: 404" ) {
79- return fmt .Errorf ("Error: image %s not found" , p .repoInfo .RemoteName . Name ())
79+ return fmt .Errorf ("Error: image %s not found" , p .repoInfo .RemoteName ())
8080 }
8181 // Unexpected HTTP error
8282 return err
@@ -86,13 +86,13 @@ func (p *v1Puller) pullRepository(ctx context.Context, ref reference.Named) erro
8686 var tagsList map [string ]string
8787 tagged , isTagged := ref .(reference.NamedTagged )
8888 if ! isTagged {
89- tagsList , err = p .session .GetRemoteTags (repoData .Endpoints , p .repoInfo . RemoteName )
89+ tagsList , err = p .session .GetRemoteTags (repoData .Endpoints , p .repoInfo )
9090 } else {
9191 var tagID string
9292 tagsList = make (map [string ]string )
93- tagID , err = p .session .GetRemoteTag (repoData .Endpoints , p .repoInfo . RemoteName , tagged .Tag ())
93+ tagID , err = p .session .GetRemoteTag (repoData .Endpoints , p .repoInfo , tagged .Tag ())
9494 if err == registry .ErrRepoNotFound {
95- return fmt .Errorf ("Tag %s not found in repository %s" , tagged .Tag (), p .repoInfo .CanonicalName . Name ())
95+ return fmt .Errorf ("Tag %s not found in repository %s" , tagged .Tag (), p .repoInfo .FullName ())
9696 }
9797 tagsList [tagged .Tag ()] = tagID
9898 }
@@ -121,14 +121,7 @@ func (p *v1Puller) pullRepository(ctx context.Context, ref reference.Named) erro
121121 }
122122 }
123123
124- localNameRef := p .repoInfo .LocalName
125- if isTagged {
126- localNameRef , err = reference .WithTag (localNameRef , tagged .Tag ())
127- if err != nil {
128- localNameRef = p .repoInfo .LocalName
129- }
130- }
131- writeStatus (localNameRef .String (), p .config .ProgressOutput , layersDownloaded )
124+ writeStatus (ref .String (), p .config .ProgressOutput , layersDownloaded )
132125 return nil
133126}
134127
@@ -138,7 +131,7 @@ func (p *v1Puller) downloadImage(ctx context.Context, repoData *registry.Reposit
138131 return nil
139132 }
140133
141- localNameRef , err := reference .WithTag (p .repoInfo . LocalName , img .Tag )
134+ localNameRef , err := reference .WithTag (p .repoInfo , img .Tag )
142135 if err != nil {
143136 retErr := fmt .Errorf ("Image (id: %s) has invalid tag: %s" , img .ID , img .Tag )
144137 logrus .Debug (retErr .Error ())
@@ -149,36 +142,36 @@ func (p *v1Puller) downloadImage(ctx context.Context, repoData *registry.Reposit
149142 return err
150143 }
151144
152- progress .Updatef (p .config .ProgressOutput , stringid .TruncateID (img .ID ), "Pulling image (%s) from %s" , img .Tag , p .repoInfo .CanonicalName . Name ())
145+ progress .Updatef (p .config .ProgressOutput , stringid .TruncateID (img .ID ), "Pulling image (%s) from %s" , img .Tag , p .repoInfo .FullName ())
153146 success := false
154147 var lastErr error
155148 for _ , ep := range p .repoInfo .Index .Mirrors {
156149 ep += "v1/"
157- progress .Updatef (p .config .ProgressOutput , stringid .TruncateID (img .ID ), fmt .Sprintf ("Pulling image (%s) from %s, mirror: %s" , img .Tag , p .repoInfo .CanonicalName . Name (), ep ))
150+ progress .Updatef (p .config .ProgressOutput , stringid .TruncateID (img .ID ), fmt .Sprintf ("Pulling image (%s) from %s, mirror: %s" , img .Tag , p .repoInfo .FullName (), ep ))
158151 if err = p .pullImage (ctx , img .ID , ep , localNameRef , layersDownloaded ); err != nil {
159152 // Don't report errors when pulling from mirrors.
160- logrus .Debugf ("Error pulling image (%s) from %s, mirror: %s, %s" , img .Tag , p .repoInfo .CanonicalName . Name (), ep , err )
153+ logrus .Debugf ("Error pulling image (%s) from %s, mirror: %s, %s" , img .Tag , p .repoInfo .FullName (), ep , err )
161154 continue
162155 }
163156 success = true
164157 break
165158 }
166159 if ! success {
167160 for _ , ep := range repoData .Endpoints {
168- progress .Updatef (p .config .ProgressOutput , stringid .TruncateID (img .ID ), "Pulling image (%s) from %s, endpoint: %s" , img .Tag , p .repoInfo .CanonicalName . Name (), ep )
161+ progress .Updatef (p .config .ProgressOutput , stringid .TruncateID (img .ID ), "Pulling image (%s) from %s, endpoint: %s" , img .Tag , p .repoInfo .FullName (), ep )
169162 if err = p .pullImage (ctx , img .ID , ep , localNameRef , layersDownloaded ); err != nil {
170163 // It's not ideal that only the last error is returned, it would be better to concatenate the errors.
171164 // As the error is also given to the output stream the user will see the error.
172165 lastErr = err
173- progress .Updatef (p .config .ProgressOutput , stringid .TruncateID (img .ID ), "Error pulling image (%s) from %s, endpoint: %s, %s" , img .Tag , p .repoInfo .CanonicalName . Name (), ep , err )
166+ progress .Updatef (p .config .ProgressOutput , stringid .TruncateID (img .ID ), "Error pulling image (%s) from %s, endpoint: %s, %s" , img .Tag , p .repoInfo .FullName (), ep , err )
174167 continue
175168 }
176169 success = true
177170 break
178171 }
179172 }
180173 if ! success {
181- err := fmt .Errorf ("Error pulling image (%s) from %s, %v" , img .Tag , p .repoInfo .CanonicalName . Name (), lastErr )
174+ err := fmt .Errorf ("Error pulling image (%s) from %s, %v" , img .Tag , p .repoInfo .FullName (), lastErr )
182175 progress .Update (p .config .ProgressOutput , stringid .TruncateID (img .ID ), err .Error ())
183176 return err
184177 }
0 commit comments