fetch-images command #768

Merged
dboreham merged 6 commits from dboreham/fetch-images-command into main 2024-02-27 15:15:10 +00:00
Showing only changes of commit 8fa6dd3020 - Show all commits

View File

@ -73,7 +73,9 @@ def _get_tags_for_container(container: str, registry_info: RegistryInfo) -> List
def _find_latest(candidate_tags: List[str]):
# Lex sort should give us the latest first
sorted_candidates = candidate_tags.sort()
sorted_candidates = sorted(candidate_tags)
if opts.o.debug:
print(f"sorted candidates: {sorted_candidates}")
return sorted_candidates[0]
@ -126,11 +128,6 @@ def _exists_locally(container: str):
return docker.image.exists(_local_tag_for(container))
def _remove_local_tag(container: str):
# TODO Do we need this?
pass
def _add_local_tag(remote_tag: str, registry: str, local_tag: str):
docker = DockerClient()
docker.image.tag(f"{registry}/{remote_tag}", local_tag)
@ -170,9 +167,8 @@ def command(ctx, include, exclude, force_local_overwrite, image_registry, regist
if (force_local_overwrite):
# In that case remove the existing :local tag
if not opts.o.quiet:
print(f"Warning: removing local tag from this image: {container} because "
print(f"Warning: overwriting local tag from this image: {container} because "
"--force-local-overwrite was specified")
_remove_local_tag(local_tag)
else:
if not opts.o.quiet:
print(f"Skipping local tagging for this image: {container} because that would "