gitlab-qa 6.11.0 → 6.15.1

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: cb6d9e91936be3f2ffdcee43a8693171f691714e086de83065c3ef44580f095e
4
- data.tar.gz: a154de6d77c7ffa54426282f0bee792ed13380a5bdb95534fc6bdbc50791c82c
3
+ metadata.gz: 7423be5876c10c8dbace27a5fa18a3b0590a8bc49198f16b67f14d6b7435f9cc
4
+ data.tar.gz: 774eb7f437c5be8d533ac76e913883725d7b824eedeb3e4225f9200cb740cc80
5
5
  SHA512:
6
- metadata.gz: b01ee4edc97797c0db5eeacc19dd427d7da082dcea78f7175921b17b73a128c529244aebf7129f2ff901da16496805cd9e6364fa6587db54676d10fcbc1f009d
7
- data.tar.gz: d54a08f9c1e02c2bf16f214c3a468cf619438b4e9620cb052c0106c4a336c586218b41d3e050d5e39980d2e148f4ea77631e08b3cbe6afb25f34a1838e0281d6
6
+ metadata.gz: b680735a2f62976139e848396ae6a5b5bf23d27e25163d03003933a33be7d91e32644b20a5c2a00687a09821b97ccda0212c18f048789ed2b52ecac0eb23c22b
7
+ data.tar.gz: 5489e42c1191a98364f9f3e30a4b9768f0105e2b149ec731f6142334ac10336751e108116736ec214a190accf898dfed9d5c205b44dd9bed8869076eee857db7
@@ -1,8 +1,8 @@
1
1
  stages:
2
2
  - check
3
- - release
4
3
  - test
5
4
  - report
5
+ - deploy
6
6
  - notify
7
7
 
8
8
  default:
@@ -35,13 +35,6 @@ workflow:
35
35
  # For triggers from GitLab MR pipelines (and pipelines from other projects), create a pipeline
36
36
  - if: '$CI_PIPELINE_SOURCE == "pipeline"'
37
37
 
38
- .default-rules:
39
- rules:
40
- - if: '$CI_COMMIT_TAG || $RELEASE'
41
- when: never
42
- - if: '$RELEASE == null && $CI_JOB_NAME =~ /staging/'
43
- when: manual
44
-
45
38
  variables:
46
39
  DOCKER_DRIVER: overlay2
47
40
  DOCKER_HOST: tcp://docker:2375
@@ -65,21 +58,6 @@ rubocop:
65
58
  rspec:
66
59
  extends: .check-base
67
60
 
68
- release:
69
- stage: release
70
- rules:
71
- - if: '$CI_COMMIT_TAG'
72
- script:
73
- - gem update --system
74
- - ruby --version
75
- - gem env version
76
- - gem build gitlab-qa.gemspec
77
- - gem push gitlab-qa*.gem
78
- artifacts:
79
- paths:
80
- - gitlab-qa*.gem
81
- expire_in: 30 days
82
-
83
61
  .test:
84
62
  stage: test
85
63
  services:
@@ -95,8 +73,8 @@ release:
95
73
  reports:
96
74
  junit: gitlab-qa-run-*/**/rspec-*.xml
97
75
  script:
98
- - 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
99
- - exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS || test_run_exit_code=$?
76
+ - 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
77
+ - exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS || test_run_exit_code=$?
100
78
  - exe/gitlab-qa-report --update-screenshot-path "gitlab-qa-run-*/**/rspec-*.xml"
101
79
  - export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
102
80
  - if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
@@ -107,6 +85,9 @@ release:
107
85
  variables:
108
86
  DEFAULT_RELEASE: "CE"
109
87
  rules:
88
+ # Don't run E2E jobs on release pipelines
89
+ - changes: ["lib/**/version.rb"]
90
+ when: never
110
91
  - if: '$CI_COMMIT_TAG || $RELEASE =~ /gitlab-ee/'
111
92
  when: never
112
93
  - if: '$RELEASE == null && $CI_JOB_NAME =~ /quarantine|custom/'
@@ -121,6 +102,9 @@ release:
121
102
  variables:
122
103
  DEFAULT_RELEASE: "EE"
123
104
  rules:
105
+ # Don't run E2E jobs on release pipelines
106
+ - changes: ["lib/**/version.rb"]
107
+ when: never
124
108
  - if: '$CI_COMMIT_TAG || $RELEASE =~ /gitlab-ce/'
125
109
  when: never
126
110
  - if: '$RELEASE == null && $CI_JOB_NAME =~ /quarantine|custom/'
@@ -132,7 +116,14 @@ release:
132
116
  - if: '$RELEASE == null || $RELEASE =~ /gitlab-ee/ || $CI_MERGE_REQUEST_ID || $CI_COMMIT_REF_NAME == "master"'
