Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.3
TargetRubyVersion: 2.7

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auf unseren Hosts läuft doch 2.7, oder sehe ich das falsch?


Lint/RaiseException:
Enabled: true
Expand Down
75 changes: 39 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,72 +1,75 @@
PATH
remote: .
specs:
quayio-scanner (0.3.2)
docker-api (~> 1.33)
quayio-scanner (0.4.0)
docker-api (~> 2.4)
rest-client (~> 2.1)
sensu-plugin (~> 4.0)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
diff-lcs (1.5.0)
docker-api (1.34.2)
excon (>= 0.47.0)
diff-lcs (1.5.1)
docker-api (2.4.0)
excon (>= 0.64.0)
multi_json
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
excon (0.92.3)
domain_name (0.6.20240107)
excon (1.2.3)
http-accept (1.7.0)
http-cookie (1.0.5)
http-cookie (1.0.8)
domain_name (~> 0.5)
jaro_winkler (1.5.4)
json (2.6.2)
mime-types (3.4.1)
json (2.9.1)
logger (1.6.5)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mime-types-data (3.2025.0204)
mixlib-cli (1.7.0)
multi_json (1.15.0)
netrc (0.11.0)
parallel (1.22.1)
parser (3.1.2.0)
parallel (1.26.3)
parser (3.3.7.1)
ast (~> 2.4.1)
racc
racc (1.8.1)
rainbow (3.1.1)
rake (13.0.6)
rake (13.2.1)
regexp_parser (2.10.0)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
rexml (3.4.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.3)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.1)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (0.81.0)
jaro_winkler (~> 1.5.1)
rspec-support (~> 3.13.0)
rspec-support (3.13.2)
rubocop (0.93.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8)
rexml
rubocop-ast (>= 0.6.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
ruby-progressbar (1.11.0)
rubocop-ast (1.38.0)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
sensu-plugin (4.0.0)
json (< 3.0.0)
mixlib-cli (~> 1.5)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)

PLATFORMS
Expand All @@ -77,7 +80,7 @@ DEPENDENCIES
quayio-scanner!
rake (~> 13.0)
rspec (~> 3.7)
rubocop (~> 0.49, <= 0.81)
rubocop (~> 0.93)

BUNDLED WITH
2.1.4
30 changes: 14 additions & 16 deletions lib/quayio/scanner/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,20 @@ def fetch_manifest_ref

def api_call(uri)
(1..Float::INFINITY).each do |attempt|
begin
response = RestClient.get(
"https://quay.io/api/v1/repository/#{org}/#{repo}#{uri}",
authorization: "Bearer #{quayio_token}",
accept: :json,
open_timeout: 15
)
return JSON.parse(response)
rescue RestClient::Exception => e
raise e if attempt >= MAX_ATTEMPTS

# retry later, if we hit cdn rate limiting or on connection errors
raise e unless e.http_code == 520 || e.http_code.nil?

sleep(rand(10))
end
response = RestClient.get(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rubocop wollte das so ..

"https://quay.io/api/v1/repository/#{org}/#{repo}#{uri}",
authorization: "Bearer #{quayio_token}",
accept: :json,
open_timeout: 15
)
return JSON.parse(response)
rescue RestClient::Exception => e
raise e if attempt >= MAX_ATTEMPTS

# retry later, if we hit cdn rate limiting or on connection errors
raise e unless e.http_code == 520 || e.http_code.nil?

sleep(rand(10))
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions quayio-scanner.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ Gem::Specification.new do |spec|
spec.homepage = 'https://github.com/aboutsource/quayio-scanner'
spec.license = 'MIT'

spec.required_ruby_version = '>= 2.3.0'
spec.required_ruby_version = '>= 2.7.0'

spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.executables = Dir.glob('bin/**/*.rb').map { |f| File.basename(f) }
spec.require_paths = ['lib']

spec.add_dependency 'docker-api', '~> 1.33'
spec.add_dependency 'docker-api', '~> 2.4'
spec.add_dependency 'rest-client', '~> 2.1'
spec.add_dependency 'sensu-plugin', '~> 4.0'
spec.add_development_dependency 'bundler', '~> 2.1'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec', '~> 3.7'
spec.add_development_dependency 'rubocop', '~> 0.49', '<= 0.81'
spec.add_development_dependency 'rubocop', '~> 0.93'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das musste ich hochziehen, weil ich die 0.81 in meinem rbenv ruby 2.7 setup nicht mehr installieren konnte. Mit 0.93 gabs aber keine Probleme.

end