pact_broker 2.92.0 → 2.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/pact_broker/api/resources/verifications.rb +1 -1
- data/lib/pact_broker/db/clean_incremental.rb +11 -9
- data/lib/pact_broker/domain/pacticipant.rb +36 -6
- data/lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb +1 -12
- data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +1 -1
- data/lib/pact_broker/version.rb +1 -1
- metadata +2 -3
- data/lib/pact_broker/versions/latest_version.rb +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3be3c5c9c91694873befa3ac15ff196bbcf49b75f250fc22485079ee1630699
|
|
4
|
+
data.tar.gz: 00aa9e23a79856cf4db4353191d1fd33ae3acf93a991f0074949ad1ccaefc4d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 568d1158ee7c4bf41731e26f849f30b5831ccf8d141399a549deabf679a32a1b7f0766bbe385fb604453b69476deff7788afdc5f276902fa09f065fcdb1e459f
|
|
7
|
+
data.tar.gz: da3b98bed787330c0730b2cf5e270dbee54fcea4106b0866f2fff0b9a7c6b00e31a57a8f2264ac057e24f706a9a96591890b052979fa73f362a15f4ad6e8d5c9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
<a name="v2.93.0"></a>
|
|
2
|
+
### v2.93.0 (2021-12-07)
|
|
3
|
+
|
|
4
|
+
#### Features
|
|
5
|
+
|
|
6
|
+
* remove feature flag for new_wip_calculations ([972ceadd](/../../commit/972ceadd))
|
|
7
|
+
* call the database clean within a transaction ([408c84ef](/../../commit/408c84ef))
|
|
8
|
+
|
|
9
|
+
#### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix clean performance fix (#530) ([6c71e57b](/../../commit/6c71e57b))
|
|
12
|
+
* fix performance issue loading latest version for pacticipant ([c575d132](/../../commit/c575d132))
|
|
13
|
+
|
|
1
14
|
<a name="v2.92.0"></a>
|
|
2
15
|
### v2.92.0 (2021-11-27)
|
|
3
16
|
|
|
@@ -50,7 +50,7 @@ module PactBroker
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def from_json
|
|
53
|
-
handle_webhook_events do
|
|
53
|
+
handle_webhook_events(build_url: verification_params["buildUrl"]) do
|
|
54
54
|
verified_pacts = pact_service.find_for_verification_publication(pact_params, event_context[:consumer_version_selectors])
|
|
55
55
|
verification = verification_service.create(next_verification_number, verification_params, verified_pacts, event_context)
|
|
56
56
|
response.body = decorator_for(verification).to_json(decorator_options)
|
|
@@ -66,13 +66,15 @@ module PactBroker
|
|
|
66
66
|
if dry_run?
|
|
67
67
|
dry_run_results
|
|
68
68
|
else
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
db.transaction do
|
|
70
|
+
before_counts = current_counts
|
|
71
|
+
PactBroker::Domain::Version.where(id: resolve_ids(version_ids_to_delete)).delete
|
|
72
|
+
delete_orphan_pact_versions
|
|
73
|
+
after_counts = current_counts
|
|
74
|
+
|
|
75
|
+
TABLES.each_with_object({}) do | table_name, comparison_counts |
|
|
76
|
+
comparison_counts[table_name.to_s] = { "deleted" => before_counts[table_name] - after_counts[table_name], "kept" => after_counts[table_name] }
|
|
77
|
+
end
|
|
76
78
|
end
|
|
77
79
|
end
|
|
78
80
|
end
|
|
@@ -102,8 +104,8 @@ module PactBroker
|
|
|
102
104
|
|
|
103
105
|
def orphan_pact_versions
|
|
104
106
|
db[:pact_versions]
|
|
105
|
-
.left_join(:pact_publications, pact_version_id
|
|
106
|
-
.left_join(:verifications, pact_version_id
|
|
107
|
+
.left_join(:pact_publications, Sequel[:pact_publications][:pact_version_id]=> Sequel[:pact_versions][:id])
|
|
108
|
+
.left_join(:verifications, Sequel[:verifications][:pact_version_id]=> Sequel[:pact_versions][:id])
|
|
107
109
|
.select(Sequel[:pact_versions][:id])
|
|
108
110
|
.where(
|
|
109
111
|
Sequel[:pact_publications][:id] => nil,
|
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
require "pact_broker/db"
|
|
2
2
|
require "pact_broker/messages"
|
|
3
3
|
require "pact_broker/repositories/helpers"
|
|
4
|
-
require "pact_broker/versions/latest_version"
|
|
5
4
|
require "pact_broker/domain/label"
|
|
6
5
|
require "pact_broker/string_refinements"
|
|
7
6
|
require "pact_broker/pacticipants/generate_display_name"
|
|
8
7
|
|
|
9
8
|
module PactBroker
|
|
10
9
|
module Domain
|
|
10
|
+
class LatestVersionForPacticipantEagerLoader
|
|
11
|
+
def self.call(eo, **_other)
|
|
12
|
+
populate_associations(eo[:rows])
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.populate_associations(pacticipants)
|
|
16
|
+
pacticipants.each { | pacticipant | pacticipant.associations[:latest_version] = nil }
|
|
17
|
+
pacticipant_ids = pacticipants.collect(&:id)
|
|
18
|
+
|
|
19
|
+
max_orders = PactBroker::Domain::Version
|
|
20
|
+
.where(pacticipant_id: pacticipant_ids)
|
|
21
|
+
.select_group(:pacticipant_id)
|
|
22
|
+
.select_append { max(order).as(latest_order) }
|
|
23
|
+
|
|
24
|
+
max_orders_join = {
|
|
25
|
+
Sequel[:max_orders][:latest_order] => Sequel[:versions][:order],
|
|
26
|
+
Sequel[:max_orders][:pacticipant_id] => Sequel[:versions][:pacticipant_id]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
latest_versions = PactBroker::Domain::Version
|
|
30
|
+
.select_all_qualified
|
|
31
|
+
.join(max_orders, max_orders_join, { table_alias: :max_orders})
|
|
32
|
+
|
|
33
|
+
latest_versions.each do | version |
|
|
34
|
+
pacticipant = pacticipants.find{ | p | p.id == version.pacticipant_id }
|
|
35
|
+
pacticipant.associations[:latest_version] = version
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
11
40
|
class Pacticipant < Sequel::Model
|
|
41
|
+
|
|
12
42
|
include Messages
|
|
13
43
|
include PactBroker::Pacticipants::GenerateDisplayName
|
|
14
44
|
using PactBroker::StringRefinements
|
|
@@ -21,7 +51,11 @@ module PactBroker
|
|
|
21
51
|
one_to_many :versions, :order => :order, :reciprocal => :pacticipant
|
|
22
52
|
one_to_many :labels, :order => :name, :reciprocal => :pacticipant
|
|
23
53
|
one_to_many :pacts
|
|
24
|
-
one_to_one :latest_version, :class => "PactBroker::
|
|
54
|
+
one_to_one :latest_version, :class => "PactBroker::Domain::Version",
|
|
55
|
+
primary_key: :id, key: :pacticipant_id,
|
|
56
|
+
dataset: lambda { PactBroker::Domain::Version.where(pacticipant_id: id).order(Sequel.desc(:order)).limit(1) },
|
|
57
|
+
eager_loader: LatestVersionForPacticipantEagerLoader
|
|
58
|
+
|
|
25
59
|
one_to_many :branch_heads, class: "PactBroker::Versions::BranchHead", primary_key: :id, key: :pacticipant_id
|
|
26
60
|
one_to_many :branches, class: "PactBroker::Versions::Branch", primary_key: :id, key: :pacticipant_id
|
|
27
61
|
|
|
@@ -61,10 +95,6 @@ module PactBroker
|
|
|
61
95
|
self.main_branch = nil if main_branch.blank?
|
|
62
96
|
end
|
|
63
97
|
|
|
64
|
-
def latest_version
|
|
65
|
-
versions.last
|
|
66
|
-
end
|
|
67
|
-
|
|
68
98
|
def to_s
|
|
69
99
|
"Pacticipant: id=#{id}, name=#{name}"
|
|
70
100
|
end
|
|
@@ -32,18 +32,7 @@ module PactBroker
|
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
def successfully_verified_by_provider_tag_when_not_wip(
|
|
36
|
-
return new_successfully_verified_by_provider_tag_when_not_wip(provider_id, provider_tag) if PactBroker.feature_enabled?(:new_wip_calculation)
|
|
37
|
-
|
|
38
|
-
from_self(alias: :pp)
|
|
39
|
-
.select(Sequel[:pp].*)
|
|
40
|
-
.where(Sequel[:pp][:provider_id] => provider_id)
|
|
41
|
-
.join_successful_non_wip_verifications_for_provider_id(provider_id)
|
|
42
|
-
.join_provider_version_tags_for_tag(provider_tag)
|
|
43
|
-
.distinct
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def new_successfully_verified_by_provider_tag_when_not_wip(_provider_id, provider_tag)
|
|
35
|
+
def successfully_verified_by_provider_tag_when_not_wip(provider_tag)
|
|
47
36
|
pact_version_provider_tag_verifications_join = {
|
|
48
37
|
Sequel[:sv][:pact_version_id] => Sequel[:pp][:pact_version_id],
|
|
49
38
|
Sequel[:sv][:provider_version_tag_name] => provider_tag,
|
|
@@ -270,7 +270,7 @@ module PactBroker
|
|
|
270
270
|
|
|
271
271
|
def remove_non_wip_for_tag(pact_publications_query, provider, tag, specified_pact_version_shas)
|
|
272
272
|
specified_explicitly = pact_publications_query.for_pact_version_sha(specified_pact_version_shas)
|
|
273
|
-
verified_by_this_tag = pact_publications_query.successfully_verified_by_provider_tag_when_not_wip(
|
|
273
|
+
verified_by_this_tag = pact_publications_query.successfully_verified_by_provider_tag_when_not_wip(tag)
|
|
274
274
|
verified_by_another_tag = pact_publications_query.successfully_verified_by_provider_another_tag_before_this_tag_first_created(provider.id, tag)
|
|
275
275
|
|
|
276
276
|
log_debug_for_wip do
|
data/lib/pact_broker/version.rb
CHANGED
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.
|
|
4
|
+
version: 2.93.0
|
|
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: 2021-
|
|
13
|
+
date: 2021-12-07 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: httparty
|
|
@@ -1047,7 +1047,6 @@ files:
|
|
|
1047
1047
|
- lib/pact_broker/versions/branch_version.rb
|
|
1048
1048
|
- lib/pact_broker/versions/branch_version_repository.rb
|
|
1049
1049
|
- lib/pact_broker/versions/eager_loaders.rb
|
|
1050
|
-
- lib/pact_broker/versions/latest_version.rb
|
|
1051
1050
|
- lib/pact_broker/versions/parse_semantic_version.rb
|
|
1052
1051
|
- lib/pact_broker/versions/repository.rb
|
|
1053
1052
|
- lib/pact_broker/versions/selector.rb
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require "pact_broker/domain/version"
|
|
2
|
-
|
|
3
|
-
module PactBroker
|
|
4
|
-
module Versions
|
|
5
|
-
include PactBroker::Repositories::Helpers
|
|
6
|
-
|
|
7
|
-
class LatestVersion < PactBroker::Domain::Version
|
|
8
|
-
set_dataset(:latest_versions)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# Table: latest_versions
|
|
14
|
-
# Columns:
|
|
15
|
-
# id | integer |
|
|
16
|
-
# number | text |
|
|
17
|
-
# repository_ref | text |
|
|
18
|
-
# pacticipant_id | integer |
|
|
19
|
-
# order | integer |
|
|
20
|
-
# created_at | timestamp without time zone |
|
|
21
|
-
# updated_at | timestamp without time zone |
|