Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
| ... | ... |
@@ -142,7 +142,6 @@ func makeMirrorRepoInfo(repoInfo *registry.RepositoryInfo, mirror string) *regis |
| 142 | 142 |
|
| 143 | 143 |
func configureV2Mirror(repoInfo *registry.RepositoryInfo, s *registry.Service) (*registry.Endpoint, *registry.RepositoryInfo, error) {
|
| 144 | 144 |
mirrors := repoInfo.Index.Mirrors |
| 145 |
- |
|
| 146 | 145 |
if len(mirrors) == 0 {
|
| 147 | 146 |
// no mirrors configured |
| 148 | 147 |
return nil, nil, nil |
| ... | ... |
@@ -151,13 +150,11 @@ func configureV2Mirror(repoInfo *registry.RepositoryInfo, s *registry.Service) ( |
| 151 | 151 |
v1MirrorCount := 0 |
| 152 | 152 |
var v2MirrorEndpoint *registry.Endpoint |
| 153 | 153 |
var v2MirrorRepoInfo *registry.RepositoryInfo |
| 154 |
- var lastErr error |
|
| 155 | 154 |
for _, mirror := range mirrors {
|
| 156 | 155 |
mirrorRepoInfo := makeMirrorRepoInfo(repoInfo, mirror) |
| 157 | 156 |
endpoint, err := registry.NewEndpoint(mirrorRepoInfo.Index, nil) |
| 158 | 157 |
if err != nil {
|
| 159 | 158 |
logrus.Errorf("Unable to create endpoint for %s: %s", mirror, err)
|
| 160 |
- lastErr = err |
|
| 161 | 159 |
continue |
| 162 | 160 |
} |
| 163 | 161 |
if endpoint.Version == 2 {
|
| ... | ... |
@@ -182,9 +179,11 @@ func configureV2Mirror(repoInfo *registry.RepositoryInfo, s *registry.Service) ( |
| 182 | 182 |
return v2MirrorEndpoint, v2MirrorRepoInfo, nil |
| 183 | 183 |
} |
| 184 | 184 |
if v2MirrorEndpoint != nil && v1MirrorCount > 0 {
|
| 185 |
- lastErr = fmt.Errorf("v1 and v2 mirrors configured")
|
|
| 185 |
+ return nil, nil, fmt.Errorf("v1 and v2 mirrors configured")
|
|
| 186 | 186 |
} |
| 187 |
- return nil, nil, lastErr |
|
| 187 |
+ // No endpoint could be established with the given mirror configurations |
|
| 188 |
+ // Fallback to pulling from the hub as per v1 behavior. |
|
| 189 |
+ return nil, nil, nil |
|
| 188 | 190 |
} |
| 189 | 191 |
|
| 190 | 192 |
func (s *TagStore) pullFromV2Mirror(mirrorEndpoint *registry.Endpoint, repoInfo *registry.RepositoryInfo, |