pact_broker 2.95.1 → 2.96.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/pact_broker/config/basic_auth_configuration.rb +7 -0
- data/lib/pact_broker/config/runtime_configuration_database_methods.rb +5 -0
- data/lib/pact_broker/config/runtime_configuration_logging_methods.rb +8 -2
- data/lib/pact_broker/configuration.rb +0 -12
- data/lib/pact_broker/index/service.rb +1 -1
- data/lib/pact_broker/pacts/lazy_loaders.rb +26 -0
- data/lib/pact_broker/pacts/pact_publication.rb +4 -28
- data/lib/pact_broker/pacts/repository.rb +4 -2
- data/lib/pact_broker/repositories/helpers.rb +4 -0
- data/lib/pact_broker/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e08b2792c380c3066af4817bc219cc3dc134860b2769a6608e3d625269d53f7d
|
4
|
+
data.tar.gz: be1cefe3b370f3b227bff1330af71dd5a0adcfd609a7ae4fd1d1b144c76fe7a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24dbb88676eb61e1e5809b54ef9cb6cae4d33093beefbe1e9140c0e43f68561aa0ef765cc176e5da04415964410dbc4f18b2393f6426a2b40dbf0826d86a5ff4
|
7
|
+
data.tar.gz: d3fdd055d91ba7b563b258c49fb666a17518432a72c8faa818ffc5dfd2c20a6095c82390ccc71c5c1f1a888e8aa7319d530d0d6c3fefe83170a5fab4320f724d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
<a name="v2.96.0"></a>
|
2
|
+
### v2.96.0 (2022-03-21)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* print final value of configuration attribute rather than source value ([9c0fd3c4](/../../commit/9c0fd3c4))
|
7
|
+
|
8
|
+
#### Bug Fixes
|
9
|
+
|
10
|
+
* ensure database and basic auth credentials are not coerced to arrays if they contain commas ([5bce7ce4](/../../commit/5bce7ce4))
|
11
|
+
* allow lazy loading when finding individual pacts ([04e03cb2](/../../commit/04e03cb2))
|
12
|
+
|
1
13
|
<a name="v2.95.1"></a>
|
2
14
|
### v2.95.1 (2022-03-18)
|
3
15
|
|
@@ -20,6 +20,13 @@ module PactBroker
|
|
20
20
|
|
21
21
|
sensitive_values(:basic_auth_password, :basic_auth_read_only_password)
|
22
22
|
|
23
|
+
coerce_types(
|
24
|
+
basic_auth_username: :string,
|
25
|
+
basic_auth_password: :string,
|
26
|
+
basic_auth_read_only_username: :string,
|
27
|
+
basic_auth_read_only_password: :string
|
28
|
+
)
|
29
|
+
|
23
30
|
def basic_auth_credentials_provided?
|
24
31
|
basic_auth_username&.not_blank? && basic_auth_password&.not_blank?
|
25
32
|
end
|
@@ -1,8 +1,11 @@
|
|
1
1
|
require "uri"
|
2
|
+
require "pact_broker/hash_refinements"
|
2
3
|
|
3
4
|
module PactBroker
|
4
5
|
module Config
|
5
6
|
module RuntimeConfigurationLoggingMethods
|
7
|
+
using PactBroker::HashRefinements
|
8
|
+
|
6
9
|
module ClassMethods
|
7
10
|
def sensitive_values(*values)
|
8
11
|
@sensitive_values ||= []
|
@@ -19,8 +22,11 @@ module PactBroker
|
|
19
22
|
end
|
20
23
|
|
21
24
|
module InstanceMethods
|
25
|
+
# base_url raises a not implemented error
|
22
26
|
def log_configuration(logger)
|
23
|
-
to_source_trace.
|
27
|
+
to_source_trace.without("base_url").each_with_object({})do | (key, details), new_hash |
|
28
|
+
new_hash[key] = details.merge(value: self.send(key.to_sym))
|
29
|
+
end.sort_by { |key, _| key }.each { |key, value| log_config_inner(key, value, logger) }
|
24
30
|
end
|
25
31
|
|
26
32
|
def log_config_inner(key, value, logger)
|
@@ -29,7 +35,7 @@ module PactBroker
|
|
29
35
|
elsif self.class.sensitive_value?(key)
|
30
36
|
logger.info "#{key}=#{redact(key, value[:value])} source=#{value[:source]}"
|
31
37
|
else
|
32
|
-
logger.info "#{key}=#{value[:value]} source=#{value[:source]}"
|
38
|
+
logger.info "#{key}=#{value[:value].inspect} source=#{value[:source]}"
|
33
39
|
end
|
34
40
|
end
|
35
41
|
private :log_config_inner
|
@@ -15,10 +15,6 @@ module PactBroker
|
|
15
15
|
RequestStore.store[:pact_broker_configuration] = configuration
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.with_runtime_configuration_overrides(overrides, &block)
|
19
|
-
self.configuration.with_runtime_configuration_overrides(overrides, &block)
|
20
|
-
end
|
21
|
-
|
22
18
|
# @private, for testing only
|
23
19
|
def self.reset_configuration
|
24
20
|
RequestStore.store[:pact_broker_configuration] = Configuration.default_configuration
|
@@ -82,14 +78,6 @@ module PactBroker
|
|
82
78
|
config
|
83
79
|
end
|
84
80
|
|
85
|
-
def with_runtime_configuration_overrides(overrides)
|
86
|
-
original_runtime_configuration = runtime_configuration
|
87
|
-
self.runtime_configuration = override_runtime_configuration!(overrides)
|
88
|
-
yield
|
89
|
-
ensure
|
90
|
-
self.runtime_configuration = original_runtime_configuration
|
91
|
-
end
|
92
|
-
|
93
81
|
def override_runtime_configuration!(overrides)
|
94
82
|
new_runtime_configuration = runtime_configuration.dup
|
95
83
|
valid_overrides = {}
|
@@ -108,7 +108,7 @@ module PactBroker
|
|
108
108
|
# rubocop: disable Metrics/CyclomaticComplexity
|
109
109
|
def self.latest_verification_for_pseudo_branch(pact_publication, is_overall_latest, latest_verifications_for_cv_tags, tags_option, options)
|
110
110
|
if options[:view] == "branch" || (options[:view] == "all" && pact_publication.consumer_version.branch_heads.any?)
|
111
|
-
pact_publication.latest_verification || pact_publication.latest_verification_for_consumer_branches
|
111
|
+
pact_publication.latest_verification || pact_publication.latest_verification_for_consumer_branches
|
112
112
|
elsif tags_option == true
|
113
113
|
latest_verifications_for_cv_tags
|
114
114
|
.select{ | v | v.consumer_id == pact_publication.consumer_id && v.provider_id == pact_publication.provider_id && pact_publication.head_pact_tags.collect(&:name).include?(v.consumer_version_tag_name) }
|
@@ -9,6 +9,32 @@ module PactBroker
|
|
9
9
|
.latest_for_consumer_tag(consumer_version_tag_names)
|
10
10
|
.from_self.order_by(:tag_name)
|
11
11
|
}
|
12
|
+
|
13
|
+
LATEST_VERIFICATION_FOR_CONSUMER_BRANCHES = lambda {
|
14
|
+
bv_pp_join = {
|
15
|
+
Sequel[:branch_versions][:version_id] => Sequel[:pact_publications][:consumer_version_id],
|
16
|
+
Sequel[:pact_publications][:provider_id] => provider_id
|
17
|
+
}
|
18
|
+
|
19
|
+
verifications_join = {
|
20
|
+
Sequel[:verifications][:pact_version_id] => Sequel[:pact_publications][:pact_version_id]
|
21
|
+
}
|
22
|
+
|
23
|
+
branch_ids = PactBroker::Versions::BranchVersion
|
24
|
+
.select(:branch_id)
|
25
|
+
.where(version_id: consumer_version_id)
|
26
|
+
|
27
|
+
|
28
|
+
latest_verification_id = PactBroker::Versions::BranchVersion
|
29
|
+
.select(Sequel[:verifications][:id])
|
30
|
+
.where(Sequel[:branch_versions][:branch_id] => branch_ids)
|
31
|
+
.join(:pact_publications, bv_pp_join)
|
32
|
+
.join(:verifications, verifications_join)
|
33
|
+
.order(Sequel.desc(Sequel[:verifications][:id]))
|
34
|
+
.limit(1)
|
35
|
+
|
36
|
+
PactBroker::Domain::Verification.where(id: latest_verification_id)
|
37
|
+
}
|
12
38
|
end
|
13
39
|
end
|
14
40
|
end
|
@@ -34,43 +34,19 @@ module PactBroker
|
|
34
34
|
read_only: true,
|
35
35
|
key: :id,
|
36
36
|
primary_key: :id,
|
37
|
-
|
38
|
-
|
39
|
-
bv_pp_join = {
|
40
|
-
Sequel[:branch_versions][:version_id] => Sequel[:pact_publications][:consumer_version_id],
|
41
|
-
Sequel[:pact_publications][:provider_id] => provider_id
|
42
|
-
}
|
43
|
-
|
44
|
-
verifications_join = {
|
45
|
-
Sequel[:verifications][:pact_version_id] => Sequel[:pact_publications][:pact_version_id]
|
46
|
-
}
|
47
|
-
|
48
|
-
branch_ids = PactBroker::Versions::BranchVersion
|
49
|
-
.select(:branch_id)
|
50
|
-
.where(version_id: consumer_version_id)
|
51
|
-
|
52
|
-
|
53
|
-
latest_verification_id = PactBroker::Versions::BranchVersion
|
54
|
-
.select(Sequel[:verifications][:id])
|
55
|
-
.where(Sequel[:branch_versions][:branch_id] => branch_ids)
|
56
|
-
.join(:pact_publications, bv_pp_join)
|
57
|
-
.join(:verifications, verifications_join)
|
58
|
-
.order(Sequel.desc(Sequel[:verifications][:id]))
|
59
|
-
.limit(1)
|
60
|
-
|
61
|
-
PactBroker::Domain::Verification.where(id: latest_verification_id)
|
62
|
-
},
|
37
|
+
forbid_lazy_load: false,
|
38
|
+
dataset: PactBroker::Pacts::LazyLoaders::LATEST_VERIFICATION_FOR_CONSUMER_BRANCHES,
|
63
39
|
eager_loader: proc do | _ |
|
64
40
|
raise NotImplementedError
|
65
41
|
end
|
66
42
|
)
|
67
43
|
|
68
|
-
|
69
44
|
one_to_many(:head_pact_publications_for_tags,
|
70
45
|
class: PactPublication,
|
71
46
|
read_only: true,
|
72
47
|
dataset: PactBroker::Pacts::LazyLoaders::HEAD_PACT_PUBLICATIONS_FOR_TAGS,
|
73
|
-
eager_loader: PactBroker::Pacts::EagerLoaders::HeadPactPublicationsForTags
|
48
|
+
eager_loader: PactBroker::Pacts::EagerLoaders::HeadPactPublicationsForTags,
|
49
|
+
forbid_lazy_load: false
|
74
50
|
)
|
75
51
|
|
76
52
|
plugin :upsert, identifying_columns: [:consumer_version_id, :provider_id, :revision_number]
|
@@ -250,26 +250,28 @@ module PactBroker
|
|
250
250
|
if consumer_version_number && !pact_version_sha
|
251
251
|
pact_publication_by_consumer_version
|
252
252
|
.eager(:tags)
|
253
|
+
.all_allowing_lazy_load
|
253
254
|
.collect(&:to_domain_with_content).first
|
254
255
|
elsif pact_version_sha && !consumer_version_number
|
255
256
|
latest_pact_publication_by_sha
|
256
257
|
.eager(:tags)
|
257
258
|
.collect(&:to_domain_with_content).first
|
258
259
|
elsif consumer_version_number && pact_version_sha
|
259
|
-
pact_publication = pact_publication_by_consumer_version.
|
260
|
-
pact_publication&.allow_lazy_load
|
260
|
+
pact_publication = pact_publication_by_consumer_version.all_allowing_lazy_load.first
|
261
261
|
if pact_publication && pact_publication.pact_version.sha == pact_version_sha
|
262
262
|
pact_publication.tags
|
263
263
|
pact_publication.to_domain_with_content
|
264
264
|
else
|
265
265
|
latest_pact_publication_by_sha
|
266
266
|
.eager(:tags)
|
267
|
+
.all_allowing_lazy_load
|
267
268
|
.collect(&:to_domain_with_content).first
|
268
269
|
end
|
269
270
|
else
|
270
271
|
pact_publication_by_consumer_version
|
271
272
|
.eager(:tags)
|
272
273
|
.reverse_order(:consumer_version_order, :revision_number)
|
274
|
+
.all_allowing_lazy_load
|
273
275
|
.collect(&:to_domain_with_content).first
|
274
276
|
end
|
275
277
|
end
|
@@ -10,6 +10,10 @@ module PactBroker
|
|
10
10
|
all.each{ | row | row.forbid_lazy_load if row.respond_to?(:forbid_lazy_load) }
|
11
11
|
end
|
12
12
|
|
13
|
+
def all_allowing_lazy_load
|
14
|
+
all.each{ | row | row.allow_lazy_load if row.respond_to?(:allow_lazy_load) }
|
15
|
+
end
|
16
|
+
|
13
17
|
def name_like column_name, value
|
14
18
|
if PactBroker.configuration.use_case_sensitive_resource_names
|
15
19
|
if mysql?
|
data/lib/pact_broker/version.rb
CHANGED