Skip to content

ci(sync-mirror): detect mirrored tags from the remote, not local clone - #41

Merged
Bjordis Collaku (bjordiscollaku) merged 1 commit into
mainfrom
ci/fix-sync-mirror-tag-detection
Jul 15, 2026
Merged

Bjordis Collaku (bjordiscollaku) merged 1 commit into
mainfrom
ci/fix-sync-mirror-tag-detection

Conversation

@bjordiscollaku

Copy link
Copy Markdown
Contributor

Problem

The manual sync (fetch-source-pkg.yml → sync-mirror.sh) failed at the atomic
push with ! [rejected] Ubuntu-qcom-7.0.0-1004.5 (already exists), halting the run.

sync-mirror.sh decided which uploads were un-mirrored by checking the local
clone's tags. That clone is --single-branch, so it only holds tags reachable from
the branch tip; a rebased or divergent upload that was already mirrored is invisible
locally. The script re-listed such uploads, and the atomic push was rejected because
the tag already exists on the remote. The halt also left the mirror branch moved
backward onto an older upload.

Fix

  • Judge "already mirrored" against the mirror's actual tags via
    git ls-remote --tags origin, matching the check-version gate in
    fetch-source-pkg.yml. Only genuinely un-mirrored uploads are attempted.
  • After the loop, guarantee the branch ends at the newest upload, so a
    backfilled older upload or a prior partial run cannot leave the mirror HEAD behind
    the latest tag.

Validation

Dispatched from this branch against the real mirror
(run 29296302725):

  • Uploads to mirror (ascending): 7.0.0-1008.11 — only the genuinely-missing upload
    (previously it wrongly re-listed 1003.3 / 1004.5 / 1005.7).
  • Sync complete: 1 upload(s) mirrored; branch now at 7.0.0-1008.11 — the branch
    advanced 1003.3 → 1008.11, healing the backward slip.
  • trigger-build dispatched a build of 1008.11.

bash -n and shellcheck clean. Scripts only; no workflow changes.

The --single-branch mirror clone only holds tags reachable from the branch tip,
so a rebased or divergent upload that was already mirrored is invisible locally.
The missing-upload check used that local view, re-listed such uploads, and the
atomic push then failed with "tag already exists", halting the sync. Judge
"already mirrored" against the mirror's actual tags via git ls-remote --tags
origin, matching the check-version gate in fetch-source-pkg.yml.

Also guarantee the branch ends at the newest upload after the loop: a backfilled
older upload or a prior partial run could otherwise leave the mirror HEAD behind
the latest tag.

Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
@bjordiscollaku
Bjordis Collaku (bjordiscollaku) merged commit d949d2d into main Jul 15, 2026
12 checks passed
@bjordiscollaku
Bjordis Collaku (bjordiscollaku) deleted the ci/fix-sync-mirror-tag-detection branch July 17, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants