pact_broker 2.117.0 → 2.118.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 +19 -0
- data/Gemfile +7 -1
- data/db/migrations/20251202_add_has_messages_column_to_pact_versions.rb +7 -0
- data/db/migrations/20251202_populate_has_messages_in_pact_versions.rb +29 -0
- data/lib/pact_broker/api/contracts/pacts_for_verification_json_query_schema.rb +1 -1
- data/lib/pact_broker/api/resources/clean.rb +1 -1
- data/lib/pact_broker/api/resources/index.rb +3 -3
- data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +2 -2
- data/lib/pact_broker/api.rb +3 -3
- data/lib/pact_broker/app.rb +0 -1
- data/lib/pact_broker/config/runtime_configuration.rb +9 -8
- data/lib/pact_broker/doc/views/index/latest-branch-pact-versions.markdown +1 -1
- data/lib/pact_broker/doc/views/index/latest-main-branch-pact-versions.markdown +1 -1
- data/lib/pact_broker/doc/views/index/main-branch-pact-versions.markdown +1 -1
- data/lib/pact_broker/pacts/interactions/types.rb +44 -0
- data/lib/pact_broker/pacts/pact_publication.rb +1 -1
- data/lib/pact_broker/pacts/pact_publication_selector_dataset_module.rb +11 -2
- data/lib/pact_broker/pacts/repository.rb +5 -2
- data/lib/pact_broker/tasks/clean_task.rb +1 -0
- data/lib/pact_broker/test/test_data_builder.rb +13 -7
- data/lib/pact_broker/ui/controllers/can_i_deploy.rb +2 -2
- data/lib/pact_broker/ui/controllers/clusters.rb +1 -1
- data/lib/pact_broker/ui/controllers/dashboard.rb +2 -2
- data/lib/pact_broker/ui/controllers/error_test.rb +1 -1
- data/lib/pact_broker/ui/controllers/groups.rb +1 -1
- data/lib/pact_broker/ui/controllers/index.rb +2 -2
- data/lib/pact_broker/ui/controllers/matrix.rb +3 -3
- data/lib/pact_broker/ui/controllers/pacts.rb +1 -1
- data/lib/pact_broker/ui/view_models/index_item.rb +1 -1
- data/lib/pact_broker/ui/view_models/index_item_branch_head.rb +1 -1
- data/lib/pact_broker/ui/view_models/index_item_provider_branch_head.rb +1 -1
- data/lib/pact_broker/ui/view_models/index_items.rb +1 -1
- data/lib/pact_broker/ui/view_models/matrix_branch.rb +1 -1
- data/lib/pact_broker/ui/view_models/matrix_deployed_version.rb +1 -1
- data/lib/pact_broker/ui/view_models/matrix_line.rb +1 -1
- data/lib/pact_broker/ui/view_models/matrix_lines.rb +2 -2
- data/lib/pact_broker/ui/view_models/matrix_released_version.rb +1 -1
- data/lib/pact_broker/ui/view_models/matrix_tag.rb +1 -1
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/versions/branch_version_repository.rb +15 -9
- metadata +8 -7
- data/lib/pact_broker/dashboard/service.rb +0 -0
- data/lib/pact_broker/ui/view_models/clusters.rb +0 -0
- /data/lib/pact_broker/config/{basic_auth_configuration.rb → runtime_configuration_basic_auth_methods.rb} +0 -0
- /data/lib/pact_broker/tags/{head_pact_tags.rb → head_pact_tag.rb} +0 -0
- /data/lib/pact_broker/ui/controllers/{base_controller.rb → base.rb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d5c79b9a890f8984e3e2975740672d1b6c4810a88f750202692144d54b006b2
|
|
4
|
+
data.tar.gz: 4fb8df1387017108768afd83f9117cab1a4cf274ce9f4a66a0701ca848474b5d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f1916525083f39001b263ddcd4d41867dec84b640f76b1ce8cd5b8e50c8341ef7e340a6c3f85d129ca56db79984fba48b1e348751ebb19adf5400cbdeaea3808
|
|
7
|
+
data.tar.gz: e7d66f051526f19300d62bf772082324ba8774c03341380b9de219d7ce0b6113776124a4d88a66adaf1eade5b61667a38877036e76f3f29eb83bbfdbecc98410
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
<a name="v2.118.0"></a>
|
|
2
|
+
### v2.118.0 (2026-01-02)
|
|
3
|
+
|
|
4
|
+
#### Features
|
|
5
|
+
|
|
6
|
+
* added has_messages column to pact_versions table (#880) ([34741dae](/../../commit/34741dae))
|
|
7
|
+
|
|
8
|
+
#### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* remove route overlap and add tests for new routes ([45a81474](/../../commit/45a81474))
|
|
11
|
+
* restore latest pact for branch endpoint ([cb867957](/../../commit/cb867957))
|
|
12
|
+
|
|
13
|
+
<a name="v2.117.1"></a>
|
|
14
|
+
### v2.117.1 (2025-11-02)
|
|
15
|
+
|
|
16
|
+
#### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* dashboard loading after zeitwerk rename prep ([13112e2f](/../../commit/13112e2f))
|
|
19
|
+
|
|
1
20
|
<a name="v2.117.0"></a>
|
|
2
21
|
### v2.117.0 (2025-10-28)
|
|
3
22
|
|
data/Gemfile
CHANGED
|
@@ -21,7 +21,13 @@ end
|
|
|
21
21
|
|
|
22
22
|
group :test do
|
|
23
23
|
gem "simplecov", :require => false
|
|
24
|
-
|
|
24
|
+
if ENV["X_PACT_DEVELOPMENT"] == "true"
|
|
25
|
+
gem "pact", path: "../pact-ruby"
|
|
26
|
+
gem "pact-ffi", path: "../pact-ruby-ffi"
|
|
27
|
+
else
|
|
28
|
+
gem "pact", "~>1.14"
|
|
29
|
+
gem "pact-ffi", "~>0.4.28"
|
|
30
|
+
end
|
|
25
31
|
gem "rspec-pact-matchers", "~>0.1"
|
|
26
32
|
gem "bundler-audit", "~>0.4"
|
|
27
33
|
gem "webmock", "~>3.9"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require "pact_broker/pacts/content"
|
|
2
|
+
require "pact_broker/pacts/interactions/types"
|
|
3
|
+
|
|
4
|
+
Sequel.migration do
|
|
5
|
+
up do
|
|
6
|
+
batch_size = 500
|
|
7
|
+
offset = 0
|
|
8
|
+
|
|
9
|
+
loop do
|
|
10
|
+
rows = from(:pact_versions).order(:id).limit(batch_size).offset(offset).all
|
|
11
|
+
break if rows.empty?
|
|
12
|
+
|
|
13
|
+
rows.each do |row|
|
|
14
|
+
content = PactBroker::Pacts::Content.from_json(row[:content])
|
|
15
|
+
has_messages = PactBroker::Pacts::Interactions::Types.for(content).has_messages?
|
|
16
|
+
|
|
17
|
+
from(:pact_versions)
|
|
18
|
+
.where(id: row[:id])
|
|
19
|
+
.update(has_messages: has_messages)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
offset += batch_size
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
down do
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -5,7 +5,7 @@ require "pact_broker/logging"
|
|
|
5
5
|
module PactBroker
|
|
6
6
|
module Api
|
|
7
7
|
module Contracts
|
|
8
|
-
class
|
|
8
|
+
class PactsForVerificationJsonQuerySchema < BaseContract
|
|
9
9
|
json do
|
|
10
10
|
optional(:providerVersionBranch).maybe(:string)
|
|
11
11
|
optional(:providerVersionTags).maybe(:array?)
|
|
@@ -19,7 +19,7 @@ module PactBroker
|
|
|
19
19
|
def process_post
|
|
20
20
|
if content_type_json?
|
|
21
21
|
keep_selectors = (params[:keep] || []).collect do | hash |
|
|
22
|
-
PactBroker::
|
|
22
|
+
PactBroker::DB::Clean::Selector.new(hash)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
result = PactBroker::DB::Clean.call(Sequel::Model.db, { keep: keep_selectors })
|
|
@@ -57,19 +57,19 @@ module PactBroker
|
|
|
57
57
|
},
|
|
58
58
|
"pb:latest-branch-pact-versions" =>
|
|
59
59
|
{
|
|
60
|
-
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch/{branch}/latest",
|
|
60
|
+
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch/{branch}/latest/versions",
|
|
61
61
|
title: "Latest version of pact for a provider, for a named consumers branch",
|
|
62
62
|
templated: true
|
|
63
63
|
},
|
|
64
64
|
"pb:main-branch-pact-versions" =>
|
|
65
65
|
{
|
|
66
|
-
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch",
|
|
66
|
+
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch/versions",
|
|
67
67
|
title: "All versions of pacts for a provider, for a named consumers main branch",
|
|
68
68
|
templated: true
|
|
69
69
|
},
|
|
70
70
|
"pb:latest-main-branch-pact-versions" =>
|
|
71
71
|
{
|
|
72
|
-
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch/latest",
|
|
72
|
+
href: base_url + "/pacts/provider/{provider}/consumer/{consumer}/branch/latest/versions",
|
|
73
73
|
title: "Latest version of pact for a provider, for a named consumers main branch",
|
|
74
74
|
templated: true
|
|
75
75
|
},
|
|
@@ -73,9 +73,9 @@ module PactBroker
|
|
|
73
73
|
|
|
74
74
|
def schema
|
|
75
75
|
if request.get?
|
|
76
|
-
|
|
76
|
+
api_contract_class(:pacts_for_verification_query_string_schema)
|
|
77
77
|
elsif request.post?
|
|
78
|
-
|
|
78
|
+
api_contract_class(:pacts_for_verification_json_query_schema)
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
data/lib/pact_broker/api.rb
CHANGED
|
@@ -33,10 +33,10 @@ module PactBroker
|
|
|
33
33
|
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "versions"], Api::Resources::PactVersions, {resource_name: "pact_publications"}
|
|
34
34
|
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "versions", :consumer_version_number], Api::Resources::Pact, {resource_name: "pact_publication", deprecated: true} # Not the standard URL, but keep for backwards compatibility
|
|
35
35
|
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "tag", :tag], Api::Resources::TaggedPactVersions, {resource_name: "tagged_pact_publications"}
|
|
36
|
-
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch"], Api::Resources::PactVersionsForBranch, {resource_name: "pact_publications_for_main_branch"}
|
|
37
|
-
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", "latest"], Api::Resources::PactVersionsForBranch, {resource_name: "latest_pact_publications_for_main_branch"}
|
|
38
|
-
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", :branch_name, "latest"], Api::Resources::PactVersionsForBranch, {resource_name: "latest_pact_publications_for_branch"}
|
|
36
|
+
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", "versions"], Api::Resources::PactVersionsForBranch, {resource_name: "pact_publications_for_main_branch"}
|
|
39
37
|
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", :branch_name], Api::Resources::PactVersionsForBranch, {resource_name: "pact_publications_for_branch"}
|
|
38
|
+
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", "latest", "versions"], Api::Resources::PactVersionsForBranch, {resource_name: "latest_pact_publications_for_main_branch"}
|
|
39
|
+
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "branch", :branch_name, "latest", "versions"], Api::Resources::PactVersionsForBranch, {resource_name: "latest_pact_publications_for_branch"}
|
|
40
40
|
|
|
41
41
|
# Pacts
|
|
42
42
|
add ["pacts", "provider", :provider_name, "consumer", :consumer_name, "version", :consumer_version_number], Api::Resources::Pact, {resource_name: "pact_publication"}
|
data/lib/pact_broker/app.rb
CHANGED
|
@@ -23,7 +23,6 @@ require "rack/pact_broker/application_context"
|
|
|
23
23
|
require "sucker_punch"
|
|
24
24
|
require "pact_broker/api/middleware/configuration"
|
|
25
25
|
require "pact_broker/api/middleware/basic_auth"
|
|
26
|
-
require "pact_broker/config/basic_auth_configuration"
|
|
27
26
|
require "pact_broker/api/authorization/resource_access_policy"
|
|
28
27
|
require "pact_broker/api/middleware/http_debug_logs"
|
|
29
28
|
require "pact_broker/application_context"
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
require "anyway_config"
|
|
2
|
-
require "pact_broker/config/runtime_configuration_logging_methods"
|
|
3
|
-
require "pact_broker/config/runtime_configuration_database_methods"
|
|
4
|
-
require "pact_broker/config/runtime_configuration_coercion_methods"
|
|
5
|
-
require "pact_broker/version"
|
|
6
|
-
require "pact_broker/config/basic_auth_configuration"
|
|
7
|
-
require "pact_broker/string_refinements"
|
|
8
|
-
require "pact_broker/hash_refinements"
|
|
9
|
-
require "pact_broker/error"
|
|
10
2
|
|
|
11
3
|
module Anyway
|
|
12
4
|
module Tracing
|
|
@@ -20,6 +12,15 @@ module Anyway
|
|
|
20
12
|
end
|
|
21
13
|
end
|
|
22
14
|
|
|
15
|
+
require "pact_broker/config/runtime_configuration_logging_methods"
|
|
16
|
+
require "pact_broker/config/runtime_configuration_database_methods"
|
|
17
|
+
require "pact_broker/config/runtime_configuration_coercion_methods"
|
|
18
|
+
require "pact_broker/version"
|
|
19
|
+
require "pact_broker/config/runtime_configuration_basic_auth_methods"
|
|
20
|
+
require "pact_broker/string_refinements"
|
|
21
|
+
require "pact_broker/hash_refinements"
|
|
22
|
+
require "pact_broker/error"
|
|
23
|
+
|
|
23
24
|
module PactBroker
|
|
24
25
|
module Config
|
|
25
26
|
class RuntimeConfiguration < Anyway::Config
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Allowed methods: `GET`
|
|
4
4
|
|
|
5
|
-
Path: `/pacts/provider/{provider}/consumer/{consumer}/branch/{branch}/latest`
|
|
5
|
+
Path: `/pacts/provider/{provider}/consumer/{consumer}/branch/{branch}/latest/versions`
|
|
6
6
|
|
|
7
7
|
Returns the latest pact version with the specified consumer, provider and consumer version branch.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Allowed methods: `GET`
|
|
4
4
|
|
|
5
|
-
Path: `/pacts/provider/{provider}/consumer/{consumer}/branch/latest`
|
|
5
|
+
Path: `/pacts/provider/{provider}/consumer/{consumer}/branch/latest/versions`
|
|
6
6
|
|
|
7
7
|
Lists all latest pact version with the specified consumer, provider and the consumers main branch.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module PactBroker
|
|
2
|
+
module Pacts
|
|
3
|
+
module Interactions
|
|
4
|
+
class Types
|
|
5
|
+
# Pact Spec v4+ message interaction types
|
|
6
|
+
MESSAGE_TYPES = [
|
|
7
|
+
"Asynchronous/Messages",
|
|
8
|
+
"Synchronous/Messages"
|
|
9
|
+
].freeze
|
|
10
|
+
|
|
11
|
+
def initialize(content)
|
|
12
|
+
@content = content
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.for(content)
|
|
16
|
+
new(content)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def has_messages?
|
|
20
|
+
if spec_version < 4.0
|
|
21
|
+
# Pre-v4: messages in "messages" key
|
|
22
|
+
content.messages&.any? || false
|
|
23
|
+
else
|
|
24
|
+
# V4+: messages are typed interactions
|
|
25
|
+
content.interactions&.any? { |i| message_interaction?(i) } || false
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
attr_reader :content
|
|
32
|
+
|
|
33
|
+
def message_interaction?(interaction)
|
|
34
|
+
interaction.is_a?(Hash) &&
|
|
35
|
+
MESSAGE_TYPES.include?(interaction["type"])
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def spec_version
|
|
39
|
+
content.pact_specification_version.to_f
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -3,7 +3,7 @@ require "pact_broker/dataset"
|
|
|
3
3
|
require "pact_broker/domain/pact"
|
|
4
4
|
require "pact_broker/pacts/pact_version"
|
|
5
5
|
require "pact_broker/integrations/integration"
|
|
6
|
-
require "pact_broker/tags/
|
|
6
|
+
require "pact_broker/tags/head_pact_tag"
|
|
7
7
|
require "pact_broker/pacts/pact_publication_dataset_module"
|
|
8
8
|
require "pact_broker/pacts/pact_publication_wip_dataset_module"
|
|
9
9
|
require "pact_broker/pacts/eager_loaders"
|
|
@@ -46,9 +46,18 @@ module PactBroker
|
|
|
46
46
|
|
|
47
47
|
def for_main_branches
|
|
48
48
|
consumers_join = { Sequel[:pact_publications][:consumer_id] => Sequel[:consumers][:id] }
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
branch_versions_join = {
|
|
50
|
+
Sequel[:branch_versions][:version_id] => Sequel[:pact_publications][:consumer_version_id],
|
|
51
|
+
Sequel[:branch_versions][:branch_name] => Sequel[:consumers][:main_branch]
|
|
52
|
+
}
|
|
53
|
+
base_query = self
|
|
54
|
+
|
|
55
|
+
if no_columns_selected?
|
|
56
|
+
base_query = base_query.select_all_qualified.select_append(Sequel[:branch_versions][:branch_name].as(:branch_name))
|
|
57
|
+
end
|
|
58
|
+
base_query
|
|
51
59
|
.join(:pacticipants, consumers_join, { table_alias: :consumers })
|
|
60
|
+
.join(:branch_versions, branch_versions_join)
|
|
52
61
|
.remove_overridden_revisions_from_complete_query
|
|
53
62
|
end
|
|
54
63
|
|
|
@@ -14,6 +14,7 @@ require "pact_broker/pacts/selectors"
|
|
|
14
14
|
require "pact_broker/feature_toggle"
|
|
15
15
|
require "pact_broker/pacts/pacts_for_verification_repository"
|
|
16
16
|
require "pact_broker/pacts/content"
|
|
17
|
+
require "pact_broker/pacts/interactions/types"
|
|
17
18
|
require "pact_broker/policies"
|
|
18
19
|
|
|
19
20
|
module PactBroker
|
|
@@ -394,14 +395,16 @@ module PactBroker
|
|
|
394
395
|
end
|
|
395
396
|
|
|
396
397
|
def create_pact_version consumer_id, provider_id, sha, json_content
|
|
398
|
+
content = Content.from_json(json_content)
|
|
397
399
|
PactBroker::Pacts::PactVersion.new(
|
|
398
400
|
consumer_id: consumer_id,
|
|
399
401
|
provider_id: provider_id,
|
|
400
402
|
sha: sha,
|
|
401
403
|
content: json_content,
|
|
402
404
|
created_at: Sequel.datetime_class.now,
|
|
403
|
-
interactions_count:
|
|
404
|
-
messages_count:
|
|
405
|
+
interactions_count: content.interactions&.count || 0,
|
|
406
|
+
messages_count: content.messages&.count || 0,
|
|
407
|
+
has_messages: Interactions::Types.for(content).has_messages?
|
|
405
408
|
).upsert
|
|
406
409
|
end
|
|
407
410
|
|
|
@@ -456,6 +456,9 @@ module PactBroker
|
|
|
456
456
|
parameters = default_parameters.merge(parameters)
|
|
457
457
|
parameters.delete(:provider_version)
|
|
458
458
|
verification = PactBroker::Domain::Verification.new(parameters)
|
|
459
|
+
if pact.nil?
|
|
460
|
+
@pact = find_pact(@consumer.name, @consumer_version.number, @provider.name)
|
|
461
|
+
end
|
|
459
462
|
pact_version = PactBroker::Pacts::Repository.new.find_pact_version(@consumer, @provider, pact.pact_version_sha)
|
|
460
463
|
@provider_version = version_repository.find_by_pacticipant_id_and_number_or_create(provider.id, provider_version_number)
|
|
461
464
|
branch_version = PactBroker::Versions::BranchVersionRepository.new.add_branch(@provider_version, branch) if branch
|
|
@@ -714,13 +717,16 @@ module PactBroker
|
|
|
714
717
|
def default_json_content
|
|
715
718
|
{
|
|
716
719
|
"consumer" => {
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
720
|
+
"name" => consumer.name
|
|
721
|
+
},
|
|
722
|
+
"provider" => {
|
|
723
|
+
"name" => provider.name
|
|
724
|
+
},
|
|
725
|
+
"interactions" => [],
|
|
726
|
+
"metadata" => {
|
|
727
|
+
"pactSpecification" => { "version" => "4.0" }
|
|
728
|
+
},
|
|
729
|
+
"random" => rand
|
|
724
730
|
}.to_json
|
|
725
731
|
end
|
|
726
732
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "pact_broker/ui/controllers/
|
|
1
|
+
require "pact_broker/ui/controllers/base"
|
|
2
2
|
require "pact_broker/ui/view_models/matrix_lines"
|
|
3
3
|
require "pact_broker/matrix/unresolved_selector"
|
|
4
4
|
require "pact_broker/matrix/parse_query"
|
|
@@ -20,7 +20,7 @@ module PactBroker
|
|
|
20
20
|
selectors = [ PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: params[:pacticipant_name], latest: true, tag: params[:tag]) ]
|
|
21
21
|
options = { latestby: "cvp", limit: 100, tag: params[:to] }
|
|
22
22
|
result = matrix_service.find(selectors, options)
|
|
23
|
-
lines = PactBroker::UI::
|
|
23
|
+
lines = PactBroker::UI::ViewModels::MatrixLines.new(result, base_url: base_url)
|
|
24
24
|
locals = {
|
|
25
25
|
lines: lines,
|
|
26
26
|
selectors: create_selector_objects(selectors),
|
|
@@ -18,7 +18,7 @@ module PactBroker
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
get "/" do
|
|
21
|
-
view_model =
|
|
21
|
+
view_model = PactBroker::UI::ViewModels::IndexItems.new(pacticipant_service.find_index_items, base_url: base_url)
|
|
22
22
|
haml "clusters/show", locals: { relationships: view_model, base_url: base_url }, escape_html: true
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "pact_broker/ui/controllers/
|
|
1
|
+
require "pact_broker/ui/controllers/base"
|
|
2
2
|
require "pact_broker/ui/view_models/index_items"
|
|
3
3
|
require "haml"
|
|
4
4
|
|
|
@@ -44,7 +44,7 @@ module PactBroker
|
|
|
44
44
|
[]
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
view_index_items =
|
|
47
|
+
view_index_items = PactBroker::UI::ViewModels::IndexItems.new(index_items, base_url: base_url, view: view)
|
|
48
48
|
|
|
49
49
|
page = :'dashboard/show'
|
|
50
50
|
locals = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "pact_broker/ui/controllers/
|
|
1
|
+
require "pact_broker/ui/controllers/base"
|
|
2
2
|
require "pact_broker/ui/view_models/index_items"
|
|
3
3
|
require "pact_broker/string_refinements"
|
|
4
4
|
require "haml"
|
|
@@ -33,7 +33,7 @@ module PactBroker
|
|
|
33
33
|
error_messages << "No pacticipants found matching: \"#{search}\""
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
view_index_items =
|
|
36
|
+
view_index_items = PactBroker::UI::ViewModels::IndexItems.new(index_items, base_url: base_url)
|
|
37
37
|
|
|
38
38
|
page = tags ? :'index/show-with-tags' : :'index/show'
|
|
39
39
|
locals = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "pact_broker/ui/controllers/
|
|
1
|
+
require "pact_broker/ui/controllers/base"
|
|
2
2
|
require "pact_broker/ui/view_models/matrix_lines"
|
|
3
3
|
require "pact_broker/matrix/unresolved_selector"
|
|
4
4
|
require "pact_broker/matrix/parse_query"
|
|
@@ -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::
|
|
35
|
+
locals[:lines] = PactBroker::UI::ViewModels::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
|
|
@@ -52,7 +52,7 @@ module PactBroker
|
|
|
52
52
|
]
|
|
53
53
|
options = { latestby: "cvpv", limit: 100 }
|
|
54
54
|
lines = matrix_service.find(selectors, options)
|
|
55
|
-
lines = PactBroker::UI::
|
|
55
|
+
lines = PactBroker::UI::ViewModels::MatrixLines.new(lines, base_url: base_url)
|
|
56
56
|
locals = {
|
|
57
57
|
lines: lines,
|
|
58
58
|
consumer_name: params[:consumer_name],
|
|
@@ -2,12 +2,12 @@ require "pact_broker/ui/view_models/matrix_line"
|
|
|
2
2
|
|
|
3
3
|
module PactBroker
|
|
4
4
|
module UI
|
|
5
|
-
module
|
|
5
|
+
module ViewModels
|
|
6
6
|
class MatrixLines < Array
|
|
7
7
|
|
|
8
8
|
def initialize rows, options = {}
|
|
9
9
|
lines = rows.collect do | row |
|
|
10
|
-
PactBroker::UI::
|
|
10
|
+
PactBroker::UI::ViewModels::MatrixLine.new(row, options)
|
|
11
11
|
end
|
|
12
12
|
super(lines.sort)
|
|
13
13
|
end
|
data/lib/pact_broker/version.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require "pact_broker/versions/branch_version"
|
|
2
2
|
require "pact_broker/services"
|
|
3
|
+
require "pact_broker/logging"
|
|
3
4
|
|
|
4
5
|
module PactBroker
|
|
5
6
|
module Versions
|
|
@@ -21,16 +22,21 @@ module PactBroker
|
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
def add_branch(version, branch_name, auto_created: false)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
branch_version.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
PactBroker.logger.info("BranchVersionRepository#add_branch method called with version #{version.inspect} and branch_name '#{branch_name}'")
|
|
26
|
+
Sequel::Model.db.transaction do
|
|
27
|
+
branch = find_or_create_branch(version.pacticipant, branch_name)
|
|
28
|
+
branch_version = version.branch_version_for_branch(branch)
|
|
29
|
+
if branch_version
|
|
30
|
+
PactBroker.logger.info("Updating branch version #{branch_version.inspect}, time: #{Time.now}")
|
|
31
|
+
branch_version.update(updated_at: Sequel.datetime_class.now)
|
|
32
|
+
else
|
|
33
|
+
PactBroker.logger.info("Creating branch version time: #{Time.now}")
|
|
34
|
+
branch_version = PactBroker::Versions::BranchVersion.new(version: version, branch: branch, auto_created: auto_created).insert_ignore
|
|
35
|
+
PactBroker::Versions::BranchHead.new(branch: branch, branch_version: branch_version).upsert
|
|
36
|
+
end
|
|
37
|
+
pacticipant_service.maybe_set_main_branch(version.pacticipant, branch_name)
|
|
38
|
+
branch_version
|
|
31
39
|
end
|
|
32
|
-
pacticipant_service.maybe_set_main_branch(version.pacticipant, branch_name)
|
|
33
|
-
branch_version
|
|
34
40
|
end
|
|
35
41
|
|
|
36
42
|
# Deletes a branch version - that is, removes a version from a branch.
|
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.118.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bethany Skurrie
|
|
@@ -579,6 +579,8 @@ files:
|
|
|
579
579
|
- db/migrations/20231002_add_version_id_index_to_released_version.rb
|
|
580
580
|
- db/migrations/20231003_add_version_id_index_to_deployed_version.rb
|
|
581
581
|
- db/migrations/20240112_add_client_language_verified_by_to_verification.rb
|
|
582
|
+
- db/migrations/20251202_add_has_messages_column_to_pact_versions.rb
|
|
583
|
+
- db/migrations/20251202_populate_has_messages_in_pact_versions.rb
|
|
582
584
|
- db/migrations/migration_helper.rb
|
|
583
585
|
- docs/CONFIGURATION.md
|
|
584
586
|
- docs/api/PACTICIPANTS.md
|
|
@@ -805,10 +807,10 @@ files:
|
|
|
805
807
|
- lib/pact_broker/build_http_options.rb
|
|
806
808
|
- lib/pact_broker/certificates/certificate.rb
|
|
807
809
|
- lib/pact_broker/certificates/service.rb
|
|
808
|
-
- lib/pact_broker/config/basic_auth_configuration.rb
|
|
809
810
|
- lib/pact_broker/config/load.rb
|
|
810
811
|
- lib/pact_broker/config/repository.rb
|
|
811
812
|
- lib/pact_broker/config/runtime_configuration.rb
|
|
813
|
+
- lib/pact_broker/config/runtime_configuration_basic_auth_methods.rb
|
|
812
814
|
- lib/pact_broker/config/runtime_configuration_coercion_methods.rb
|
|
813
815
|
- lib/pact_broker/config/runtime_configuration_database_methods.rb
|
|
814
816
|
- lib/pact_broker/config/runtime_configuration_logging_methods.rb
|
|
@@ -823,7 +825,6 @@ files:
|
|
|
823
825
|
- lib/pact_broker/contracts/contracts_to_publish.rb
|
|
824
826
|
- lib/pact_broker/contracts/notice.rb
|
|
825
827
|
- lib/pact_broker/contracts/service.rb
|
|
826
|
-
- lib/pact_broker/dashboard/service.rb
|
|
827
828
|
- lib/pact_broker/dataset.rb
|
|
828
829
|
- lib/pact_broker/dataset/page.rb
|
|
829
830
|
- lib/pact_broker/date_helper.rb
|
|
@@ -1002,6 +1003,7 @@ files:
|
|
|
1002
1003
|
- lib/pact_broker/pacts/generate_interaction_sha.rb
|
|
1003
1004
|
- lib/pact_broker/pacts/generate_sha.rb
|
|
1004
1005
|
- lib/pact_broker/pacts/head_pact.rb
|
|
1006
|
+
- lib/pact_broker/pacts/interactions/types.rb
|
|
1005
1007
|
- lib/pact_broker/pacts/latest_pact_publication_id_for_consumer_version.rb
|
|
1006
1008
|
- lib/pact_broker/pacts/lazy_loaders.rb
|
|
1007
1009
|
- lib/pact_broker/pacts/merger.rb
|
|
@@ -1035,7 +1037,7 @@ files:
|
|
|
1035
1037
|
- lib/pact_broker/services.rb
|
|
1036
1038
|
- lib/pact_broker/string_refinements.rb
|
|
1037
1039
|
- lib/pact_broker/tags/eager_loaders.rb
|
|
1038
|
-
- lib/pact_broker/tags/
|
|
1040
|
+
- lib/pact_broker/tags/head_pact_tag.rb
|
|
1039
1041
|
- lib/pact_broker/tags/repository.rb
|
|
1040
1042
|
- lib/pact_broker/tags/service.rb
|
|
1041
1043
|
- lib/pact_broker/tasks.rb
|
|
@@ -1048,7 +1050,7 @@ files:
|
|
|
1048
1050
|
- lib/pact_broker/test/test_data_builder.rb
|
|
1049
1051
|
- lib/pact_broker/ui.rb
|
|
1050
1052
|
- lib/pact_broker/ui/app.rb
|
|
1051
|
-
- lib/pact_broker/ui/controllers/
|
|
1053
|
+
- lib/pact_broker/ui/controllers/base.rb
|
|
1052
1054
|
- lib/pact_broker/ui/controllers/can_i_deploy.rb
|
|
1053
1055
|
- lib/pact_broker/ui/controllers/clusters.rb
|
|
1054
1056
|
- lib/pact_broker/ui/controllers/dashboard.rb
|
|
@@ -1060,7 +1062,6 @@ files:
|
|
|
1060
1062
|
- lib/pact_broker/ui/helpers/haml_helpers.rb
|
|
1061
1063
|
- lib/pact_broker/ui/helpers/matrix_helper.rb
|
|
1062
1064
|
- lib/pact_broker/ui/helpers/url_helper.rb
|
|
1063
|
-
- lib/pact_broker/ui/view_models/clusters.rb
|
|
1064
1065
|
- lib/pact_broker/ui/view_models/index_item.rb
|
|
1065
1066
|
- lib/pact_broker/ui/view_models/index_item_branch_head.rb
|
|
1066
1067
|
- lib/pact_broker/ui/view_models/index_item_provider_branch_head.rb
|
|
@@ -1289,7 +1290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1289
1290
|
- !ruby/object:Gem::Version
|
|
1290
1291
|
version: '0'
|
|
1291
1292
|
requirements: []
|
|
1292
|
-
rubygems_version:
|
|
1293
|
+
rubygems_version: 4.0.3
|
|
1293
1294
|
specification_version: 4
|
|
1294
1295
|
summary: See description
|
|
1295
1296
|
test_files: []
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|