gitlab-triage 1.29.0 → 1.30.0

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: 6f594160679b71928b75f5bec0131c846d79b10cdc0cebb33388d1bc907b9769
4
- data.tar.gz: 04a02e449720f03ab2820c3be0693c17486e366a7bcfe87a1c1f6e02ee6a02da
3
+ metadata.gz: e51bca620fb9d9638c96605f214f4420f1bd6d2ec2b3142e8d4ee1df35d324bf
4
+ data.tar.gz: 853652c543b2432f9d0bb5ef82515c312d536d6b550a9f2c234958335b0d9437
5
5
  SHA512:
6
- metadata.gz: 44cc6360a513c7ad126ee8dbc4e5151fafbb8b4994e5e0ea84a2fdb5a32ec997271bd66ee3b065cbbbfb3e92548a38d599c025a6f32f378339522f836001cadf
7
- data.tar.gz: 1177f4e8471c3fbe6606e5e0eeaee384335b327774a94574e9942d1928b7dec03c50b8c90df082091b7873f6f871c70a8b162732fa3740a222c861c1751f3f7a
6
+ metadata.gz: e0e71a5626258593de96cce07e1554fb5661c5a32e8931875212b32693a43b5fca5bb7a8020bf2192fd3d83e2278a9c5fbc553953b19f6456702d52354dd1d1b
7
+ data.tar.gz: b4db55f50baacac103a35a4eb5803ca409b7d639292a273dae79931f3c36c6a5ec08a689bcfb0c063af15d28bb1ee4eb20c82c8696be51997328420a0aac714b
data/.gitlab-ci.yml CHANGED
@@ -5,7 +5,7 @@ stages:
5
5
  - deploy
6
6
 
7
7
  default:
8
- image: ruby:2.7
8
+ image: ruby:3.0
9
9
  tags:
10
10
  - gitlab-org
11
11
  cache:
@@ -106,13 +106,6 @@ specs:
106
106
  script:
107
107
  - bundle exec rake spec
108
108
 
109
- specs ruby3.0:
110
- image: ruby:3.0
111
- needs: ["setup-test-env"]
112
- stage: test
113
- script:
114
- - bundle exec rake spec
115
-
116
109
  ##################
117
110
  ## Triage stage ##
118
111
  ##################
data/.rubocop.yml CHANGED
@@ -5,7 +5,8 @@ inherit_gem:
5
5
  - rubocop-default.yml
6
6
 
7
7
  AllCops:
8
- TargetRubyVersion: 2.7
8
+ NewCops: enable
9
+ TargetRubyVersion: 3.0
9
10
  Exclude:
10
11
  - 'vendor/**/*'
11
12
  - 'tmp/**/*'
@@ -14,7 +15,7 @@ AllCops:
14
15
  Rails/Output:
15
16
  Enabled: false
16
17
 
17
- Metrics/LineLength:
18
+ Layout/LineLength:
18
19
  Max: 152
19
20
 
20
21
  Style/SingleArgumentDig:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.4
1
+ 3.0.5
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.7.4
1
+ ruby 3.0.5
data/Gemfile CHANGED
@@ -12,4 +12,5 @@ end
12
12
  group :development, :test, :danger do
13
13
  gem 'gitlab-dangerfiles', '~> 2.11.0', require: false
14
14
  gem 'guard-rspec', '~> 4.7.3', require: false
15
+ gem 'lefthook', '~> 1.3', require: false
15
16
  end
data/README.md CHANGED
@@ -129,8 +129,8 @@ resource_rules:
129
129
  date:
130
130
  attribute: committed_date
131
131
  condition: older_than
132
- interval_type: 6
133
- interval: months
132
+ interval_type: months
133
+ interval: 6
134
134
  name: ^feature
135
135
  actions:
136
136
  delete: true
data/lefthook.yml ADDED
@@ -0,0 +1,14 @@
1
+ # Lefthook configuration. For more information, see:
2
+ # https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md
3
+
4
+ pre-push:
5
+ parallel: true
6
+ commands:
7
+ rubocop:
8
+ files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
9
+ glob: '*.{rb,rake}'
10
+ run: bundle exec rubocop {files}
11
+ rspec:
12
+ files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
13
+ glob: '*.{rb,rake}'
14
+ run: bundle exec rspec {files}
@@ -34,7 +34,7 @@ module Gitlab
34
34
 
35
35
  response = execute_with_retry(
36
36
  exception_types: [Net::ReadTimeout, Errors::Network::InternalServerError],
37
- backoff_exceptions: Errors::Network::TooManyRequests) do
37
+ backoff_exceptions: Errors::Network::TooManyRequests, debug: options.debug) do
38
38
  puts Gitlab::Triage::UI.debug "query_api: #{url}" if options.debug
