pact_broker 2.109.0 → 2.109.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a915f7f2cb962cfc2d315338305f170cc875746ce0567826b54a8245dc06afa9
4
- data.tar.gz: 3f2db5d2e4c1a5ece6b6b5fef712f3bbcaf85eae49856b9309632ff525d23173
3
+ metadata.gz: a4c49978b4312049fd2e394ce46bcf90f64125ff50556f9bb01f9610e1310546
4
+ data.tar.gz: 43f24ab98f5ce7bd757a52a085d653668d83395b6889921e8dc0d4aac5982b73
5
5
  SHA512:
6
- metadata.gz: 4cc5845f6611967e5a33865b05da2a214d8fa2d28762943ea4f112bab8a02163830acde551342486cb2b03690564b8a33eb3e5242afd93bc5e70249c1416ca56
7
- data.tar.gz: 12f531f2a74c399bc48a26b7afb82e68453b35764c3f5aca5434a1fc55c9f377590508ea6ee41840547652ce240cce2dc4d244d88e4fc2b4074b8c8a8f441dfb
6
+ metadata.gz: 3211f2cc4b2e9fbae7dd8a07bd1c49dc9d672fa46f6f4c83b6652b2266dc9498d4858a9a7714f91b09914d872e522affc5e96753cf3317e39228fecc620404c1
7
+ data.tar.gz: 36a5bc3f3ecc827cd6e24fa21b4d4bc9f943ec75bfdb3db8cdcdd1399533739bf0a2c15c68df816ae995fa58987fa43d4da45dcb72a2d68fff12f7594a69906a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ <a name="v2.109.1"></a>
2
+ ### v2.109.1 (2024-02-21)
3
+
4
+ #### Bug Fixes
5
+
6
+ * improve performance for 'pacts for verification' queries ([299a6abe](/../../commit/299a6abe))
7
+ * correct spelling in message when pact is modified ([ae62ae7a](/../../commit/ae62ae7a))
8
+
1
9
  <a name="v2.109.0"></a>
2
10
  ### v2.109.0 (2024-02-01)
