diff --git a/qa/qa/service/docker_run/container_registry_utils.rb b/qa/qa/service/docker_run/container_registry_utils.rb index ec466309cb25f4ebbc166dadfca931f8026ebe1e..2dd1c5a96314d2b1f1c6aa7ad419e11131950597 100644 --- a/qa/qa/service/docker_run/container_registry_utils.rb +++ b/qa/qa/service/docker_run/container_registry_utils.rb @@ -4,8 +4,13 @@ module QA module Service module DockerRun class ContainerRegistryUtils < Base - def tag_image(current_tag, new_tag) - run_docker_command("tag #{current_tag} #{new_tag}") + def initialize(image:) + @image = image + super() + end + + def tag_image(new_tag) + run_docker_command("tag #{@image} #{new_tag}") end def push_image(tag) diff --git a/qa/qa/specs/features/ee/browser_ui/13_secure/cvs_container_registry_spec.rb b/qa/qa/specs/features/ee/browser_ui/13_secure/cvs_container_registry_spec.rb index 92cc41390bc8a20007910e70155d306918636a8b..181500836bbddd7f298a3f9ee5f26b02123b4adf 100644 --- a/qa/qa/specs/features/ee/browser_ui/13_secure/cvs_container_registry_spec.rb +++ b/qa/qa/specs/features/ee/browser_ui/13_secure/cvs_container_registry_spec.rb @@ -22,7 +22,7 @@ module QA end let(:new_image_tag) { "#{registry_host}/#{project.full_path}:latest" } - let(:docker_utils) { QA::Service::DockerRun::ContainerRegistryUtils.new } + let(:docker_utils) { QA::Service::DockerRun::ContainerRegistryUtils.new(image: image_tag) } before do Runtime::Feature.enable(:cvs_for_container_scanning, project: project) @@ -50,10 +50,11 @@ def configure_security_scanning end def push_container_image + docker_utils.pull docker_utils.login(registry_host, user: Runtime::Env.user_username, password: registry_password_token) - docker_utils.tag_image(image_tag, new_image_tag) + docker_utils.tag_image(new_image_tag) docker_utils.push_image(new_image_tag) end