133
117
 
134
118
  .only-qa:
135
- extends: .default-rules
119
+ rules:
120
+ # Don't run E2E jobs on release pipelines
121
+ - changes: ["lib/**/version.rb"]
122
+ when: never
123
+ - if: '$CI_COMMIT_TAG || $RELEASE'
124
+ when: never
125
+ - if: '$RELEASE == null && $CI_JOB_NAME =~ /staging/'
126
+ when: manual
136
127
 
137
128
  .high-capacity:
138
129
  tags:
@@ -175,8 +166,8 @@ ee:sanity-framework:
175
166
  # The custom jobs are for manually running specific/alternative tests in MRs, so we don't report them in issues
176
167
  ce:custom-parallel:
177
168
  script:
178
- - 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
179
- - exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS
169
+ - 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
170
+ - exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS
180
171
  extends:
181
172
  - .test
182
173
  - .high-capacity
@@ -187,8 +178,8 @@ ce:custom-parallel:
187
178
 
188
179
  ee:custom-parallel:
189
180
  script:
190
- - 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
191
- - exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS
181
+ - 'echo "Running: exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS"'
182
+ - exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS
192
183
  extends:
193
184
  - .test
194
185
  - .high-capacity
@@ -1012,3 +1003,7 @@ notify_slack:
1012
1003
  - echo "CI_PIPELINE_URL is $CI_PIPELINE_URL"
1013
1004
  - echo "TOP_UPSTREAM_SOURCE_JOB is $TOP_UPSTREAM_SOURCE_JOB"
1014
1005
  - 'bin/slack $NOTIFY_CHANNEL "☠️ QA against $RELEASE failed! ☠️ See the test session report: $(cat REPORT_ISSUE_URL), and pipeline: $CI_PIPELINE_URL (triggered from $TOP_UPSTREAM_SOURCE_JOB)" ci_failing'
1006
+
1007
+ include:
1008
+ - project: 'gitlab-org/quality/pipeline-common'
1009
+ file: '/ci/gem-release.yml'
@@ -30,6 +30,6 @@ with the latest commit from https://gitlab.com/gitlab-org/gitlab-qa/commits/mast
30
30
  - [ ] Release notes are accurate.
31
31
 
32
32
  - Checklist after merging:
