Module: Gitlab::QA::Runtime::Env
Constant Summary collapse
- ENV_VARIABLES =
{ 'GITLAB_USERNAME' => :user_username, 'GITLAB_PASSWORD' => :user_password, 'GITLAB_LDAP_USERNAME' => :ldap_username, 'GITLAB_LDAP_PASSWORD' => :ldap_password, 'GITLAB_USER_TYPE' => :user_type, 'GITLAB_SANDBOX_NAME' => :gitlab_sandbox_name, 'GITLAB_QA_ACCESS_TOKEN' => :qa_access_token, 'GITLAB_URL' => :gitlab_url, 'EE_LICENSE' => :ee_license }.freeze
Instance Method Summary collapse
- #logs_dir ⇒ Object
- #qa_access_token ⇒ Object
- #require_license! ⇒ Object
- #require_no_license! ⇒ Object
- #require_qa_access_token! ⇒ Object
- #screenshots_dir ⇒ Object
- #variables ⇒ Object
Instance Method Details
#logs_dir ⇒ Object
31 32 33 |
# File 'lib/gitlab/qa/runtime/env.rb', line 31 def logs_dir ENV['QA_LOGS_DIR'] || '/tmp/gitlab-qa/logs' end |
#qa_access_token ⇒ Object
23 24 25 |
# File 'lib/gitlab/qa/runtime/env.rb', line 23 def qa_access_token ENV['GITLAB_QA_ACCESS_TOKEN'] end |
#require_license! ⇒ Object
48 49 50 51 52 |
# File 'lib/gitlab/qa/runtime/env.rb', line 48 def require_license! return if ENV.include?('EE_LICENSE') raise ArgumentError, 'GitLab License is not available. Please load a license into EE_LICENSE env variable.' end |
#require_no_license! ⇒ Object
54 55 56 57 58 |
# File 'lib/gitlab/qa/runtime/env.rb', line 54 def require_no_license! return unless ENV.include?('EE_LICENSE') raise ArgumentError, "Unexpected EE_LICENSE provided. Please unset it to continue." end |
#require_qa_access_token! ⇒ Object
60 61 62 63 64 |
# File 'lib/gitlab/qa/runtime/env.rb', line 60 def require_qa_access_token! return unless ENV['GITLAB_QA_ACCESS_TOKEN'].to_s.strip.empty? raise ArgumentError, "Please provide GITLAB_QA_ACCESS_TOKEN" end |
#screenshots_dir ⇒ Object
27 28 29 |
# File 'lib/gitlab/qa/runtime/env.rb', line 27 def screenshots_dir ENV['QA_SCREENSHOTS_DIR'] || '/tmp/gitlab-qa/screenshots' end |
#variables ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gitlab/qa/runtime/env.rb', line 35 def variables vars = {} ENV_VARIABLES.each do |name, attribute| # Variables that are overriden in the environment take precedence # over the defaults specified by the QA runtime. value = env_value_if_defined(name) || send(attribute) # rubocop:disable GitlabSecurity/PublicSend vars[name] = value if value end vars end |