gitlab_quality-test_tooling 1.18.0 → 1.19.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 948fbcd939a7800a4538113fddc717642c4d9fed7dab6d650cd9052c1832f19b
4
- data.tar.gz: fbc4cee23cbcd3f7631ac6a03d41f2b8e287590777fef813289013d982efc4f7
3
+ metadata.gz: beeb1678e873990d65b474eeda84dd957becfa69e7868d83d9db5394aa9e71be
4
+ data.tar.gz: 8a932d572750522124c0fa24950db55a1d9e5de66e476cde0f1c17a7fb16f9d0
5
5
  SHA512:
6
- metadata.gz: 34c8a65eaf48e4ef9800df34a66f0086d3915252444091631fbd76273731008f70be149e3c92d5954644e55839d8a314eb3442411e3a389061e460d66c9d1ea2
7
- data.tar.gz: 29f34824d1c5bba8dbe979a10c0e93a8c4c06e7b0b174b96b0150c19e3d6f71bb0fa9a8ef285a2d650af407547084a5e1a7bb2925817dce5d200b6755e864d4c
6
+ metadata.gz: a5bf865481746bcf4e54d10e2b19b5b8ac63aefb151eb285b47566aae82e3fcf7d30ccd90603bc8a44c3fa06996f4a6bc3486575fe6aa002cf596f4e5bd0e366
7
+ data.tar.gz: bc1857f7fbf20040a2c4c0e4c696b3d31410b07b664f5aedcc2a5535d8c5e1ec1e5e52b8dda6fe906b1253ba218615cfbe9cb2234c130de27f3d605e8979fcff
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab_quality-test_tooling (1.18.0)
4
+ gitlab_quality-test_tooling (1.19.1)
5
5
  activesupport (>= 6.1, < 7.2)
6
6
  amatch (~> 0.4.1)
7
7
  gitlab (~> 4.19)
@@ -31,7 +31,7 @@ options = OptionParser.new do |opts|
31
31
  params[:issue_url_file] = issue_url_file
32
32
  end
33
33
 
34
- opts.on('--pipeline-stages STAGES', STRING, 'Comma-separated list of pipeline stages to include in test session issue') do |pipeline_stages|
34
+ opts.on('--pipeline-stages STAGES', String, 'Comma-separated list of pipeline stages to include in test session issue') do |pipeline_stages|
35
35
  params[:pipeline_stages] = pipeline_stages.split(',')
36
36
  end
37
37
 
data/lefthook.yml CHANGED
@@ -17,7 +17,8 @@ pre-push:
17
17
  # Changelog git trailer for the first commit of the branch
18
18
  changelog-on-first-commit:
19
19
  run: |
20
- first_commit_message=$(git log --format=%B -n 1 $(git log main..HEAD --pretty=format:"%h" | tail -1))
20
+ git fetch origin main
21
+ first_commit_message=$(git log --format=%B -n 1 $(git log origin/main..HEAD --pretty=format:"%h" | tail -1))
21
22
  if ! echo ${first_commit_message} | grep "Changelog:"; then
22
23
  echo Could not find a Changelog: git trailer on the first commit for this branch.
23
24
  echo
@@ -6,19 +6,23 @@ module GitlabQuality
6
6
  module TestTooling
7
7
  module Concerns
8
8
  module FindSetDri
9
- def set_dri_via_group(product_group, stage)
9
+ def test_dri(product_group, stage, section)
10
10
  parse_json_with_sets
11
+ fetch_section_sets(section)
11
12
  fetch_stage_sets(stage)
12
-
13
- return @sets.sample['username'] if @stage_sets.empty?
14
-
15
13
  fetch_group_sets(product_group)
16
14
 
