distribution: pusher.push(): don't use APIEndpoint.Mirror field

Unlike the equivalent for pulling images, [Service.LookupPushEndpoints]
never returns mirror endpoints, as it calls [Service.lookupV2Endpoints]
with "includeMirrors=false", so we should not use this field, and
unconditionally handle errors without the additional fallbacks that
we consider for pulling images from a mirror.

[Service.LookupPushEndpoints]: cea56c1d9c/registry/service.go (L134-L139)
[Service.lookupV2Endpoints]: cea56c1d9c/registry/service_v2.go (L10-L40)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-03-27 16:40:49 +01:00
parent 6439824449
commit 83aaa3428f

View File

@@ -82,7 +82,8 @@ func (p *pusher) push(ctx context.Context) (err error) {
}
if err = p.pushRepository(ctx); err != nil {
if continueOnError(err, p.endpoint.Mirror) {
// [Service.LookupPushEndpoints] never returns mirror endpoint.
if continueOnError(err, false) {
return fallbackError{
err: err,
transportOK: true,