gitlab-qa 7.8.1 → 7.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d5db8c8b0acf394172a0def237d3049c42c04a811204589d6052fb3fda32eb2
4
- data.tar.gz: ae97cccc20dce22ce593a1d5a9690d6375b68fcd8ca1d2c4f854803c92dc17d2
3
+ metadata.gz: 75ab48c7d1d2eba818e59d14fdf90a781faf6af477c5993f2ebe27296be785bd
4
+ data.tar.gz: bc2614ee2f780463fc21360b2e28885227bfe251e8dd5592657feb6b605fc264
5
5
  SHA512:
6
- metadata.gz: 9f13f3e88a045994996a2664e0efedc7dadac3ac53e7cd52b0338cf95b33224bd28d92dbe1909dd0ba66f60b4de1b41dd407c1fd1604b72b295c9368a8526710
7
- data.tar.gz: aed74598a8cb77c86822ceb2dc457641e4092aa764dba0bbcb3cd281d4a85abe329a8ecda6670e325655afd0470730b9e7699f5be5b0517dec66866f7adcca04
6
+ metadata.gz: 16de17dbf4a4c463fcc185e2432297b597a1d6704f02073010be159dc9994739b20d4733038721011fd1051918589c0cd93d3922d663cc3e3c4dd81545e2e4b0
7
+ data.tar.gz: 3208f2280f9d00c45e051e1bc2894dfbd9df989e7430931d5375054a79499c67c07f95b66dcee6a066ed9019c613cf6d976fa97ef35596c9e2459c43363c7023
data/.gitlab-ci.yml CHANGED
@@ -158,6 +158,7 @@ rspec:
158
158
  ce:sanity-framework:
159
159
  variables:
160
160
  QA_GENERATE_ALLURE_REPORT: "false"
161
+ QA_EXPORT_TEST_METRICS: "false"
161
162
  script:
162
163
  - ./bin/expect_exit_code_and_text "bundle exec exe/gitlab-qa Test::Instance::Image ${RELEASE:=CE} -- --tag framework" 1 "2 examples, 1 failure"
163
164
  extends:
@@ -168,6 +169,7 @@ ce:sanity-framework:
168
169
  ee:sanity-framework:
169
170
  variables:
170
171
  QA_GENERATE_ALLURE_REPORT: "false"
172
+ QA_EXPORT_TEST_METRICS: "false"
171
173
  script:
172
174
  - ./bin/expect_exit_code_and_text "bundle exec exe/gitlab-qa Test::Instance::Image ${RELEASE:=EE} -- --tag framework" 1 "2 examples, 1 failure"
173
175
  extends:
@@ -680,6 +682,27 @@ ee:object_storage_aws-quarantine:
680
682
  GITLAB_QA_OPTS: "--omnibus-config object_storage_aws"
681
683
  QA_RSPEC_TAGS: "--tag quarantine --tag object_storage"
682
684
 
685
+ ee:object_storage_gcs:
686
+ extends:
687
+ - .test
688
+ - .high-capacity
689
+ - .ee-qa
690
+ - .rspec-report-opts
691
+ variables:
692
+ GITLAB_QA_OPTS: "--omnibus-config object_storage_gcs"
693
+ QA_RSPEC_TAGS: "--tag object_storage"
694
+
695
+ ee:object_storage_gcs-quarantine:
696
+ extends:
697
+ - .test
698
+ - .high-capacity
699
+ - .ee-qa
700
+ - .quarantine
701
+ - .rspec-report-opts
702
+ variables:
703
+ GITLAB_QA_OPTS: "--omnibus-config object_storage_gcs"
704
+ QA_RSPEC_TAGS: "--tag quarantine --tag object_storage"
705
+
683
706
  ee:object_storage:
684
707
  extends:
685
708
  - .test
@@ -74,6 +74,10 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
74
74
  | `QA_SLOW_CONNECTION_THROUGHPUT_KBPS` | `32` | The maximum throughput (in kbps) of the simulated slow connection. | No|
75
75
  | `QA_SKIP_PULL` | `false` | Set to `true` to skip pulling docker images (e.g., to use one you built locally). | No|
76
76
  | `QA_GENERATE_ALLURE_REPORT` | `false` | When running on CI, set to `true` to generate allure reports | No|
77
+ | `QA_EXPORT_TEST_METRICS` | `true` | When running on CI, set to `true` to export test metrics to influxdb | No|
78
+ | `QA_INFLUXDB_URL` |- | Influxdb url for test metrics reporting | No|
79
+ | `QA_INFLUXDB_TOKEN` |- | Influxdb token for test metrics reporting | No|
80
+ | `QA_RUN_TYPE` |- | QA run type like `staging-full`, `canary`, `production` etc. Used in test metrics reporting | No|
77
81
  | `GITHUB_USERNAME` |- | Username for authenticating with GitHub. | No|
78
82
  | `GITHUB_PASSWORD` |- | Password for authenticating with GitHub. | No|
79
83
  | `GITLAB_QA_LOOP_RUNNER_MINUTES` | `1` | Minutes to run and repeat a spec while using the '--loop' option; default value is 1 minute. | No|
@@ -19,6 +19,8 @@ module Gitlab
19
19
  puts "Reporting tests in #{test_results.path}"
20
20
 
21
21
  test_results.each do |test|
22
+ puts "Reporting test: #{test.file} | #{test.name}\n"
23
+
22
24
  report_test(test) unless test.skipped
23
25
  end
24
26
 
@@ -27,19 +29,18 @@ module Gitlab
27
29
  end
28
30
 
29
31
  def report_test(test)
30
- puts "Reporting test: #{test.file} | #{test.name}"
31
-
32
32
  testcase = find_testcase(test) || create_testcase(test)
33
33
  test.testcase ||= testcase.web_url.sub('/issues/', '/quality/test_cases/')
34
34
 
35
- issue = find_issue_by_iid(testcase, test)
35
+ issue = find_linked_results_issue_by_iid(testcase, test)
36
36
 
37
- unless issue
37
+ if issue
38
+ issue = update_issue_title(issue, test, 'issue') if issue.title.strip != title_from_test(test)
39
+ else
38
40
  puts "No valid issue link found"
39
- issue = find_or_create_issue(test)
41
+ issue = find_or_create_results_issue(test)
40
42
 
41
43
  add_issue_to_testcase(testcase, issue)
42
- puts "Added issue #{issue.web_url} to testcase #{testcase.web_url}"
43
44
  end
44
45
 
45
46
  update_labels(testcase, test)
@@ -47,18 +48,47 @@ module Gitlab
47
48
  end
48
49
 
49
50
  def find_testcase(test)
50
- iid = iid_from_testcase_url(test.testcase)
51
+ testcase = find_testcase_by_iid(test)
52
+
53
+ if testcase
54
+ testcase = update_issue_title(testcase, test, 'test_case') if testcase.title.strip != title_from_test(test)
55
+ else
56
+ testcase = find_issue(test, 'test_case')
57
+ end
58
+
59
+ testcase
60
+ end
61
+
62
+ def find_testcase_by_iid(test)
63
+ iid = testcase_iid_from_url(test.testcase)
51
64
 
52
- testcases = search_issues(test: test, issue_type: 'test_case', iid: iid)
65
+ return unless iid
66
+
67
+ find_issue_by_iid(iid, 'test_case')
68
+ end
69
+
70
+ def find_linked_results_issue_by_iid(testcase, test)
71
+ iid = issue_iid_from_testcase(testcase)
53
72
 
54
- if iid && testcases.blank?
55
- warn(%(Test case url "#{test.testcase}" not valid))
56
- testcases = search_issues(test: test, issue_type: 'test_case')
73
+ return unless iid
74
+
75
+ find_issue_by_iid(iid, 'issue')
76
+ end
77
+
78
+ def find_issue_by_iid(iid, issue_type)
79
+ issues = gitlab.find_issues(iid: iid) do |issue|
80
+ issue.state == 'opened' && issue.issue_type == issue_type
57
81
  end
58
82
 
