diff options
Diffstat (limited to 'qa/qa/runtime/env.rb')
-rw-r--r-- | qa/qa/runtime/env.rb | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 7aa45204513..e4b92dc2e0d 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -2,6 +2,7 @@ require 'gitlab/qa' require 'uri' +require 'active_support/core_ext/object/blank' module QA module Runtime @@ -24,48 +25,6 @@ module QA SUPPORTED_FEATURES end - def context_matches?(*options) - return false unless Runtime::Scenario.attributes[:gitlab_address] - - opts = {} - opts[:domain] = '.+' - opts[:tld] = '.com' - - uri = URI(Runtime::Scenario.gitlab_address) - - options.each do |option| - opts[:domain] = 'gitlab' if option == :production - - if option.is_a?(Hash) && !option[:pipeline].nil? && !ci_project_name.nil? - return pipeline_matches?(option[:pipeline]) - - elsif option.is_a?(Hash) && !option[:subdomain].nil? - opts.merge!(option) - - opts[:subdomain] = case option[:subdomain] - when Array - "(#{option[:subdomain].join("|")})." - when Regexp - option[:subdomain] - else - "(#{option[:subdomain]})." - end - end - end - - uri.host.match?(/^#{opts[:subdomain]}#{opts[:domain]}#{opts[:tld]}$/) - end - - alias_method :dot_com?, :context_matches? - - def pipeline_matches?(pipeline_to_run_in) - Array(pipeline_to_run_in).any? { |pipeline| pipeline.to_s.casecmp?(pipeline_from_project_name) } - end - - def pipeline_from_project_name - ci_project_name.to_s.start_with?('gitlab-qa') ? Runtime::Env.default_branch : ci_project_name - end - def additional_repository_storage ENV['QA_ADDITIONAL_REPOSITORY_STORAGE'] end @@ -82,6 +41,10 @@ module QA ENV['CI_JOB_URL'] end + def ci_job_name + ENV['CI_JOB_NAME'] + end + def ci_project_name ENV['CI_PROJECT_NAME'] end @@ -181,6 +144,10 @@ module QA ENV['GITLAB_PASSWORD'] end + def initial_root_password + ENV['GITLAB_INITIAL_ROOT_PASSWORD'] + end + def github_username ENV['GITHUB_USERNAME'] end |