33
- - [ ] [Create a tag for the new release version](docs/release_process.md#how-to).
33
+ - [ ] [Update the release notes for the newly created tag](docs/release_process.md#how-to).
34
34
 
35
35
  /label ~Quality ~"feature::maintenance"
@@ -24,12 +24,13 @@ when we make a change - no matter the size of the change.
24
24
  - If not, update [`lib/gitlab/qa/version.rb`] to an appropriate [semantic version](https://semver.org) in a new merge request using the [release template](https://gitlab.com/gitlab-org/gitlab-qa/blob/master/.gitlab/merge_request_templates/Release.md)
25
25
  and title the MR like `"Bump version to <version>"`.
26
26
  - Merge the merge request.
27
- - Create a new tag via the UI (https://gitlab.com/gitlab-org/gitlab-qa/-/tags/new).
28
- * **Tag name**: The same version found in [`lib/gitlab/qa/version.rb`], prefixed with `v`, e.g. if the version is `4.7.1`, the tag would be `v4.7.1`.
29
- * **Message**: Set it to "Version x.y.z", e.g. if the version is `4.7.1`, the message would be "Version 4.7.1".
27
+ - The new version should automatically be tagged and pushed to Rubygems by the `gem-release` job in the merge commit pipeline.
28
+ - Update the release notes for the newly created tag (https://gitlab.com/gitlab-org/gitlab-qa/-/tags):
30
29
  * **Release notes**: Copy the release notes from the merge request.
31
- * Click *Create Tag*.
32
-
33
- GitLab will then start a pipeline for this new tag, and the `release` job will build and push the new version of `gitlab-qa` to RubyGems.
30
+
31
+ Note: The `gem-release` job uses:
32
+
33
+ - the `GITLAB_API_TOKEN` environment variable to authenticate against GitLab.com's API in order to create the tag
34
+ - the `GEM_HOST_API_KEY` environment variable to authenticate against Rubygems.org's API in order to release the gem
34
35
 
35
36
  [`lib/gitlab/qa/version.rb`]: https://gitlab.com/gitlab-org/gitlab-qa/blob/master/lib/gitlab/qa/version.rb#L3
@@ -84,6 +84,7 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
84
84
  | `JIRA_ADMIN_PASSWORD` |- | Password for authenticating with Jira server as admin. | No|
85
85
  | `CACHE_NAMESPACE_NAME` | `true` | Cache namespace name for groups. | No|
86
86
  | `DEPLOY_VERSION` |- | The version of GitLab being tested against. | No|
87
+ | `GITLAB_QA_USER_AGENT` |- | The browser user-agent to use instead of the default Chrome user-agent. | No|
87
88
 
88
89
  ## [Supported Remote Grid environment variables](./running_against_remote_grid.md)
89
90
 
@@ -6,6 +6,7 @@ module Gitlab
6
6
  class GenerateTestSession < ReportAsIssue
7
7
  private
8
8
 
9
+ # rubocop:disable Metrics/AbcSize
9
10
  def run!
10
11
  puts "Generating test results in `#{files.join(',')}` as issues in project `#{project}` via the API at `#{Runtime::Env.gitlab_api_base}`."
11
12
 
@@ -16,22 +17,26 @@ module Gitlab
16
17
  end
17
18
 
18
19
  issue = gitlab.create_issue(
19
- title: "Test session report | #{Runtime::Env.deploy_environment}",
20
+ title: "Test session report | #{pipeline}",
20
21
  description: generate_description(tests),
21
- labels: ['Quality', 'QA', 'triage report']
22
+ labels: ['Quality', 'QA', 'triage report', pipeline_name_label]
22
23
  )
23
24
 
24
25
  File.write('REPORT_ISSUE_URL', issue.web_url)
25
26
  end
27
+ # rubocop:enable Metrics/AbcSize
26
28
 
27
29
  def generate_description(tests)
28
30
  <<~MARKDOWN
29
31
  ## Session summary
30
32
 
31
33
  * Deploy version: #{Runtime::Env.deploy_version}
32
- * Pipeline: [#{Runtime::Env.ci_pipeline_id}](#{Runtime::Env.ci_pipeline_url})
34
+ * Deploy environment: #{Runtime::Env.deploy_environment}
35
+ * Pipeline: #{Runtime::Env.pipeline_from_project_name} [#{Runtime::Env.ci_pipeline_id}](#{Runtime::Env.ci_pipeline_url})
33
36
  #{generate_summary(tests: tests)}
34
37
 
38
+ #{generate_failed_jobs_listing}
39
+
35
40
  #{generate_stages_listing(tests)}
36
41
 
37
42
  ## Release QA issue
@@ -55,6 +60,33 @@ module Gitlab
55
60
  MARKDOWN
56
61
  end
57
62
 
63
+ def generate_failed_jobs_listing
64
+ failed_jobs = []
65
+
66
+ client = Gitlab.client(
67
+ endpoint: Runtime::Env.ci_api_v4_url,
68
+ private_token: Runtime::Env.gitlab_ci_api_token)
69
+
70
+ gitlab.handle_gitlab_client_exceptions do
71
+ failed_jobs = client.pipeline_jobs(
72
+ Runtime::Env.ci_project_id,
73
+ Runtime::Env.ci_pipeline_id,
74
+ scope: 'failed')
75
+ end
76
+
77
+ listings = failed_jobs.map do |job|
78
+ allowed_to_fail = ' (allowed to fail)' if job.allow_failure
79
+
80
+ "* [#{job.name}](#{job.web_url})#{allowed_to_fail}"
81
+ end.join("\n")
82
+
83
+ <<~MARKDOWN.chomp if failed_jobs.any?
84
+ ## Failed jobs
85
+
86
+ #{listings}
87
+ MARKDOWN
88
+ end
89
+
58
90
  def generate_stages_listing(tests)
59
91
  generate_tests_by_stage(tests).map do |stage, tests_for_stage|
60
92
  tests_by_status = tests_for_stage.group_by(&:status)
@@ -185,7 +217,7 @@ module Gitlab
185
217
  tests_with_same_testcase.select(&:failure_issue)
186
218
 
187
219
  if tests_having_failure_issue.any?
188
- items = tests_having_failure_issue.map do |test|
220
+ items = tests_having_failure_issue.uniq(&:failure_issue).map do |test|
189
221
  "<li>[ ] [failure issue](#{test.failure_issue})</li>"
190
222
  end.join(' ')
191
223
 
@@ -88,7 +88,12 @@ module Gitlab
88
88
  diff_ratio = (distance.to_f / first_test_failure_stacktrace.size).round(3)
89
89
  if diff_ratio <= max_diff_ratio
90
90
  puts " => [DEBUG] Issue #{issue} has an acceptable diff ratio of #{(diff_ratio * 100).round(2)}%."
91
- memo[issue] = diff_ratio
91
+ # The `Gitlab::ObjectifiedHash` class overrides `#hash` which is used by `Hash#[]=` to compute the hash key.
92
+ # This leads to a `TypeError Exception: no implicit conversion of Hash into Integer` error, so we convert the object to a hash before using it as a Hash key.
93
+ # See:
94
+ # - https://gitlab.com/gitlab-org/gitlab-qa/-/merge_requests/587#note_453336995
95
+ # - https://github.com/NARKOZ/gitlab/commit/cbdbd1e32623f018a8fae39932a8e3bc4d929abb?_pjax=%23js-repo-pjax-container#r44484494
96
+ memo[issue.to_h] = diff_ratio
92
97
  else
93
98
  puts " => [DEBUG] Found issue #{issue.web_url} but stacktraces are too different (#{(diff_ratio * 100).round(2)}%)."
94
99
  end
@@ -116,6 +121,9 @@ module Gitlab
116
121
  raise(MultipleIssuesFound, %(Too many issues found for test '#{test.name}' (`#{test.file}`)!))
117
122
  end
118
123
 
124
+ # Re-instantiate a `Gitlab::ObjectifiedHash` object after having converted it to a hash in #find_relevant_failure_issues above.
125
+ best_matching_issue = Gitlab::ObjectifiedHash.new(best_matching_issue)
126
+
119
127
  test.failure_issue ||= best_matching_issue.web_url
120
128
 
121
129
  [best_matching_issue, smaller_diff_ratio]
@@ -129,29 +137,12 @@ module Gitlab
129
137
  ].join("\n\n")
130
138
  end
131
139
 
132
- def deploy_environment_label
133
- environment = Runtime::Env.deploy_environment
134
-
135
- case environment
136
- when 'production'
137
- 'found:gitlab.com'
138
- when 'canary', 'staging'
139
- "found:#{environment}.gitlab.com"
140
- when 'preprod'
141
- 'found:pre.gitlab.com'
142
- when 'staging-orchestrated', 'nightly', 'master'
143
- "found:#{environment}"
144
- else
145
- raise "No `found:*` label for the `#{environment}` environment!"
146
- end
147
- end
148
-
149
140
  def new_issue_labels(test)
150
141
  NEW_ISSUE_LABELS + up_to_date_labels(test: test)
151
142
  end
152
143
 
153
144
  def up_to_date_labels(test:, issue: nil)
154
- super << deploy_environment_label
145
+ super << pipeline_name_label
155
146
  end
156
147
 
157
148
  def post_failed_job_note(issue, test)
@@ -104,6 +104,21 @@ module Gitlab
104
104
  labels
105
105
  end
106
106
 
107
+ def pipeline_name_label
108
+ case pipeline
109
+ when 'production'
110
+ 'found:gitlab.com'
111
+ when 'canary', 'staging'
112
+ "found:#{pipeline}.gitlab.com"
113
+ when 'preprod'
114
+ 'found:pre.gitlab.com'
115
+ when 'staging-orchestrated', 'nightly', 'master'
116
+ "found:#{pipeline}"
117
+ else
118
+ raise "No `found:*` label for the `#{pipeline}` pipeline!"
119
+ end
120
+ end
121
+
107
122
  def ee_test?(test)
108
123
  test.file =~ %r{features/ee/(api|browser_ui)}
109
124
  end
@@ -85,7 +85,8 @@ module Gitlab
85
85
  'JIRA_ADMIN_USERNAME' => :jira_admin_username,
86
86
  'JIRA_ADMIN_PASSWORD' => :jira_admin_password,
87
87
  'CACHE_NAMESPACE_NAME' => :cache_namespace_name,
88
- 'DEPLOY_VERSION' => :deploy_version
88
+ 'DEPLOY_VERSION' => :deploy_version,
89
+ 'GITLAB_QA_USER_AGENT' => :gitlab_qa_user_agent
89
90
  }.freeze
90
91
 
91
92
  ENV_VARIABLES.each do |env_name, method_name|
@@ -115,6 +116,14 @@ module Gitlab
115
116
  ENV['GITLAB_BOT_MULTI_PROJECT_PIPELINE_POLLING_TOKEN']
116
117
  end
117
118
 
119
+ def gitlab_ci_api_token
120
+ ENV['GITLAB_CI_API_TOKEN']
121
+ end
122
+
123
+ def ci_api_v4_url
124
+ ENV['CI_API_V4_URL']
125
+ end
126
+
118
127
  def ci_job_name
119
128
  ENV['CI_JOB_NAME']
120
129
  end
@@ -135,8 +144,8 @@ module Gitlab
135
144
  ENV['CI_PIPELINE_ID']
136
145
  end
137
146
 
138
- def ci_project_name
139
- ENV['CI_PROJECT_NAME']
147
+ def ci_project_id
148
+ ENV['CI_PROJECT_ID']
140
149
  end
141
150
 
142
151
  def ci_commit_ref_name
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  module QA
3
- VERSION = '6.11.0'.freeze
3
+ VERSION = '6.15.1'.freeze
4
4
  end
5
5
  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: 6.11.0
4
+ version: 6.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grzegorz Bizon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-20 00:00:00.000000000 Z
11
+ date: 2020-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control