This commit enables better error detection when checking whether an
image/tag exists in a remote registry. Current implementation sometimes
falsely believes a remote tag is missing and attempts to (re-)push the
images, potentially overwriting them.
Examples:
- Registry is not reachable due to a temporary network outage
- With docker.io: we exceed the request rate limit. Original script
looked for remote tags by enumerating all tags. This resulted in
dozens of REST calls per image, occasionally exceeding Dockerhub's
request limit.
Solution: add new script that exits on connectivity errors, rather than
returning false. Script requires an external tool, regctl:
https://github.com/regclient/regclient
TESTS
====================================
- Test with missing/existing images in Harbor, DockerHub and
AWS ECR registries, as well as various connectivity errors.
- Run retag-images.sh and make sure it still works
Closes-Bug: 2003898
Change-Id: Id9dd0c30580748c0c4c4bfbbd520d4d38bdd2ec6
Signed-off-by: Davlet Panech <davlet.panech@windriver.com>