3
11
 
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
  [![Gem Version](https://badge.fury.io/rb/pact_broker.svg)](http://badge.fury.io/rb/pact_broker)
3
3
  ![Build status](https://github.com/pact-foundation/pact_broker/workflows/Test/badge.svg)
4
4
  [![Join the chat at https://pact-foundation.slack.com/](https://img.shields.io/badge/chat-on%20slack-blue.svg?logo=slack)](https://slack.pact.io)
5
- [![security](https://hakiri.io/github/pact-foundation/pact_broker/master.svg)](https://hakiri.io/github/pact-foundation/pact_broker/master)
6
5
 
7
6
  The Pact Broker is an application for sharing of consumer driven contracts and verification results. It is optimised for use with "pacts" (contracts created by the [Pact][pact-docs] framework), but can be used for any type of contract that can be serialized to JSON.
8
7
 
@@ -151,7 +150,7 @@ You can use the [Pact Broker Docker image][docker] or [Terraform on AWS][terrafo
151
150
 
152
151
  * Are you sure you don't just want to use the [Pact Broker Docker image][docker]? No Docker at your company yet? Ah well, keep reading.
153
152
  * Create a PostgreSQL database.
154
- * To ensure you're on a supported version of the database that you choose, check the [travis.yml][travisyml] file to see which versions we're currently running our tests against.
153
+ * To ensure you're on a supported version of the database that you choose, check the [.github/workflows/test.yml](.github/workflows/test.yml) file to see which versions we're currently running our tests against.
155
154
  * MySQL was supported for the native Ruby application until around 2021, but the official `pactfoundation/pact-broker` Docker image does not support it. New features will not be optimised for MySQL, and some new features may not even be supported on it (eg. the database clean feature).
156
155
  * You'll find a sample database creation script in the [example/config.ru](https://github.com/pact-foundation/pact_broker/blob/master/example/config.ru).
157
156
  * Install ruby 2.7 and the latest version of bundler (if you've come this far, I'm assuming you know how to do both of these. Did I mention there was a [Docker][docker] image?)
@@ -50,7 +50,7 @@ en:
50
50
  contract:
51
51
  pact_published: Pact successfully published for %{consumer_name} version %{consumer_version_number} and provider %{provider_name}.
52
52
  same_pact_content_published: Pact successfully republished for %{consumer_name} version %{consumer_version_number} and provider %{provider_name} with no content changes.
53
- pact_modified_for_same_version: Pact with changed content published over existing content for %{consumer_name} version %{consumer_version_number} and provider %{provider_name}. This is not recommended in normal cicumstances and may indicate that you have not configured your Pact pipeline correctly. For more information see https://docs.pact.io/go/versioning
53
+ pact_modified_for_same_version: Pact with changed content published over existing content for %{consumer_name} version %{consumer_version_number} and provider %{provider_name}. This is not recommended in normal circumstances and may indicate that you have not configured your Pact pipeline correctly. For more information see https://docs.pact.io/go/versioning
54
54
  pact_merged: Pact content merged with existing content for %{consumer_name} version %{consumer_version_number} and provider %{provider_name}.
55
55
  events:
56
56
  pact_published_unchanged_with_single_tag: pact content is the same as previous version with tag %{tag_name} and no new tags were applied
@@ -55,7 +55,6 @@ module PactBroker
55
55
  Sequel[:v][:verification_id],
56
56
  Sequel[:v][:provider_version_id],
57
57
  Sequel[:v][:provider_version_created_at]
58
-
59
58
  ]
60
59
 
61
60
  # Must be kept in sync with PactBroker::Matrix::EveryRow
@@ -11,7 +11,6 @@ require "pact_broker/hash_refinements"
11
11
  module PactBroker
12
12
  module Matrix
13
13
  class ResolvedSelector < Hash
14
-
15
14
  using PactBroker::HashRefinements
16
15
 
17
16
  # A version ID of -1 will not match any rows, which is what we want to ensure that
@@ -57,6 +57,7 @@ module PactBroker
57
57
  end
58
58
  end
59
59
 
60
+ # TODO use the branch heads here
60
61
  def latest_by_consumer_branch
61
62
  branch_versions_join = {
62
63
  Sequel[:pact_publications][:consumer_version_id] => Sequel[:branch_versions][:version_id]
@@ -1,35 +1,76 @@
1
1
  module PactBroker
2
2
  module Pacts
3
3
  module PactPublicationWipDatasetModule
4
+
5
+ # Use a cut down model of the verifications table just for the WIP calculations.
6
+ # Don't need all the associations and normal domain methods.
7
+ class VerificationForWipCalculations < Sequel::Model(:verifications)
8
+ dataset_module do
9
+ def successful_non_wip_by_provider(provider_id)
10
+ distinct.where(success: true, wip: false, provider_id: provider_id)
11
+ end
12
+
13
+ def verified_before_creation_date_of(record)
14
+ if record
15
+ verified_before_date(record.created_at)
16
+ else
17
+ self
18
+ end
19
+ end
20
+
21
+ def join_branch_versions_excluding_branch(provider_id, branch_name)
22
+ branch_versions_join = {
23
+ Sequel[:verifications][:provider_version_id] => Sequel[:branch_versions][:version_id],
24
+ Sequel[:branch_versions][:pacticipant_id] => provider_id
25
+ }
26
+ join(:branch_versions, branch_versions_join) do
27
+ Sequel.lit("branch_versions.branch_name != ?", branch_name)
28
+ end
29
+ end
30
+
31
+ def join_provider_versions_for_provider_id_and_branch(provider_id, provider_version_branch)
32
+ branch_versions_join = {
33
+ Sequel[:verifications][:provider_version_id] => Sequel[:branch_versions][:version_id],
34
+ Sequel[:branch_versions][:pacticipant_id] => provider_id,
35
+ Sequel[:branch_versions][:branch_name] => provider_version_branch
36
+ }
37
+
38
+ join(:branch_versions, branch_versions_join)
39
+ end
40
+
41
+ def verified_before_date(date)
42
+ where { Sequel[:verifications][:execution_date] < date }
43
+ end
44
+ end
45
+ end
46
+
4
47
  def successfully_verified_by_provider_branch_when_not_wip(provider_id, provider_version_branch)
48
+ successful_verifications = VerificationForWipCalculations
49
+ .select(:pact_version_id)
50
+ .distinct
51
+ .successful_non_wip_by_provider(provider_id)
52
+ .join_provider_versions_for_provider_id_and_branch(provider_id, provider_version_branch)
53
+
54
+
5
55
  from_self(alias: :pp)
6
56
  .select(Sequel[:pp].*)
7
- .where(Sequel[:pp][:provider_id] => provider_id)
8
- .join_successful_non_wip_verifications_for_provider_id(provider_id)
9
- .join_provider_versions_for_provider_id_and_branch(provider_id, provider_version_branch)
10
57
  .distinct
58
+ .join(successful_verifications, { Sequel[:pp][:pact_version_id] => Sequel[:v][:pact_version_id] }, { table_alias: :v })
11
59
  end
12
60
 
13
61
  def successfully_verified_by_provider_another_branch_before_this_branch_first_created(provider_id, provider_version_branch)
14
62
  first_version_for_branch = PactBroker::Domain::Version.first_for_pacticipant_id_and_branch(provider_id, provider_version_branch)
15
63
 
64
+ successful_verifications = VerificationForWipCalculations
65
+ .select(:pact_version_id)
66
+ .distinct
67
+ .successful_non_wip_by_provider(provider_id)
68
+ .join_branch_versions_excluding_branch(provider_id, provider_version_branch)
69
+ .verified_before_creation_date_of(first_version_for_branch)
70
+
16
71
  from_self(alias: :pp)
17
72
  .select(Sequel[:pp].*)
18
- .join_successful_non_wip_verifications_for_provider_id(provider_id)
19
- .join_provider_versions_for_provider_id(provider_id)
20
- .join_branch_versions_excluding_branch(provider_version_branch)
21
- .where(Sequel[:pp][:provider_id] => provider_id)
22
- .verified_before_creation_date_of(first_version_for_branch)
23
- .distinct
24
- end
25
-
26
- def join_branch_versions_excluding_branch(branch_name)
27
- branch_versions_join = {
28
- Sequel[:provider_versions][:id] => Sequel[:branch_versions][:version_id]
29
- }
30
- join(:branch_versions, branch_versions_join) do
31
- Sequel.lit("branch_versions.branch_name != ?", branch_name)
32
- end
73
+ .join(successful_verifications, { Sequel[:pp][:pact_version_id] => Sequel[:v][:pact_version_id] }, { table_alias: :v })
33
74
  end
34
75
 
35
76
  def successfully_verified_by_provider_tag_when_not_wip(provider_tag)
@@ -43,7 +84,6 @@ module PactBroker
43
84
  .select(Sequel[:pp].*)
44
85
  .join(:pact_version_provider_tag_successful_verifications, pact_version_provider_tag_verifications_join, { table_alias: :sv })
45
86
  .distinct
46
-
47
87
  end
48
88
 
49
89
  def successfully_verified_by_provider_another_tag_before_this_tag_first_created(provider_id, provider_tag)
@@ -71,66 +111,6 @@ module PactBroker
71
111
  end
72
112
  .distinct
73
113
  end
74
-
75
- protected
76
-
77
- def verified_before_date(date)
78
- where { Sequel[:verifications][:execution_date] < date }
79
- end
80
-
81
- def join_successful_non_wip_verifications_for_provider_id(provider_id, &block)
82
- verifications_join = {
83
- pact_version_id: :pact_version_id,
84
- Sequel[:verifications][:success] => true,
85
- Sequel[:verifications][:wip] => false,
86
- Sequel[:verifications][:provider_id] => provider_id
87
- }
88
- join(:verifications, verifications_join, {}, &block)
89
- end
90
-
91
- def join_provider_version_tags &block
92
- tags_join = {
93
- Sequel[:verifications][:provider_version_id] => Sequel[:provider_tags][:version_id],
94
- }
95
- join(:tags, tags_join, { table_alias: :provider_tags }, &block)
96
- end
97
-
98
- def join_provider_version_tags_for_tag(tag)
99
- tags_join = {
100
- Sequel[:verifications][:provider_version_id] => Sequel[:provider_tags][:version_id],
101
- Sequel[:provider_tags][:name] => tag
102
- }
103
- join(:tags, tags_join, { table_alias: :provider_tags } )
104
- end
105
-
106
- def join_provider_versions_for_provider_id_and_branch(provider_id, provider_version_branch)
107
- versions_join = {
108
- Sequel[:verifications][:provider_version_id] => Sequel[:provider_versions][:id],
109
- Sequel[:provider_versions][:pacticipant_id] => provider_id
110
- }
111
- branch_versions_join = {
112
- Sequel[:provider_versions][:id] => Sequel[:branch_versions][:version_id],
113
- Sequel[:branch_versions][:branch_name] => provider_version_branch
114
- }
115
- join(:versions, versions_join, { table_alias: :provider_versions } )
116
- .join(:branch_versions, branch_versions_join)
117
- end
118
-
119
- def join_provider_versions_for_provider_id(provider_id, &block)
120
- versions_join = {
121
- Sequel[:verifications][:provider_version_id] => Sequel[:provider_versions][:id],
122
- Sequel[:provider_versions][:pacticipant_id] => provider_id
123
- }
124
- join(:versions, versions_join, { table_alias: :provider_versions }, &block)
125
- end
126
-
127
- def verified_before_creation_date_of(record)
128
- if record
129
- verified_before_date(record.created_at)
130
- else
131
- self
132
- end
133
- end
134
114
  end
135
115
  end
136
116
  end
@@ -7,6 +7,7 @@ require "pact_broker/pacts/selector"
7
7
  require "pact_broker/pacts/selectors"
8
8
  require "pact_broker/feature_toggle"
9
9
  require "pact_broker/repositories/scopes"
10
+ require "pact_broker/matrix/unresolved_selector"
10
11
 
11
12
  module PactBroker
12
13
  module Pacts
@@ -1,3 +1,3 @@
1
1
  module PactBroker
2
- VERSION = "2.109.0"
2
+ VERSION = "2.109.1"
3
3
  end
@@ -2,6 +2,7 @@ require "forwardable"
2
2
  require "pact_broker/logging"
3
3
  require "pact_broker/repositories"
4
4
  require "pact_broker/messages"
5
+ require "pact_broker/contracts/notice"
5
6
 
6
7
  module PactBroker
7
8
  module Versions
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.109.0
4
+ version: 2.109.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Skurrie
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-02-05 00:00:00.000000000 Z
13
+ date: 2024-02-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -1260,7 +1260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1260
1260
  - !ruby/object:Gem::Version
1261
1261
  version: '0'
1262
1262
  requirements: []
1263
- rubygems_version: 3.5.5
1263
+ rubygems_version: 3.5.6
1264
1264
  signing_key:
1265
1265
  specification_version: 4
1266
1266
  summary: See description