Fail Geo container sync when a legacy tags list fails

What does this MR do and why?

When the secondary's legacy tags/list read fails, Geo container sync reads it as no tags. Every tag then looks missing and is sent again.

The sync now reads the secondary's tag names with repository_tag_names, as it already does for the primary. That call raises on a non-2xx response and treats a 404 on the first page as an empty repository, so a failed list fails the sync and the existing retry applies. It also follows every page, where the old read took one page of up to 10,000 tags.

The metadata database path is not fixed. GitlabApiClient#tags returns {} on any non-2xx response, so a 404 for a repository not yet on the secondary looks the same as a 500, and telling them apart means changing the shared client.

flowchart TD
  L["Read tags on the<br/>secondary registry"] --> F{"List fails?"}
  F -- "no" --> D["Sync only the tags<br/>the secondary lacks"]
  F -- "yes, before" --> E["Read as no tags"] --> A["Every tag re-sent"]
  F -- "yes, this MR" --> R["Raise, sync fails<br/>and retries"]

Measured on a two-site Geo pair running 19.5.5-ee with a legacy registry, re-syncing a repository whose 5 tags are already on the secondary:

Fault Code Manifest PUT Sync
none before 0 succeeds
tags/list 500 on the secondary before 5 reports success
tags/list 500 on the secondary this MR 0 fails, retried
fault removed this MR 0 succeeds on retry, tags equal

References

Why no feature flag

The change only makes a silent failure use the existing retry. Of the new specs, only the secondary 500 case fails without it; the others guard existing behaviour.

Screenshots or screen recordings

No UI change.

How to set up and validate locally

On a Geo pair with a legacy registry:

  1. Push an image with several tags on the primary and let the secondary sync it.
  2. Make the secondary registry's tags/list answer 500.
  3. Run Geo::ContainerRepositorySync.new(container_repository).execute in a Rails console on the secondary.
  4. The sync fails and the registry log shows no manifest PUT.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

An AI coding assistant wrote this change. The assistant also checked each claim against the source at 3b376d58, ran the touched specs and RuboCop on the touched files on a test VM, and ran a ported copy of the change on a two-site Geo test pair.

Merge request reports

Loading
Loading