From 83aaa3428f8872e09ecff5151bfdaf5b503ba765 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 27 Mar 2025 16:40:49 +0100 Subject: [PATCH] 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]: https://github.com/moby/moby/blob/cea56c1d9c2fae5831f38ae88fba593206985b2b/registry/service.go#L134-L139 [Service.lookupV2Endpoints]: https://github.com/moby/moby/blob/cea56c1d9c2fae5831f38ae88fba593206985b2b/registry/service_v2.go#L10-L40 Signed-off-by: Sebastiaan van Stijn --- distribution/push_v2.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/distribution/push_v2.go b/distribution/push_v2.go index 3a4ca4b989..ea3fc804f2 100644 --- a/distribution/push_v2.go +++ b/distribution/push_v2.go @@ -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,