From 82cb0642586bba0d84c11805c22714539ff2f6f8 Mon Sep 17 00:00:00 2001 From: Andrei Neagu Date: Tue, 12 Apr 2022 11:53:59 +0200 Subject: [PATCH] refactor remote path searches --- src/docker_publisher_osparc_services/cli.py | 30 ++++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/docker_publisher_osparc_services/cli.py b/src/docker_publisher_osparc_services/cli.py index 8fb1cf8..2b77a7e 100644 --- a/src/docker_publisher_osparc_services/cli.py +++ b/src/docker_publisher_osparc_services/cli.py @@ -4,14 +4,23 @@ import click from . import __version__ -from .gitlab_ci_setup.commands import (COMMANDS_BUILD, COMMANDS_PUSH, - COMMANDS_TEST_BASE, assemble_env_vars, - validate_commands_list) +from .gitlab_ci_setup.commands import ( + COMMANDS_BUILD, + COMMANDS_PUSH, + COMMANDS_TEST_BASE, + assemble_env_vars, + validate_commands_list, +) from .gitlab_ci_setup.pipeline_config import PipelineConfig, PipelineGenerator from .http_interface import get_tags_for_repo from .models import ConfigModel -from .operations import (assemble_compose, clone_repo, did_ci_pass, - fetch_images_from_compose_spec, get_branch_hash) +from .operations import ( + assemble_compose, + clone_repo, + did_ci_pass, + fetch_images_from_compose_spec, + get_branch_hash, +) async def run_command(config: Path) -> None: @@ -42,19 +51,20 @@ async def run_command(config: Path) -> None: # check if image is present in repository for image in images: image_name, tag = image.split(":") - if image_name not in repo_model.registry.local_to_remote: + if image_name not in repo_model.registry.local_to_test: raise ValueError( ( f"Image={image_name} expected to be defined in " - f"local_to_remote={repo_model.registry.local_to_remote}" + f"local_to_test={repo_model.registry.local_to_test}" ) ) - remote_name = repo_model.registry.local_to_remote[image_name] + test_name = repo_model.registry.local_to_test[image_name] + release_name = repo_model.registry.test_to_release[test_name] tags = await get_tags_for_repo( - cfg.registries[repo_model.registry.target], remote_name + cfg.registries[repo_model.registry.target], release_name ) print( - f"Checking tag '{tag}' for '{image}' was pushed at '{remote_name}'. " + f"Checking tag '{tag}' for '{image}' was pushed at '{release_name}'. " f"List of remote tags {[t for t in tags]}" )