diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-29 09:09:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-29 09:09:39 +0300 |
commit | 23e26ddb00d9530100c53eb454ba0583737805d7 (patch) | |
tree | 4a025be71797bd512eb5e439f7219e539f9249dc /qa | |
parent | 1824326ad7dc98e572a678eb8a591d70a013954b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/runtime/env.rb | 4 | ||||
-rw-r--r-- | qa/qa/runtime/ip_address.rb | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 259ec94985d..1fd097d0acf 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -492,6 +492,10 @@ module QA ENV.fetch('MAX_CAPYBARA_WAIT_TIME', 10).to_i end + def use_public_ip_api? + enabled?(ENV['QA_USE_PUBLIC_IP_API'], default: false) + end + private def remote_grid_credentials diff --git a/qa/qa/runtime/ip_address.rb b/qa/qa/runtime/ip_address.rb index 657dc789cff..fcb6db750bb 100644 --- a/qa/qa/runtime/ip_address.rb +++ b/qa/qa/runtime/ip_address.rb @@ -13,7 +13,10 @@ module QA def fetch_current_ip_address # When running on CI against a live environment such as staging.gitlab.com, # we use the public facing IP address - ip_address = if Env.running_in_ci? && !URI.parse(Scenario.gitlab_address).host.include?('.test') + non_test_host = !URI.parse(Scenario.gitlab_address).host.include?('.test') + has_no_public_ip = Env.running_in_ci? || Env.use_public_ip_api? + + ip_address = if has_no_public_ip && non_test_host response = get(PUBLIC_IP_ADDRESS_API) raise HostUnreachableError, "#{PUBLIC_IP_ADDRESS_API} is unreachable" unless response.code == Support::API::HTTP_STATUS_OK |