pact_broker 2.93.0 → 2.93.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -0
- data/db/migrations/migration_helper.rb +1 -1
- data/lib/db.rb +1 -1
- data/lib/pact_broker/api/decorators/format_date_time.rb +9 -1
- data/lib/pact_broker/badges/service.rb +1 -1
- data/lib/pact_broker/build_http_options.rb +4 -12
- data/lib/pact_broker/certificates/service.rb +3 -3
- data/lib/pact_broker/config/runtime_configuration_database_methods.rb +1 -1
- data/lib/pact_broker/domain/webhook.rb +1 -1
- data/lib/pact_broker/domain/webhook_request.rb +2 -2
- data/lib/pact_broker/metrics/service.rb +1 -1
- data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +7 -5
- data/lib/pact_broker/pacts/selector.rb +4 -4
- data/lib/pact_broker/pacts/service.rb +3 -3
- data/lib/pact_broker/pacts/sort_content.rb +1 -1
- data/lib/pact_broker/repositories/helpers.rb +1 -1
- data/lib/pact_broker/ui/controllers/matrix.rb +1 -1
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/webhooks/execution_configuration.rb +8 -0
- data/lib/pact_broker/webhooks/execution_configuration_creator.rb +5 -0
- data/lib/pact_broker/webhooks/webhook_request_template.rb +4 -2
- data/lib/sequel/plugins/upsert.rb +1 -1
- data/vendor/hal-browser/browser.html +107 -87
- data/vendor/hal-browser/js/hal/http/client.js +1 -1
- data/vendor/hal-browser/js/hal/views/browser.js +1 -1
- data/vendor/hal-browser/js/hal/views/embedded_resource.js +2 -2
- data/vendor/hal-browser/js/hal/views/explorer.js +1 -1
- data/vendor/hal-browser/js/hal/views/inspector.js +1 -1
- data/vendor/hal-browser/login.html +8 -9
- data/vendor/hal-browser/styles.css +6 -9
- data/vendor/hal-browser/vendor/bootstrap-icons-1.7.2/bootstrap-icons.css +1556 -0
- data/vendor/hal-browser/vendor/bootstrap-icons-1.7.2/bootstrap-icons.json +1537 -0
- data/vendor/hal-browser/vendor/bootstrap-icons-1.7.2/bootstrap-icons.scss +3097 -0
- data/vendor/hal-browser/vendor/bootstrap-icons-1.7.2/file-text-fill.svg +3 -0
- data/vendor/hal-browser/vendor/bootstrap-icons-1.7.2/fonts/bootstrap-icons.woff +0 -0
- data/vendor/hal-browser/vendor/bootstrap-icons-1.7.2/fonts/bootstrap-icons.woff2 +0 -0
- data/vendor/hal-browser/vendor/css/bootstrap.css +8530 -4374
- data/vendor/hal-browser/vendor/js/URI.min.js +92 -83
- data/vendor/hal-browser/vendor/js/bootstrap.js +3825 -1745
- data/vendor/hal-browser/vendor/js/jquery-3.6.0.min.js +2 -0
- data/vendor/hal-browser/vendor/js/underscore.js +6 -1227
- metadata +13 -10
- data/vendor/hal-browser/vendor/css/bootstrap-responsive.css +0 -1109
- data/vendor/hal-browser/vendor/js/jquery-1.10.2.js +0 -9789
- data/vendor/hal-browser/vendor/js/jquery-1.10.2.min.js +0 -6
- data/vendor/hal-browser/vendor/js/jquery-1.10.2.min.map +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd8313de32ee72fbd7202e9279130983eeccf2d5bc9c6ae589a5ed9700854cbd
|
4
|
+
data.tar.gz: 8f7d311c9cbec69ca70f4a2420409e6c4747fcb0d1ae0f9af4d04baaf10aa43a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baaf854e49a5d623279b2481933fb9e033289efba9b4d9350703d9dc9737dac367b6076938f8f309426480f0745d9fe181c8f7f296f8727e17584de498ea631e
|
7
|
+
data.tar.gz: ea459192ee83bce3c4fe1c307ad8f2ab3c0ed2734f40162cef0ae95033b81d0e3e7bc12d2765af52ae4a06a95ddfed8dfdca7b0c421e923aaa2ba4a172552bcf
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,40 @@
|
|
1
|
+
<a name="v2.93.4"></a>
|
2
|
+
### v2.93.4 (2022-02-21)
|
3
|
+
|
4
|
+
#### Bug Fixes
|
5
|
+
|
6
|
+
* **matrix page**
|
7
|
+
* set correct base URL for links when a path is specified in the base URL ([8305456b](/../../commit/8305456b))
|
8
|
+
|
9
|
+
* handle DateTimes that come back from Sqlite as Strings ([1312a049](/../../commit/1312a049))
|
10
|
+
|
11
|
+
<a name="v2.93.3"></a>
|
12
|
+
### v2.93.3 (2022-02-02)
|
13
|
+
|
14
|
+
#### Bug Fixes
|
15
|
+
|
16
|
+
* ensure webhook_certificates setting is honoured in webhook ([7933a526](/../../commit/7933a526))
|
17
|
+
* ensure disable_ssl_verification setting is honoured in webhook ([08bc758c](/../../commit/08bc758c))
|
18
|
+
* ensure webhook_certificates setting is honoured in webhook ([8a720cdb](/../../commit/8a720cdb))
|
19
|
+
* ensure disable_ssl_verification setting is honoured in webhook ([0728b3d7](/../../commit/0728b3d7))
|
20
|
+
|
21
|
+
* **hal-browser**
|
22
|
+
* fixing vulnerability by upgrading HAL browser dependencies ([a6b06f66](/../../commit/a6b06f66))
|
23
|
+
|
24
|
+
<a name="v2.93.2"></a>
|
25
|
+
### v2.93.2 (2021-12-23)
|
26
|
+
|
27
|
+
#### Bug Fixes
|
28
|
+
|
29
|
+
* Improve SortContent performance on large contracts (#538) ([1914c01f](/../../commit/1914c01f))
|
30
|
+
|
31
|
+
<a name="v2.93.1"></a>
|
32
|
+
### v2.93.1 (2021-12-21)
|
33
|
+
|
34
|
+
#### Bug Fixes
|
35
|
+
|
36
|
+
* optimise query for calculating the latest overall pacts ([f44aaa70](/../../commit/f44aaa70))
|
37
|
+
|
1
38
|
<a name="v2.93.0"></a>
|
2
39
|
### v2.93.0 (2021-12-07)
|
3
40
|
|
data/lib/db.rb
CHANGED
@@ -2,8 +2,16 @@ module PactBroker
|
|
2
2
|
module Api
|
3
3
|
module Decorators
|
4
4
|
module FormatDateTime
|
5
|
+
# Keep this in sync with Sequel.datetime_class.
|
6
|
+
# Needs to be upgraded from DateTime to Time as Time is deprecated
|
7
|
+
DATE_TIME_CLASS = DateTime
|
8
|
+
|
5
9
|
def self.call(date_time)
|
6
|
-
|
10
|
+
if date_time.is_a?(String)
|
11
|
+
DATE_TIME_CLASS.strptime(date_time).to_time.utc.to_datetime.xmlschema
|
12
|
+
elsif date_time
|
13
|
+
date_time.to_time.utc.to_datetime.xmlschema if date_time
|
14
|
+
end
|
7
15
|
end
|
8
16
|
|
9
17
|
def format_date_time(date_time)
|
@@ -132,7 +132,7 @@ module PactBroker
|
|
132
132
|
with_cache uri do
|
133
133
|
request = Net::HTTP::Get.new(uri)
|
134
134
|
options = {read_timeout: 3, open_timeout: 1, ssl_timeout: 1, continue_timeout: 1}
|
135
|
-
options.merge! PactBroker::BuildHttpOptions.call(uri)
|
135
|
+
options.merge! PactBroker::BuildHttpOptions.call(uri, disable_ssl_verification: PactBroker.configuration.disable_ssl_verification)
|
136
136
|
|
137
137
|
Net::HTTP.start(uri.hostname, uri.port, :ENV, options) do |http|
|
138
138
|
http.request request
|
@@ -4,14 +4,14 @@ module PactBroker
|
|
4
4
|
class BuildHttpOptions
|
5
5
|
extend PactBroker::Services
|
6
6
|
|
7
|
-
def self.call
|
7
|
+
def self.call uri, disable_ssl_verification: false, cert_store: nil
|
8
8
|
uri = URI(uri)
|
9
9
|
options = {}
|
10
|
-
|
10
|
+
|
11
11
|
if uri.scheme == "https"
|
12
12
|
options[:use_ssl] = true
|
13
|
-
options[:cert_store] = cert_store
|
14
|
-
if disable_ssl_verification
|
13
|
+
options[:cert_store] = cert_store if cert_store
|
14
|
+
if disable_ssl_verification
|
15
15
|
options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE
|
16
16
|
else
|
17
17
|
options[:verify_mode] = OpenSSL::SSL::VERIFY_PEER
|
@@ -19,14 +19,6 @@ module PactBroker
|
|
19
19
|
end
|
20
20
|
options
|
21
21
|
end
|
22
|
-
|
23
|
-
def self.disable_ssl_verification?
|
24
|
-
PactBroker.configuration.disable_ssl_verification
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.cert_store
|
28
|
-
certificate_service.cert_store
|
29
|
-
end
|
30
22
|
end
|
31
23
|
end
|
32
24
|
|
@@ -15,7 +15,7 @@ module PactBroker
|
|
15
15
|
cert_store.set_default_paths
|
16
16
|
find_all_certificates.each do | certificate |
|
17
17
|
begin
|
18
|
-
logger.debug("Loading certificate #{certificate.subject} in to cert store")
|
18
|
+
logger.debug("Loading certificate for subject #{certificate.subject} and issuer #{certificate.issuer} in to cert store")
|
19
19
|
cert_store.add_cert(certificate)
|
20
20
|
rescue StandardError => e
|
21
21
|
logger.warn("Error adding certificate object #{certificate} to store", e)
|
@@ -42,7 +42,7 @@ module PactBroker
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def certificates_from_config
|
45
|
-
PactBroker.configuration.webhook_certificates.select{| c| c[:content] || c[:path] }.collect do | certificate_config, i |
|
45
|
+
PactBroker.configuration.webhook_certificates.select{| c| c[:content] || c[:path] }.collect.with_index do | certificate_config, i |
|
46
46
|
load_certificate_config(certificate_config, i)
|
47
47
|
end.flatten.compact
|
48
48
|
end
|
@@ -54,7 +54,7 @@ module PactBroker
|
|
54
54
|
begin
|
55
55
|
OpenSSL::X509::Certificate.new(c)
|
56
56
|
rescue StandardError => e
|
57
|
-
logger.warn("Error creating certificate object from
|
57
|
+
logger.warn("Error creating certificate object from webhook_certificates at index #{i} with description #{certificate_config[:description]}", e)
|
58
58
|
nil
|
59
59
|
end
|
60
60
|
end
|
@@ -50,7 +50,7 @@ module PactBroker
|
|
50
50
|
def execute pact, verification, event_context, options
|
51
51
|
logger.info "Executing #{self} event_context=#{event_context}"
|
52
52
|
template_params = template_parameters(pact, verification, event_context, options)
|
53
|
-
webhook_request = request.build(template_params, options.
|
53
|
+
webhook_request = request.build(template_params, options.slice(:user_agent, :disable_ssl_verification, :cert_store))
|
54
54
|
http_response, error = execute_request(webhook_request)
|
55
55
|
success = success?(http_response, options)
|
56
56
|
http_request = webhook_request.http_request
|
@@ -18,7 +18,7 @@ module PactBroker
|
|
18
18
|
|
19
19
|
HEADERS_TO_REDACT = [/authorization/i, /token/i]
|
20
20
|
|
21
|
-
attr_accessor :method, :url, :headers, :body, :username, :password, :uuid, :user_agent
|
21
|
+
attr_accessor :method, :url, :headers, :body, :username, :password, :uuid, :user_agent, :disable_ssl_verification, :cert_store
|
22
22
|
|
23
23
|
# Reform gets confused by the :method method, as :method is a standard
|
24
24
|
# Ruby method.
|
@@ -47,7 +47,7 @@ module PactBroker
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def execute
|
50
|
-
options = PactBroker::BuildHttpOptions.call(uri).merge(read_timeout: 15, open_timeout: 15)
|
50
|
+
options = PactBroker::BuildHttpOptions.call(uri, disable_ssl_verification: disable_ssl_verification, cert_store: cert_store).merge(read_timeout: 15, open_timeout: 15)
|
51
51
|
req = http_request
|
52
52
|
Net::HTTP.start(uri.hostname, uri.port, :ENV, options) do |http|
|
53
53
|
http.request req
|
@@ -18,7 +18,7 @@ module PactBroker
|
|
18
18
|
withMainBranchSetCount: PactBroker::Domain::Pacticipant.with_main_branch_set.count
|
19
19
|
},
|
20
20
|
integrations: {
|
21
|
-
count: PactBroker::
|
21
|
+
count: PactBroker::Pacts::PactPublication.select(:consumer_id, :provider_id).distinct.count
|
22
22
|
},
|
23
23
|
pactPublications: {
|
24
24
|
count: PactBroker::Pacts::PactPublication.count,
|
@@ -90,16 +90,18 @@ module PactBroker
|
|
90
90
|
def overall_latest
|
91
91
|
self_join = {
|
92
92
|
Sequel[:pact_publications][:consumer_id] => Sequel[:pp2][:consumer_id],
|
93
|
-
Sequel[:pact_publications][:provider_id] => Sequel[:pp2][:provider_id]
|
93
|
+
Sequel[:pact_publications][:provider_id] => Sequel[:pp2][:provider_id],
|
94
|
+
Sequel[:pact_publications][:consumer_version_order] => Sequel[:pp2][:max_consumer_version_order]
|
94
95
|
}
|
95
96
|
|
96
97
|
base_query = self
|
97
98
|
base_query = base_query.select_all_qualified if no_columns_selected?
|
98
99
|
|
99
|
-
base_query.
|
100
|
-
|
101
|
-
|
102
|
-
|
100
|
+
base_query.join(
|
101
|
+
base_query.select_group(:consumer_id, :provider_id).select_append{ max(:consumer_version_order).as(:max_consumer_version_order) },
|
102
|
+
self_join,
|
103
|
+
table_alias: :pp2
|
104
|
+
)
|
103
105
|
.remove_overridden_revisions_from_complete_query
|
104
106
|
end
|
105
107
|
|
@@ -283,8 +283,6 @@ module PactBroker
|
|
283
283
|
|
284
284
|
# rubocop: disable Metrics/CyclomaticComplexity
|
285
285
|
def <=> other
|
286
|
-
# elsif consumer || other.consumer
|
287
|
-
# consumer_comparison(other)
|
288
286
|
if overall_latest? || other.overall_latest?
|
289
287
|
overall_latest_comparison(other)
|
290
288
|
elsif latest_for_branch? || other.latest_for_branch?
|
@@ -297,6 +295,8 @@ module PactBroker
|
|
297
295
|
currently_deployed_comparison(other)
|
298
296
|
elsif currently_supported? || other.currently_supported?
|
299
297
|
currently_supported_comparison(other)
|
298
|
+
elsif consumer || other.consumer
|
299
|
+
consumer_comparison(other)
|
300
300
|
else
|
301
301
|
0
|
302
302
|
end
|
@@ -358,8 +358,8 @@ module PactBroker
|
|
358
358
|
end
|
359
359
|
|
360
360
|
def consumer_comparison(other)
|
361
|
-
if consumer
|
362
|
-
|
361
|
+
if consumer && other.consumer
|
362
|
+
consumer <=> other.consumer
|
363
363
|
else
|
364
364
|
consumer ? -1 : 1
|
365
365
|
end
|
@@ -43,7 +43,7 @@ module PactBroker
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def delete params
|
46
|
-
logger.info "Deleting pact version
|
46
|
+
logger.info "Deleting pact version", payload: params
|
47
47
|
pacts = pact_repository.find_all_revisions(params[:consumer_name], params[:consumer_version_number], params[:provider_name])
|
48
48
|
webhook_service.delete_all_webhook_related_objects_by_pact_publication_ids(pacts.collect(&:id))
|
49
49
|
pact_repository.delete(params)
|
@@ -156,7 +156,7 @@ module PactBroker
|
|
156
156
|
|
157
157
|
# Overwriting an existing pact with the same consumer/provider/consumer version number
|
158
158
|
def create_pact_revision params, existing_pact
|
159
|
-
logger.info "Updating existing pact publication", payload: params.
|
159
|
+
logger.info "Updating existing pact publication", payload: params.without(:json_content)
|
160
160
|
logger.debug "Content #{params[:json_content]}"
|
161
161
|
pact_version_sha = generate_sha(params[:json_content])
|
162
162
|
json_content = add_interaction_ids(params[:json_content])
|
@@ -185,7 +185,7 @@ module PactBroker
|
|
185
185
|
|
186
186
|
# When no publication for the given consumer/provider/consumer version number exists
|
187
187
|
def create_pact params, version, provider
|
188
|
-
logger.info "Creating new pact publication
|
188
|
+
logger.info "Creating new pact publication", payload: params.without(:json_content)
|
189
189
|
logger.debug "Content #{params[:json_content]}"
|
190
190
|
pact_version_sha = generate_sha(params[:json_content])
|
191
191
|
json_content = add_interaction_ids(params[:json_content])
|
@@ -34,7 +34,7 @@ module PactBroker
|
|
34
34
|
# You never can tell what people will do...
|
35
35
|
if probably_array.is_a?(Array)
|
36
36
|
array_with_ordered_hashes = order_hash_keys(probably_array)
|
37
|
-
array_with_ordered_hashes.
|
37
|
+
array_with_ordered_hashes.sort_by(&:to_json)
|
38
38
|
else
|
39
39
|
probably_array
|
40
40
|
end
|
@@ -32,7 +32,7 @@ module PactBroker
|
|
32
32
|
errors = matrix_service.validate_selectors(selectors, options)
|
33
33
|
if errors.empty?
|
34
34
|
lines = matrix_service.find(selectors, options)
|
35
|
-
locals[:lines] = PactBroker::UI::ViewDomain::MatrixLines.new(lines)
|
35
|
+
locals[:lines] = PactBroker::UI::ViewDomain::MatrixLines.new(lines, base_url: base_url)
|
36
36
|
locals[:badge_url] = matrix_badge_url(selectors, lines, base_url)
|
37
37
|
else
|
38
38
|
locals[:errors] = errors
|
data/lib/pact_broker/version.rb
CHANGED
@@ -41,6 +41,14 @@ module PactBroker
|
|
41
41
|
with_updated_attribute(user_agent: value)
|
42
42
|
end
|
43
43
|
|
44
|
+
def with_disable_ssl_verification(value)
|
45
|
+
with_updated_attribute(disable_ssl_verification: value)
|
46
|
+
end
|
47
|
+
|
48
|
+
def with_cert_store(value)
|
49
|
+
with_updated_attribute(cert_store: value)
|
50
|
+
end
|
51
|
+
|
44
52
|
def webhook_context
|
45
53
|
self[:webhook_context]
|
46
54
|
end
|
@@ -1,15 +1,20 @@
|
|
1
1
|
require "pact_broker/configuration"
|
2
|
+
require "pact_broker/services"
|
2
3
|
require "pact_broker/webhooks/execution_configuration"
|
3
4
|
|
4
5
|
module PactBroker
|
5
6
|
module Webhooks
|
6
7
|
class ExecutionConfigurationCreator
|
8
|
+
extend PactBroker::Services
|
9
|
+
|
7
10
|
def self.call(resource)
|
8
11
|
PactBroker::Webhooks::ExecutionConfiguration.new
|
9
12
|
.with_show_response(PactBroker.configuration.show_webhook_response?)
|
10
13
|
.with_retry_schedule(PactBroker.configuration.webhook_retry_schedule)
|
11
14
|
.with_http_success_codes(PactBroker.configuration.webhook_http_code_success)
|
12
15
|
.with_user_agent(PactBroker.configuration.user_agent)
|
16
|
+
.with_disable_ssl_verification(PactBroker.configuration.disable_ssl_verification)
|
17
|
+
.with_cert_store(certificate_service.cert_store)
|
13
18
|
.with_webhook_context(base_url: resource.base_url)
|
14
19
|
end
|
15
20
|
end
|
@@ -27,7 +27,7 @@ module PactBroker
|
|
27
27
|
@headers = Rack::Utils::HeaderHash.new(attributes[:headers] || {})
|
28
28
|
end
|
29
29
|
|
30
|
-
def build(template_params, user_agent)
|
30
|
+
def build(template_params, user_agent: nil, disable_ssl_verification: false, cert_store: nil)
|
31
31
|
attributes = {
|
32
32
|
method: http_method,
|
33
33
|
url: build_url(template_params),
|
@@ -36,7 +36,9 @@ module PactBroker
|
|
36
36
|
password: build_string(password, template_params),
|
37
37
|
uuid: uuid,
|
38
38
|
body: build_body(template_params),
|
39
|
-
user_agent: user_agent
|
39
|
+
user_agent: user_agent,
|
40
|
+
disable_ssl_verification: disable_ssl_verification,
|
41
|
+
cert_store: cert_store
|
40
42
|
}
|
41
43
|
PactBroker::Domain::WebhookRequest.new(attributes)
|
42
44
|
end
|