buildkit 1.4.2 → 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +4 -7
- data/Gemfile +2 -2
- data/buildkit.gemspec +1 -1
- data/lib/buildkit/client.rb +8 -2
- data/lib/buildkit/error.rb +14 -9
- data/lib/buildkit/version.rb +1 -1
- data/lib/buildkit.rb +5 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03b8e45ebac5e4d266640db473fa71aba8cb6c9a819b5e760c6e728053294463
|
4
|
+
data.tar.gz: 5f37ba01f369f0e679ed389f7d1cdf6c79151a01d4c74f2a23b51d46a864963b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8225bf1b1508e2ac4d995f6c7e321c5495022441befe47934d3530f88d358073eb25a9779a850d22af0875f327d18fd06e4ffaf8f3c954f3ef14951023a11356
|
7
|
+
data.tar.gz: 6d4f3ab03f90c4f1314288454f377aaaea7bdb119ae6be91b1f20ed79679a0e10f152f9ce51a8e68f6988dec2f917b34ef1cd0a41dfddcabcd4cd7bcce68cfe4
|
data/.github/workflows/ci.yml
CHANGED
@@ -3,19 +3,16 @@ name: Test Buildkit Gem
|
|
3
3
|
|
4
4
|
jobs:
|
5
5
|
build:
|
6
|
-
runs-on: ubuntu-
|
6
|
+
runs-on: ubuntu-latest
|
7
7
|
strategy:
|
8
8
|
matrix:
|
9
|
-
ruby: [ '2.5', '2.6', '2.7' ]
|
9
|
+
ruby: [ '2.5', '2.6', '2.7', '3.0', '3.1' ]
|
10
10
|
name: Ruby ${{ matrix.ruby }}
|
11
11
|
steps:
|
12
12
|
- uses: actions/checkout@v2
|
13
|
-
- uses:
|
13
|
+
- uses: ruby/setup-ruby@v1
|
14
14
|
with:
|
15
15
|
ruby-version: ${{ matrix.ruby }}
|
16
|
-
|
17
|
-
run: |
|
18
|
-
gem install bundler
|
19
|
-
bundle install --jobs 4 --retry 3
|
16
|
+
bundler-cache: true # 'bundle install' and cache
|
20
17
|
- name: Run rspec
|
21
18
|
run: 'bundle exec rspec spec'
|
data/Gemfile
CHANGED
@@ -4,12 +4,12 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
gem 'byebug'
|
6
6
|
gem 'rake'
|
7
|
-
gem 'rubocop'
|
8
7
|
gem 'yard'
|
9
8
|
|
10
9
|
group :test do
|
11
10
|
gem 'rspec', '~> 3.2'
|
12
|
-
gem '
|
11
|
+
gem 'rubocop', '~> 0.81.0'
|
12
|
+
gem 'vcr', '~> 3.0'
|
13
13
|
end
|
14
14
|
|
15
15
|
gemspec
|
data/buildkit.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.metadata['allowed_push_host'] =
|
22
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
23
23
|
|
24
24
|
spec.required_ruby_version = '>= 2.3'
|
25
25
|
|
data/lib/buildkit/client.rb
CHANGED
@@ -147,10 +147,12 @@ module Buildkit
|
|
147
147
|
|
148
148
|
response.concat @last_response.data
|
149
149
|
|
150
|
+
break if @last_response.headers[:link].nil?
|
150
151
|
link_header = parse_link_header(@last_response.headers[:link])
|
151
152
|
break if link_header[:next].nil?
|
152
153
|
|
153
|
-
|
154
|
+
unescaped_next = CGI.unescape(link_header[:next])
|
155
|
+
path = next_page(unescaped_next)
|
154
156
|
end
|
155
157
|
response
|
156
158
|
end
|
@@ -168,7 +170,11 @@ module Buildkit
|
|
168
170
|
http.headers[:accept] = 'application/json'
|
169
171
|
http.headers[:content_type] = 'application/json'
|
170
172
|
http.headers[:user_agent] = "Buildkit v#{Buildkit::VERSION}"
|
171
|
-
|
173
|
+
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new("1.7.1")
|
174
|
+
http.request :authorization, 'Bearer', @token
|
175
|
+
else
|
176
|
+
http.authorization 'Bearer', @token
|
177
|
+
end
|
172
178
|
end
|
173
179
|
end
|
174
180
|
|
data/lib/buildkit/error.rb
CHANGED
@@ -89,26 +89,31 @@ module Buildkit
|
|
89
89
|
def response_error_summary
|
90
90
|
return nil unless data.is_a?(Hash) && !Array(data[:errors]).empty?
|
91
91
|
|
92
|
-
|
93
|
-
summary << data[:errors].map do |hash|
|
92
|
+
errors = data[:errors].map do |hash|
|
94
93
|
hash.map { |k, v| " #{k}: #{v}" }
|
95
|
-
end
|
94
|
+
end
|
96
95
|
|
97
|
-
|
96
|
+
<<~MSG.chomp
|
97
|
+
Error summary:
|
98
|
+
#{errors.join("\n")}
|
99
|
+
MSG
|
98
100
|
end
|
99
101
|
|
100
102
|
def build_error_message
|
101
103
|
return nil if @response.nil?
|
102
104
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
105
|
+
documentation_text = ''
|
106
|
+
documentation_text = "// See: #{documentation_url}" if documentation_url
|
107
|
+
|
108
|
+
<<~MSG.strip
|
109
|
+
#{@response[:method].to_s.upcase} #{redact_url(@response[:url].to_s)}: #{@response[:status]} - #{response_message}#{response_error}#{response_error_summary}
|
110
|
+
#{documentation_text}
|
111
|
+
MSG
|
107
112
|
end
|
108
113
|
|
109
114
|
def redact_url(url_string)
|
110
115
|
%w[client_secret access_token].each do |token|
|
111
|
-
url_string.gsub
|
116
|
+
url_string = url_string.gsub(/#{token}=\S+/, "#{token}=(redacted)") if url_string.include? token
|
112
117
|
end
|
113
118
|
url_string
|
114
119
|
end
|
data/lib/buildkit/version.rb
CHANGED
data/lib/buildkit.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sawyer
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
93
|
+
rubygems_version: 3.2.20
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Ruby toolkit for working with the Buildkite API
|