39
39
 
40
40
  @adapter.get(token, url)
@@ -63,7 +63,7 @@ module Gitlab
63
63
  def post_api(url, body)
64
64
  response = execute_with_retry(
65
65
  exception_types: Net::ReadTimeout,
66
- backoff_exceptions: Errors::Network::TooManyRequests) do
66
+ backoff_exceptions: Errors::Network::TooManyRequests, debug: options.debug) do
67
67
  puts Gitlab::Triage::UI.debug "post_api: #{url}" if options.debug
68
68
 
69
69
  @adapter.post(token, url, body)
@@ -87,7 +87,7 @@ module Gitlab
87
87
  def delete_api(url)
88
88
  response = execute_with_retry(
89
89
  exception_types: Net::ReadTimeout,
90
- backoff_exceptions: Errors::Network::TooManyRequests) do
90
+ backoff_exceptions: Errors::Network::TooManyRequests, debug: options.debug) do
91
91
  puts Gitlab::Triage::UI.debug "delete_api: #{url}" if options.debug
92
92
 
93
93
  @adapter.delete(token, url)
@@ -2,23 +2,38 @@ module Gitlab
2
2
  module Triage
3
3
  module Retryable
4
4
  MAX_RETRIES = 3
5
+ RETRY_WAIT_SECONDS = 10
5
6
  BACK_OFF_SECONDS = 10
6
7
 
7
8
  attr_accessor :tries
8
9
 
9
- def execute_with_retry(exception_types: [StandardError], backoff_exceptions: [])
10
+ def execute_with_retry(exception_types: [StandardError], backoff_exceptions: [], debug: false)
10
11
  @tries = 0
11
12
 
12
13
  until maximum_retries_reached?
13
14
  begin
14
15
  @tries += 1
15
16
  return yield
16
- rescue *exception_types
17
- raise if maximum_retries_reached?
18
- rescue *backoff_exceptions
19
- raise if maximum_retries_reached?
17
+ rescue *exception_types => e
18
+ base_message = "exception - %s, waiting #{RETRY_WAIT_SECONDS} secs)"
20
19
 
21
- sleep(BACK_OFF_SECONDS)
20
+ if maximum_retries_reached?
21
+ puts_execute_with_retry_message(e, format(base_message, "gave up, tried #{MAX_RETRIES} times")) if debug
22
+ raise
23
+ else
24
+ puts_execute_with_retry_message(e, format(base_message, "retrying #{@tries}/#{MAX_RETRIES} times")) if debug
25
+ sleep(RETRY_WAIT_SECONDS)
26
+ end
27
+ rescue *backoff_exceptions => e
28
+ base_message = "backoff - %s, waiting #{BACK_OFF_SECONDS} secs)"
29
+
30
+ if maximum_retries_reached?
31
+ puts_execute_with_retry_message(e, format(base_message, "gave up, tried #{MAX_RETRIES} times")) if debug
32
+ raise
33
+ else
34
+ puts_execute_with_retry_message(e, format(base_message, "retrying #{@tries}/#{MAX_RETRIES} times")) if debug
35
+ sleep(BACK_OFF_SECONDS)
36
+ end
22
37
  end
23
38
  end
24
39
  end
@@ -28,6 +43,10 @@ module Gitlab
28
43
  def maximum_retries_reached?
29
44
  tries == MAX_RETRIES
30
45
  end
46
+
47
+ def puts_execute_with_retry_message(exception, message)
48
+ puts Gitlab::Triage::UI.debug "execute_with_retry: #{exception} (#{message}"
49
+ end
31
50
  end
32
51
  end
33
52
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Triage
5
- VERSION = '1.29.0'
5
+ VERSION = '1.30.0'
6
6
  end
7
7
  end
@@ -1,4 +1,4 @@
1
- image: ruby:2.7
1
+ image: ruby:3.0
2
2
 
3
3
  stages:
4
4
  - triage
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-triage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.29.0
4
+ version: 1.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-03 00:00:00.000000000 Z
11
+ date: 2023-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -166,6 +166,7 @@ files:
166
166
  - Rakefile
167
167
  - bin/gitlab-triage
168
168
  - gitlab-triage.gemspec
169
+ - lefthook.yml
169
170
  - lib/gitlab/triage.rb
170
171
  - lib/gitlab/triage/action.rb
171
172
  - lib/gitlab/triage/action/base.rb