17
- if @group_sets.empty?
18
- @stage_sets.sample['username']
19
- else
20
- @group_sets.sample['username']
21
- end
15
+ set_dris = if @group_sets.any?
16
+ @group_sets
17
+ elsif @stage_sets.any?
18
+ @stage_sets
19
+ elsif @section_sets.any?
20
+ @section_sets
21
+ else
22
+ @sets
23
+ end
24
+
25
+ set_dris.sample['username']
22
26
  end
23
27
 
24
28
  private
@@ -30,6 +34,15 @@ module GitlabQuality
30
34
  @sets = JSON.parse(response.body).select { |user| user['role'].include?('software-engineer-in-test') }
31
35
  end
32
36
 
37
+ def fetch_section_sets(section)
38
+ @section_sets = []
39
+ return if section.nil?
40
+
41
+ @section_sets = @sets.select do |user|
42
+ user['role'].include?(section.split("_").map(&:capitalize).join(" "))
43
+ end
44
+ end
45
+
33
46
  def fetch_stage_sets(stage)
34
47
  @stage_sets = @sets.select do |user|
35
48
  user['role'].include?(stage.split("_").map(&:capitalize).join(" "))
@@ -328,7 +328,7 @@ module GitlabQuality
328
328
  def new_issue_assignee_id(test)
329
329
  return unless test.product_group?
330
330
 
331
- dri = set_dri_via_group(test.product_group, test.stage)
331
+ dri = test_dri(test.product_group, test.stage, test.section)
332
332
  puts " => Assigning #{dri} as DRI for the issue."
333
333
 
334
334
  gitlab.find_user_id(username: dri)
@@ -17,6 +17,7 @@ module GitlabQuality
17
17
  @existing_mrs = nil
18
18
  @file_path = spec["file_path"]
19
19
  testcase = spec["testcase"]
20
+ product_section = spec["section"]
20
21
  devops_stage = spec["stage"]
21
22
  product_group = spec["product_group"]
22
23
  @example_name = spec["name"]
@@ -36,7 +37,7 @@ module GitlabQuality
36
37
  #{"Promote to blocking: #{example_name}".truncate(72)}
37
38
  COMMIT_MESSAGE
38
39
 
39
- reviewer_id, assignee_handle = context.fetch_dri_id(product_group, devops_stage)
40
+ reviewer_id, assignee_handle = context.fetch_dri_id(product_group, devops_stage, product_section)
40
41
 
41
42
  gitlab_bot_user_id = context.user_id_for_username(Runtime::Env.gitlab_bot_username)
42
43
 
@@ -190,8 +190,8 @@ module GitlabQuality
190
190
  # @param [String] product_group
191
191
  # @param [String] devops_stage
192
192
  # @return [Array<Integer, String>]
193
- def fetch_dri_id(product_group, devops_stage)
194
- assignee_handle = ENV.fetch('QA_TEST_DRI_HANDLE', nil) || set_dri_via_group(product_group, devops_stage)
193
+ def fetch_dri_id(product_group, devops_stage, section)
194
+ assignee_handle = ENV.fetch('QA_TEST_DRI_HANDLE', nil) || test_dri(product_group, devops_stage, section)
195
195
 
196
196
  [user_id_for_username(assignee_handle), assignee_handle]
197
197
  end
@@ -22,6 +22,10 @@ module GitlabQuality
22
22
  raise NotImplementedError
23
23
  end
24
24
 
25
+ def section
26
+ raise NotImplementedError
27
+ end
28
+
25
29
  def category
26
30
  raise NotImplementedError
27
31
  end
@@ -111,6 +111,10 @@ module GitlabQuality
111
111
  report['feature_category']
112
112
  end
113
113
 
114
+ def section
115
+ report['section']
116
+ end
117
+
114
118
  def category
115
119
  report['category']
116
120
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitlabQuality
4
4
  module TestTooling
5
- VERSION = "1.18.0"
5
+ VERSION = "1.19.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_quality-test_tooling
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.0
4
+ version: 1.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-08 00:00:00.000000000 Z
11
+ date: 2024-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control