diff --git a/qa/qa/resource/runner_base.rb b/qa/qa/resource/runner_base.rb index 399d1153dc2126fc55a7b34a42c672ff062c0273..22c966143c5b6eac564572dca442f8a067d3cedb 100644 --- a/qa/qa/resource/runner_base.rb +++ b/qa/qa/resource/runner_base.rb @@ -35,9 +35,10 @@ def initialize @config = nil @run_untagged = nil @name = "qa-runner-#{SecureRandom.hex(4)}" - @image = 'registry.gitlab.com/gitlab-org/gitlab-runner:alpine-v15.8.3' + @image = "#{Runtime::Env.runner_image_registry}/gitlab-org/gitlab-runner:alpine-v15.8.3" @executor = :shell - @executor_image = 'registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine-ruby-2.7' + @executor_image = "#{Runtime::Env.runner_image_registry} + /gitlab-org/gitlab-build-images:gitlab-qa-alpine-ruby-2.7" end # Initially we only support fabricate via API diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 3153c644b883cd91ded7f5099eee7a6142e60a84..6be76de7e4bec9a51abeef8b0cbc8159e2dfc03a 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -479,6 +479,11 @@ def skip_smoke_reliable? enabled?(ENV['QA_SKIP_SMOKE_RELIABLE'], default: false) end + # The QA_RUNNER_IMAGE_REGISTRY defines where we can find docker images required for runner tests + def runner_image_registry + ENV['QA_RUNNER_IMAGE_REGISTRY'] || 'registry.gitlab.com' + end + # ENV variables for authenticating against a private container registry # These need to be set if using the # Service::DockerRun::Mixins::ThirdPartyDocker module diff --git a/qa/qa/service/docker_run/gitlab_runner.rb b/qa/qa/service/docker_run/gitlab_runner.rb index a8fcf8f933275909a6f7239c418d7277723b9b3a..c5ced4c0d119f5fbb03c8dee29b0f9c9c874f693 100644 --- a/qa/qa/service/docker_run/gitlab_runner.rb +++ b/qa/qa/service/docker_run/gitlab_runner.rb @@ -16,12 +16,12 @@ class GitlabRunner < Base MSG def initialize(name) - @image = 'gitlab/gitlab-runner:alpine-v15.8.3' + @image = "#{Runtime::Env.runner_image_registry}/gitlab-org/gitlab-runner:alpine-v15.8.3" @name = name || "qa-runner-#{SecureRandom.hex(4)}" @run_untagged = true @executor = :shell - @executor_image = 'registry.gitlab.com/gitlab-org/gitlab-build-images:gitlab-qa-alpine-ruby-2.7' - + @executor_image = "#{Runtime::Env.runner_image_registry}/" \ + "gitlab-org/gitlab-build-images:gitlab-qa-alpine-ruby-2.7" super() end @@ -39,6 +39,7 @@ def register! raise("Missing runner token value!") unless token cmd = <<~CMD.tr("\n", ' ') + docker container rm -f #{@name} && docker run -d --rm --network #{runner_network} --name #{@name} #{'-v /var/run/docker.sock:/var/run/docker.sock' if @executor == :docker} --privileged @@ -48,9 +49,6 @@ def register! shell(cmd, mask_secrets: [@token]) wait_until_running_and_configured - - # Prove airgappedness - shell("docker exec #{@name} sh -c '#{prove_airgap}'") if runner_network == 'airgapped' end def tags=(tags) @@ -101,17 +99,6 @@ def register_command CMD end - # Ping Cloudflare DNS, should fail - # Ping Registry, should fail to resolve - def prove_airgap - gitlab_ip = Resolv.getaddress 'registry.gitlab.com' - <<~CMD - echo "Checking airgapped connectivity..." - nc -zv -w 10 #{gitlab_ip} 80 && (echo "Airgapped network faulty. Connectivity netcat check failed." && exit 1) || (echo "Connectivity netcat check passed." && exit 0) - wget --retry-connrefused --waitretry=1 --read-timeout=15 --timeout=10 -t 2 http://registry.gitlab.com > /dev/null 2>&1 && (echo "Airgapped network faulty. Connectivity wget check failed." && exit 1) || (echo "Airgapped network confirmed. Connectivity wget check passed." && exit 0) - CMD - end - def add_gitlab_tls_cert gitlab_tls_certificate = Tempfile.new('gitlab-cert') gitlab_tls_certificate.write(Runtime::Env.gitlab_tls_certificate) diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb index 0f6bee951a727eabe54ad509a8a1448c996d3876..a435edcca771e16a1325913d5dc0aa45e63c2552 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb @@ -19,7 +19,7 @@ module QA resource.project = project resource.name = runner_name resource.tags = [runner_name] - resource.image = 'gitlab/gitlab-runner:alpine-v15.8.3' + resource.image = "#{Runtime::Env.runner_image_registry}/gitlab-org/gitlab-runner:alpine-v15.8.3" end end