confiner 0.2.2 → 0.2.3

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: 2aec5b597e2386e03ac5df865c2a0adc622a13ec580047e9a320a5ddf80d486b
4
- data.tar.gz: 41d27a7ae0f3e5fb86a8d19d00593a043bd08eefb9d9304d531f4ab46e81c726
3
+ metadata.gz: 6e9601fa7e82b448423188a4dde817864c6f7f57f1a1efd9aae67c1b2e8708c7
4
+ data.tar.gz: 23b2a999e52c58e5081fc9f4857e45a5a0c1783c0b1eca373f4ad4b57394a97f
5
5
  SHA512:
6
- metadata.gz: a265ca1e725d8075bdd17dfb67ffb2e74fccc171581255b71789f6491e9da2cdb7ee0737073d7dbe3cf02dc9e0cbc85ae9f05538e7021ef5d8eb2ffef53e4961
7
- data.tar.gz: 35ba5a29c7bed14503fb81db7d791b392167630fe7f8780eb8e93277e0a4dde156d8d358abc68dfe2910eb7ee12fb4338f91d7b627ea5c86f639a2d98c56131d
6
+ metadata.gz: 48ad12ecefe1473ec4d481f3ebce5d325b9a0a052af1705a9a69621ea78a6d2fb5461fa4a068a83808943dc055f71fec936f54764894bc7a94de6e810e6bbb68
7
+ data.tar.gz: f74349e0a4003152ab16e7e86b4c34b77c58376ad7550fdf1796d4f7bd9633f0fc177abc56133607c4ce3c6108ca43b4598eacaf44eaa029c6127e301f80410b
@@ -36,11 +36,13 @@ module Confiner
36
36
  # store the examples from the pipelines
37
37
  @examples = get_examples
38
38
 
39
- @examples.select(&:failed?).map(&:name).uniq.each do |failed_example|
39
+ quarantines = @examples.select(&:failed?).map(&:name).uniq.each_with_object([]) do |failed_example, quarantines|
40
40
  # count the number of failures consecutively for this example
41
41
 
42
42
  number_of_failures = @examples.select { _1.name == failed_example && _1.failed? }.size
43
43
  if number_of_failures >= threshold
44
+ quarantines << failed_example
45
+
44
46
  example = @examples.find { _1.name == failed_example }
45
47
 
46
48
  log :quarantine, "Quarantining #{failed_example} (#{number_of_failures} >= #{threshold})", 3
@@ -69,6 +71,12 @@ module Confiner
69
71
  end
70
72
  end
71
73
 
74
+ if quarantines.any?
75
+ log :quarantine, "Found #{quarantines.size} candidates to be quarantined", 3
76
+ else
77
+ log :quarantine, 'Found no candidates to be quarantined', 3
78
+ end
79
+
72
80
  log :gitlab, 'Done with Quarantine Process', 2
73
81
  end
74
82
 
@@ -86,8 +94,8 @@ module Confiner
86
94
  def get_last_n_runs(threshold:)
87
95
  pipelines = [] # collection of both passing and failing pipelines
88
96
 
89
- pipelines << @gitlab_client.pipelines(project_id, per_page: threshold, status: :success)
90
- pipelines << @gitlab_client.pipelines(project_id, per_page: threshold, status: :failed)
97
+ pipelines << @gitlab_client.pipelines(project_id, per_page: threshold, status: :success, ref: ref)
98
+ pipelines << @gitlab_client.pipelines(project_id, per_page: threshold, status: :failed, ref: ref)
91
99
  end
92
100
 
93
101
  # Get examples from pipelines
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Confiner
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confiner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab Quality
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-04 00:00:00.000000000 Z
11
+ date: 2022-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec