gitlab-triage 1.29.0 → 1.30.0
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 +4 -4
- 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 -3
- 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: e51bca620fb9d9638c96605f214f4420f1bd6d2ec2b3142e8d4ee1df35d324bf
|
4
|
+
data.tar.gz: 853652c543b2432f9d0bb5ef82515c312d536d6b550a9f2c234958335b0d9437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
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)
|
@@ -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
|
-
|
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.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-
|
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
|