59
- warn(%(Too many test cases found with the file path "#{test.file}" and name "#{test.name}")) if testcases&.many?
83
+ warn(%(#{issue_type} iid "#{iid}" not valid)) if issues.empty?
60
84
 
61
- testcases.first
85
+ issues.first
86
+ end
87
+
88
+ def update_issue_title(issue, test, issue_type)
89
+ warn(%(#{issue_type} title needs to be updated from '#{issue.title.strip}' to '#{title_from_test(test)}'))
90
+
91
+ gitlab.edit_issue(iid: issue.iid, options: { title: title_from_test(test) })
62
92
  end
63
93
 
64
94
  def create_testcase(test)
@@ -73,7 +103,7 @@ module Gitlab
73
103
  )
74
104
  end
75
105
 
76
- def iid_from_testcase_url(url)
106
+ def testcase_iid_from_url(url)
77
107
  return warn(%(\nPlease update #{url} to test case url")) if url&.include?('/-/issues/')
78
108
 
79
109
  url && url.split('/').last.to_i
@@ -93,7 +123,7 @@ module Gitlab
93
123
  issue_iid&.to_i
94
124
  end
95
125
 
96
- def find_or_create_issue(test)
126
+ def find_or_create_results_issue(test)
97
127
  issue = find_issue(test, 'issue')
98
128
 
99
129
  if issue
@@ -106,22 +136,12 @@ module Gitlab
106
136
  issue
107
137
  end
108
138
 
109
- def find_issue_by_iid(testcase, test)
110
- iid = issue_iid_from_testcase(testcase)
111
-
112
- return unless iid
113
-
114
- issues = search_issues(test: test, issue_type: 'issue', iid: iid)
115
-
116
- warn(%(Issue iid "#{iid}" not valid)) if issues.empty?
117
-
118
- issues.first
119
- end
120
-
121
139
  def find_issue(test, issue_type)
122
- issues = search_issues(test: test, issue_type: 'issue')
140
+ issues = gitlab.find_issues(options: { search: search_term(test) }) do |issue|
141
+ issue.state == 'opened' && issue.issue_type == issue_type && issue.title.strip == title_from_test(test)
142
+ end
123
143
 
124
- warn(%(Too many issues found with the file path "#{test.file}" and name "#{test.name}")) if issues.many?
144
+ warn(%(Too many #{issue_type}s found with the file path "#{test.file}" and name "#{test.name}")) if issues.many?
125
145
 
126
146
  issues.first
127
147
  end
@@ -130,6 +150,8 @@ module Gitlab
130
150
  results_section = testcase.description.include?(RESULTS_SECTION_TEMPLATE) ? '' : RESULTS_SECTION_TEMPLATE
131
151
 
132
152
  gitlab.edit_issue(iid: testcase.iid, options: { description: (testcase.description + results_section + "\n\n#{issue.web_url}") })
153
+
154
+ puts "Added issue #{issue.web_url} to testcase #{testcase.web_url}"
133
155
  end
134
156
 
135
157
  def update_issue(issue, test)
@@ -157,12 +179,6 @@ module Gitlab
157
179
  labels << (test.failures.empty? ? "#{pipeline}::passed" : "#{pipeline}::failed")
158
180
  end
159
181
 
160
- def search_issues(test:, issue_type:, iid: nil)
161
- gitlab.find_issues(iid: iid, options: { search: search_term(test) }) do |issue|
162
- issue.state == 'opened' && issue.issue_type == issue_type && issue.title.strip == title_from_test(test)
163
- end
164
- end
165
-
166
182
  def search_term(test)
167
183
  %("#{partial_file_path(test.file)}" "#{search_safe(test.name)}")
168
184
  end
@@ -16,6 +16,26 @@ module Gitlab
16
16
  'QA_REMOTE_GRID_ACCESS_KEY' => :remote_grid_access_key,
17
17
  'QA_REMOTE_GRID_PROTOCOL' => :remote_grid_protocol,
18
18
  'QA_BROWSER' => :browser,
19
+ 'QA_ADDITIONAL_REPOSITORY_STORAGE' => :qa_additional_repository_storage,
20
+ 'QA_PRAEFECT_REPOSITORY_STORAGE' => :qa_praefect_repository_storage,
21
+ 'QA_GITALY_NON_CLUSTER_STORAGE' => :qa_gitaly_non_cluster_storage,
22
+ 'QA_COOKIES' => :qa_cookie,
23
+ 'QA_DEBUG' => :qa_debug,
24
+ 'QA_DEFAULT_BRANCH' => :qa_default_branch,
25
+ 'QA_LOG_PATH' => :qa_log_path,
26
+ 'QA_CAN_TEST_ADMIN_FEATURES' => :qa_can_test_admin_features,
27
+ 'QA_CAN_TEST_GIT_PROTOCOL_V2' => :qa_can_test_git_protocol_v2,
28
+ 'QA_CAN_TEST_PRAEFECT' => :qa_can_test_praefect,
29
+ 'QA_DISABLE_RSPEC_RETRY' => :qa_disable_rspec_retry,
30
+ 'QA_SIMULATE_SLOW_CONNECTION' => :qa_simulate_slow_connection,
31
+ 'QA_SLOW_CONNECTION_LATENCY_MS' => :qa_slow_connection_latency_ms,
32
+ 'QA_SLOW_CONNECTION_THROUGHPUT_KBPS' => :qa_slow_connection_throughput_kbps,
33
+ 'QA_GENERATE_ALLURE_REPORT' => :generate_allure_report,
34
+ 'QA_EXPORT_TEST_METRICS' => :qa_export_test_metrics,
35
+ 'QA_INFLUXDB_URL' => :qa_influxdb_url,
36
+ 'QA_INFLUXDB_TOKEN' => :qa_influxdb_token,
37
+ 'QA_RUN_TYPE' => :qa_run_type,
38
+ 'QA_SKIP_PULL' => :qa_skip_pull,
19
39
  'GITLAB_API_BASE' => :api_base,
20
40
  'GITLAB_ADMIN_USERNAME' => :admin_username,
21
41
  'GITLAB_ADMIN_PASSWORD' => :admin_password,
@@ -40,21 +60,6 @@ module Gitlab
40
60
  'CLOUDSDK_CORE_PROJECT' => :cloudsdk_core_project,
41
61
  'GCLOUD_REGION' => :gcloud_region,
42
62
  'SIGNUP_DISABLED' => :signup_disabled,
43
- 'QA_ADDITIONAL_REPOSITORY_STORAGE' => :qa_additional_repository_storage,
44
- 'QA_PRAEFECT_REPOSITORY_STORAGE' => :qa_praefect_repository_storage,
45
- 'QA_GITALY_NON_CLUSTER_STORAGE' => :qa_gitaly_non_cluster_storage,
46
- 'QA_COOKIES' => :qa_cookie,
47
- 'QA_DEBUG' => :qa_debug,
48
- 'QA_DEFAULT_BRANCH' => :qa_default_branch,
49
- 'QA_LOG_PATH' => :qa_log_path,
50
- 'QA_CAN_TEST_ADMIN_FEATURES' => :qa_can_test_admin_features,
51
- 'QA_CAN_TEST_GIT_PROTOCOL_V2' => :qa_can_test_git_protocol_v2,
52
- 'QA_CAN_TEST_PRAEFECT' => :qa_can_test_praefect,
53
- 'QA_DISABLE_RSPEC_RETRY' => :qa_disable_rspec_retry,
54
- 'QA_SIMULATE_SLOW_CONNECTION' => :qa_simulate_slow_connection,
55
- 'QA_SLOW_CONNECTION_LATENCY_MS' => :qa_slow_connection_latency_ms,
56
- 'QA_SLOW_CONNECTION_THROUGHPUT_KBPS' => :qa_slow_connection_throughput_kbps,
57
- 'QA_GENERATE_ALLURE_REPORT' => :generate_allure_report,
58
63
  'GITLAB_QA_USERNAME_1' => :gitlab_qa_username_1,
59
64
  'GITLAB_QA_PASSWORD_1' => :gitlab_qa_password_1,
60
65
  'GITLAB_QA_USERNAME_2' => :gitlab_qa_username_2,
@@ -74,13 +79,14 @@ module Gitlab
74
79
  'CI_NODE_INDEX' => :ci_node_index,
75
80
  'CI_NODE_TOTAL' => :ci_node_total,
76
81
  'CI_PROJECT_NAME' => :ci_project_name,
82
+ 'CI_SLACK_WEBHOOK_URL' => :ci_slack_webhook_url,
83
+ 'CI_PIPELINE_CREATED_AT' => :ci_pipeline_created_at,
84
+ 'CI_MERGE_REQUEST_IID' => :ci_merge_request_iid,
77
85
  'GITLAB_CI' => :gitlab_ci,
78
- 'QA_SKIP_PULL' => :qa_skip_pull,
79
86
  'ELASTIC_URL' => :elastic_url,
80
87
  'GITLAB_QA_LOOP_RUNNER_MINUTES' => :gitlab_qa_loop_runner_minutes,
81
88
  'MAILHOG_HOSTNAME' => :mailhog_hostname,
82
89
  'SLACK_QA_CHANNEL' => :slack_qa_channel,
83
- 'CI_SLACK_WEBHOOK_URL' => :ci_slack_webhook_url,
84
90
  'SLACK_ICON_EMOJI' => :slack_icon_emoji,
85
91
  'GITLAB_QA_FORMLESS_LOGIN_TOKEN' => :gitlab_qa_formless_login_token,
86
92
  'GEO_MAX_FILE_REPLICATION_TIME' => :geo_max_file_replication_time,
@@ -97,7 +103,12 @@ module Gitlab
97
103
  'AWS_S3_REGION' => :aws_s3_region,
98
104
  'AWS_S3_KEY_ID' => :aws_s3_key_id,
99
105
  'AWS_S3_ACCESS_KEY' => :aws_s3_access_key,
100
- 'AWS_S3_BUCKET_NAME' => :aws_s3_bucket_name
106
+ 'AWS_S3_BUCKET_NAME' => :aws_s3_bucket_name,
107
+ 'TOP_UPSTREAM_MERGE_REQUEST_IID' => :top_upstream_merge_request_iid,
108
+ 'GOOGLE_PROJECT' => :google_project,
109
+ 'GOOGLE_CLIENT_EMAIL' => :google_client_email,
110
+ 'GOOGLE_JSON_KEY' => :google_json_key,
111
+ 'GCS_BUCKET_NAME' => :gcs_bucket_name
101
112
  }.freeze
102
113
 
103
114
  ENV_VARIABLES.each do |env_name, method_name|
@@ -292,6 +303,12 @@ module Gitlab
292
303
  end
293
304
  end
294
305
 
306
+ def require_gcs_environment!
307
+ %w[GOOGLE_PROJECT GOOGLE_CLIENT_EMAIL GOOGLE_JSON_KEY GCS_BUCKET_NAME].each do |env_key|
308
+ raise ArgumentError, "Environment variable #{env_key} must be set to run GCS object storage specs" unless ENV.key?(env_key)
309
+ end
310
+ end
311
+
295
312
  def require_initial_password!
296
313
  return unless ENV['GITLAB_INITIAL_ROOT_PASSWORD'].to_s.strip.empty?
297
314
 
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+ require 'tempfile'
3
+
4
+ module Gitlab
5
+ module QA
6
+ module Runtime
7
+ module OmnibusConfigurations
8
+ class ObjectStorageGcs < Default
9
+ def configuration
10
+ Runtime::Env.require_gcs_environment!
11
+
12
+ json_key = setup_json_key
13
+
14
+ <<~OMNIBUS
15
+ gitlab_rails['object_store']['connection'] = { 'provider' => 'Google', 'google_project' => '#{Runtime::Env.google_project}', 'google_client_email' => '#{Runtime::Env.google_client_email}', 'google_json_key_location' => '#{json_key.path}' }
16
+
17
+ gitlab_rails['object_store']['objects']['artifacts']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
18
+ gitlab_rails['object_store']['objects']['external_diffs']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
19
+ gitlab_rails['object_store']['objects']['lfs']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
20
+ gitlab_rails['object_store']['objects']['uploads']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
21
+ gitlab_rails['object_store']['objects']['packages']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
22
+ gitlab_rails['object_store']['objects']['dependency_proxy']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
23
+ gitlab_rails['object_store']['objects']['pages']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
24
+ gitlab_rails['object_store']['objects']['terraform_state']['bucket'] = '#{Runtime::Env.gcs_bucket_name}'
25
+ OMNIBUS
26
+ end
27
+
28
+ def setup_json_key
29
+ Tempfile.open('gcs-json-key', ENV['CI_PROJECT_DIR']) do |file|
30
+ file.write(ENV.fetch('GOOGLE_JSON_KEY'))
31
+
32
+ file
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module QA
3
- VERSION = '7.8.1'.freeze
3
+ VERSION = '7.8.5'.freeze
4
4
  end
5
5
  end
data/lib/gitlab/qa.rb CHANGED
@@ -15,6 +15,7 @@ module Gitlab
15
15
  autoload :Packages, 'gitlab/qa/runtime/omnibus_configurations/packages'
16
16
  autoload :ObjectStorage, 'gitlab/qa/runtime/omnibus_configurations/object_storage'
17
17
  autoload :ObjectStorageAws, 'gitlab/qa/runtime/omnibus_configurations/object_storage_aws'
18
+ autoload :ObjectStorageGcs, 'gitlab/qa/runtime/omnibus_configurations/object_storage_gcs'
18
19
  autoload :LicenseMode, 'gitlab/qa/runtime/omnibus_configurations/license_mode'
19
20
  end
20
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-qa
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.8.1
4
+ version: 7.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-01 00:00:00.000000000 Z
11
+ date: 2021-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -294,6 +294,7 @@ files:
294
294
  - lib/gitlab/qa/runtime/omnibus_configurations/license_mode.rb
295
295
  - lib/gitlab/qa/runtime/omnibus_configurations/object_storage.rb
296
296
  - lib/gitlab/qa/runtime/omnibus_configurations/object_storage_aws.rb
297
+ - lib/gitlab/qa/runtime/omnibus_configurations/object_storage_gcs.rb
297
298
  - lib/gitlab/qa/runtime/omnibus_configurations/packages.rb
298
299
  - lib/gitlab/qa/runtime/scenario.rb
299
300
  - lib/gitlab/qa/runtime/token_finder.rb