gitlab-triage 1.29.0 → 1.40.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab/CODEOWNERS +1 -1
- data/.gitlab-ci.yml +1 -8
- data/.rubocop.yml +3 -2
- data/.ruby-version +1 -1
- data/.tool-versions +1 -1
- data/Gemfile +1 -0
- data/README.md +2 -2
- data/lefthook.yml +14 -0
- data/lib/gitlab/triage/rest_api_network.rb +3 -9
- data/lib/gitlab/triage/retryable.rb +25 -6
- data/lib/gitlab/triage/version.rb +1 -1
- data/support/.gitlab-ci.example.yml +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfdea1ee1028eae3c0856a944bf0b1c4c6888868256f0b7cd9db1e8a76be5834
|
4
|
+
data.tar.gz: e62f0fba823a7cbcee083a8e95041c1adb20f014f82dcd111648f5d5560922cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a418d3df3aa5db3b89521404bcd77b7a5e4ab40b8b0063e56e11f78e8297ba7e2637ec9ef62ccbce08cf3cde4bfd1e562b043727e7a8442bf2c8e9d45a50c6f3
|
7
|
+
data.tar.gz: 44fad5107f9ad6ad62519da34fb56ae9518a1f652cbe6ccf6e6fd3d0d07b83e98106bc1235482fff05151deb06507d75d74aa82d9f117b0af72ce3f0763f967e
|
data/.gitlab/CODEOWNERS
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# The official maintainers
|
2
|
-
* @
|
2
|
+
* @gl-quality/eng-prod
|
data/.gitlab-ci.yml
CHANGED
@@ -5,7 +5,7 @@ stages:
|
|
5
5
|
- deploy
|
6
6
|
|
7
7
|
default:
|
8
|
-
image: ruby:
|
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
|
-
|
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
|
-
|
18
|
+
Layout/LineLength:
|
18
19
|
Max: 152
|
19
20
|
|
20
21
|
Style/SingleArgumentDig:
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.5
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby
|
1
|
+
ruby 3.0.5
|
data/Gemfile
CHANGED
data/README.md
CHANGED
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)
|
@@ -56,14 +56,12 @@ module Gitlab
|
|
56
56
|
end while response.delete(:more_pages)
|
57
57
|
|
58
58
|
resources.map!(&:with_indifferent_access)
|
59
|
-
rescue Net::ReadTimeout
|
60
|
-
[]
|
61
59
|
end
|
62
60
|
|
63
61
|
def post_api(url, body)
|
64
62
|
response = execute_with_retry(
|
65
63
|
exception_types: Net::ReadTimeout,
|
66
|
-
backoff_exceptions: Errors::Network::TooManyRequests) do
|
64
|
+
backoff_exceptions: Errors::Network::TooManyRequests, debug: options.debug) do
|
67
65
|
puts Gitlab::Triage::UI.debug "post_api: #{url}" if options.debug
|
68
66
|
|
69
67
|
@adapter.post(token, url, body)
|
@@ -80,14 +78,12 @@ module Gitlab
|
|
80
78
|
else
|
81
79
|
raise_unexpected_response(results)
|
82
80
|
end
|
83
|
-
rescue Net::ReadTimeout
|
84
|
-
{}
|
85
81
|
end
|
86
82
|
|
87
83
|
def delete_api(url)
|
88
84
|
response = execute_with_retry(
|
89
85
|
exception_types: Net::ReadTimeout,
|
90
|
-
backoff_exceptions: Errors::Network::TooManyRequests) do
|
86
|
+
backoff_exceptions: Errors::Network::TooManyRequests, debug: options.debug) do
|
91
87
|
puts Gitlab::Triage::UI.debug "delete_api: #{url}" if options.debug
|
92
88
|
|
93
89
|
@adapter.delete(token, url)
|
@@ -95,8 +91,6 @@ module Gitlab
|
|
95
91
|
|
96
92
|
rate_limit_debug(response) if options.debug
|
97
93
|
rate_limit_wait(response)
|
98
|
-
rescue Net::ReadTimeout
|
99
|
-
{}
|
100
94
|
end
|
101
95
|
|
102
96
|
private
|
@@ -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
|
-
|
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
|
-
|
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
|
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.
|
4
|
+
version: 1.40.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-
|
11
|
+
date: 2023-03-30 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
|