diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-05 09:12:23 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-05 09:12:23 +0000 |
commit | e0c90aab261896abcf93f3806d965790dbd03408 (patch) | |
tree | 72524feb8405807c5122cf788976fa6fd09fae3f /qa/qa/runtime | |
parent | 7e254c1556243adc62436a0b929fbeff7e8daf52 (diff) | |
download | gitlab-ce-e0c90aab261896abcf93f3806d965790dbd03408.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa/qa/runtime')
-rw-r--r-- | qa/qa/runtime/allure_report.rb | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/qa/qa/runtime/allure_report.rb b/qa/qa/runtime/allure_report.rb index 5b0456dc607..5f628050f3b 100644 --- a/qa/qa/runtime/allure_report.rb +++ b/qa/qa/runtime/allure_report.rb @@ -5,6 +5,8 @@ require 'active_support/core_ext/enumerable' module QA module Runtime class AllureReport + extend QA::Support::API + class << self # Configure allure reports # @@ -77,27 +79,21 @@ module QA end end - # Custom environment info hash + # Gitlab version and revision information # # @return [Hash] def environment_info - %w[ - CI_COMMIT_SHA - CI_MERGE_REQUEST_SOURCE_BRANCH_SHA - CI_MERGE_REQUEST_IID - TOP_UPSTREAM_SOURCE_SHA - TOP_UPSTREAM_MERGE_REQUEST_IID - DEPLOY_VERSION - GITLAB_VERSION - GITLAB_SHELL_VERSION - GITLAB_ELASTICSEARCH_INDEXER_VERSION - GITLAB_KAS_VERSION - GITLAB_WORKHORSE_VERSION - GITLAB_PAGES_VERSION - GITALY_SERVER_VERSION - QA_IMAGE - QA_BROWSER - ].index_with { |val| ENV[val] }.compact_blank + lambda do + return {} unless Env.admin_personal_access_token || Env.personal_access_token + + client = Env.admin_personal_access_token ? API::Client.as_admin : API::Client.new + response = get(API::Request.new(client, '/version').url) + + JSON.parse(response.body, symbolize_names: true) + rescue StandardError, ArgumentError => e + Logger.error("Failed to attach version info to allure report: #{e}") + {} + end end end end |