pact_broker 2.102.2 → 2.103.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 +14 -0
- data/Gemfile +2 -2
- data/LICENSE.txt +22 -0
- data/lib/pact_broker/api/resources/error_test.rb +6 -2
- data/lib/pact_broker/app.rb +8 -1
- data/lib/pact_broker/config/runtime_configuration.rb +10 -0
- data/lib/pact_broker/db/version.rb +20 -3
- data/lib/pact_broker/doc/views/matrix.markdown +0 -1
- data/lib/pact_broker/matrix/deployment_status_summary.rb +9 -5
- data/lib/pact_broker/pacts/pact_version.rb +4 -2
- data/lib/pact_broker/pacts/repository.rb +1 -0
- data/lib/pact_broker/pacts/selector.rb +3 -1
- data/lib/pact_broker/pacts/verifiable_pact_messages.rb +2 -0
- data/lib/pact_broker/repositories.rb +77 -20
- data/lib/pact_broker/services.rb +24 -24
- data/lib/pact_broker/test/http_test_data_builder.rb +24 -5
- data/lib/pact_broker/version.rb +1 -1
- data/pact_broker.gemspec +1 -2
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a82ecff0b79c081b9f3712bde752b9983e7377eb8d48120616c8c3fcf237076c
|
4
|
+
data.tar.gz: cef4b3136255cbba17ad31e9001c935393989df848666ddb712e81884ac61003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb22f318c1f69dc91ceb7a84c940170600ceaf4a53e3ef65eabb7876fd2510867ad243cb1fb4cb22cf06e7b370f868cb01199697de73835879423d1371d6e19b
|
7
|
+
data.tar.gz: 87507ea9c45bc37318b98a9b8d53ab5a703eeffd1970cb111f3c8d639015f08442a0839376c4d59cc3e321005cb77da11466a1ca5340661905d66578c5aa669d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
<a name="v2.103.0"></a>
|
2
|
+
### v2.103.0 (2022-09-14)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* allow rack protection use and except options to be configured ([f44db585](/../../commit/f44db585))
|
7
|
+
|
8
|
+
* **can-i-deploy**
|
9
|
+
* only warn about missing version numbers if there are no selectors with a version number ([ac4e1e73](/../../commit/ac4e1e73))
|
10
|
+
|
11
|
+
#### Bug Fixes
|
12
|
+
|
13
|
+
* correctly identify database version when schema_migrations table is empty ([dcb59203](/../../commit/dcb59203))
|
14
|
+
|
1
15
|
<a name="v2.102.2"></a>
|
2
16
|
### v2.102.2 (2022-07-14)
|
3
17
|
|
data/Gemfile
CHANGED
@@ -26,11 +26,11 @@ group :test do
|
|
26
26
|
gem "rspec-its", "~>1.2"
|
27
27
|
gem "database_cleaner", "~>1.8", ">= 1.8.1"
|
28
28
|
gem "timecop", "~> 0.9"
|
29
|
-
gem "faraday", "~>0
|
30
|
-
gem "faraday_middleware", "~> 0.14"
|
29
|
+
gem "faraday", "~>2.0"
|
31
30
|
gem "docker-api", "~>1.34"
|
32
31
|
gem "approvals", ">=0.0.24", "<1.0.0"
|
33
32
|
gem "tzinfo", "~>2.0"
|
33
|
+
gem "faraday-retry", "~>2.0"
|
34
34
|
end
|
35
35
|
|
36
36
|
if ENV["INSTALL_MYSQL"] == "true"
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Bethany Skurrie
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -16,11 +16,15 @@ module PactBroker
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def to_json
|
19
|
-
raise PactBroker::TestError.new("Don't panic. This is a test API error.")
|
19
|
+
raise PactBroker::TestError.new("Don't panic. This is a test API error. #{Time.now.strftime("%Y-%m-%dT%H:%M:%S.000%:z")}")
|
20
20
|
end
|
21
21
|
|
22
22
|
def process_post
|
23
|
-
|
23
|
+
begin
|
24
|
+
raise "This is the cause test error"
|
25
|
+
rescue
|
26
|
+
raise PactBroker::TestError.new("Don't panic. This is a test API error. #{Time.now.strftime("%Y-%m-%dT%H:%M:%S.000%:z")}")
|
27
|
+
end
|
24
28
|
end
|
25
29
|
|
26
30
|
def policy_name
|
data/lib/pact_broker/app.rb
CHANGED
@@ -217,7 +217,14 @@ module PactBroker
|
|
217
217
|
|
218
218
|
def configure_rack_protection
|
219
219
|
if configuration.use_rack_protection
|
220
|
-
|
220
|
+
rack_protection_options = {
|
221
|
+
logger: logger,
|
222
|
+
use: configuration.rack_protection_use,
|
223
|
+
except: configuration.rack_protection_except
|
224
|
+
}.compact
|
225
|
+
|
226
|
+
logger.info("Configuring Rack::Protection", payload: rack_protection_options)
|
227
|
+
@app_builder.use Rack::Protection, rack_protection_options
|
221
228
|
|
222
229
|
is_hal_browser = ->(env) { env["PATH_INFO"] == "/hal-browser/browser.html" }
|
223
230
|
not_hal_browser = ->(env) { env["PATH_INFO"] != "/hal-browser/browser.html" }
|
@@ -68,6 +68,8 @@ module PactBroker
|
|
68
68
|
use_hal_browser: true,
|
69
69
|
enable_diagnostic_endpoints: true,
|
70
70
|
use_rack_protection: true,
|
71
|
+
rack_protection_use: nil,
|
72
|
+
rack_protection_except: [:path_traversal, :remote_token, :session_hijacking, :http_origin], # Beth: not sure why these are disabled
|
71
73
|
badge_provider_mode: :redirect,
|
72
74
|
enable_public_badge_access: false,
|
73
75
|
shields_io_base_url: "https://img.shields.io",
|
@@ -180,6 +182,14 @@ module PactBroker
|
|
180
182
|
super(value_to_string_array(features, "features").collect(&:downcase))
|
181
183
|
end
|
182
184
|
|
185
|
+
def rack_protection_use= rack_protection_use
|
186
|
+
super(value_to_string_array(rack_protection_use, "rack_protection_use")&.collect(&:to_sym))
|
187
|
+
end
|
188
|
+
|
189
|
+
def rack_protection_except= rack_protection_except
|
190
|
+
super(value_to_string_array(rack_protection_except, "rack_protection_except")&.collect(&:to_sym))
|
191
|
+
end
|
192
|
+
|
183
193
|
def webhook_certificates= webhook_certificates
|
184
194
|
if webhook_certificates.is_a?(Array)
|
185
195
|
super(webhook_certificates.collect(&:symbolize_keys))
|
@@ -3,10 +3,27 @@ module PactBroker
|
|
3
3
|
class Version
|
4
4
|
def self.call database_connection
|
5
5
|
if database_connection.tables.include?(:schema_migrations)
|
6
|
-
|
7
|
-
last_migration_filename.split("_", 2).first.to_i
|
6
|
+
version_from_schema_migrations(database_connection)
|
8
7
|
elsif database_connection.tables.include?(:schema_info)
|
9
|
-
database_connection
|
8
|
+
version_from_schema_info(database_connection)
|
9
|
+
else
|
10
|
+
0
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private_class_method def self.version_from_schema_migrations(database_connection)
|
15
|
+
last_migration = database_connection[:schema_migrations].order(:filename).last
|
16
|
+
if last_migration
|
17
|
+
last_migration[:filename].split("_", 2).first.to_i
|
18
|
+
else
|
19
|
+
0
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private_class_method def self.version_from_schema_info(database_connection)
|
24
|
+
schema_info = database_connection[:schema_info].first
|
25
|
+
if schema_info
|
26
|
+
schema_info[:version]
|
10
27
|
else
|
11
28
|
0
|
12
29
|
end
|
@@ -6,7 +6,6 @@ This resource returns the "cartesian join" of every pact publication and every v
|
|
6
6
|
|
7
7
|
If you need to use this API, consider calling the `/can-i-deploy` resource instead, as it provides an interface that is easier to understand.
|
8
8
|
|
9
|
-
|
10
9
|
## Matrix selectors and options
|
11
10
|
|
12
11
|
Selectors are the way we specify which pacticipants and versions we want to view the matrix for. The best way to understand them is to imagine that we start with a Matrix table that contains the pacts/verification results for every consumer and provider in the Pact Broker.
|
@@ -75,11 +75,15 @@ module PactBroker
|
|
75
75
|
|
76
76
|
def selector_without_pacticipant_version_number_specified?
|
77
77
|
# If only the pacticipant name is specified, it can't be a can-i-deploy query, must be a matrix UI query
|
78
|
-
resolved_selectors
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
if resolved_selectors.select(&:specified?).reject(&:only_pacticipant_name_specified?).any?
|
79
|
+
# There should be at least one selector with a version number specified
|
80
|
+
resolved_selectors
|
81
|
+
.select(&:specified?)
|
82
|
+
.select(&:pacticipant_version_specified_in_original_selector?)
|
83
|
+
.empty?
|
84
|
+
else
|
85
|
+
false
|
86
|
+
end
|
83
87
|
end
|
84
88
|
|
85
89
|
|
@@ -29,7 +29,8 @@ module PactBroker
|
|
29
29
|
dataset: LATEST_MAIN_BRANCH_VERIFICATION,
|
30
30
|
key: :pact_version_id,
|
31
31
|
primary_key: :id,
|
32
|
-
eager_block: lambda { | ds | ds.from_provider_main_branch.latest_by_pact_version }
|
32
|
+
eager_block: lambda { | ds | ds.from_provider_main_branch.latest_by_pact_version },
|
33
|
+
allow_eager: true
|
33
34
|
)
|
34
35
|
|
35
36
|
one_to_one(:latest_verification,
|
@@ -37,7 +38,8 @@ module PactBroker
|
|
37
38
|
read_only: true,
|
38
39
|
dataset: LATEST_VERIFICATION_DATASET,
|
39
40
|
key: :pact_version_id, primary_key: :id,
|
40
|
-
eager_block: lambda { | ds | ds.latest_by_pact_version }
|
41
|
+
eager_block: lambda { | ds | ds.latest_by_pact_version },
|
42
|
+
allow_eager: true
|
41
43
|
)
|
42
44
|
|
43
45
|
# do not eager load this - it won't work because of the limit(1)
|
@@ -29,7 +29,9 @@ module PactBroker
|
|
29
29
|
# verifiable_pact_messages, so don't need the "for_consumer" sub category
|
30
30
|
# rubocop: disable Metrics/CyclomaticComplexity
|
31
31
|
def type
|
32
|
-
if
|
32
|
+
if latest_for_main_branch?
|
33
|
+
:latest_for_main_branch
|
34
|
+
elsif latest_for_branch?
|
33
35
|
:latest_for_branch
|
34
36
|
elsif matching_branch?
|
35
37
|
:matching_branch
|
@@ -252,6 +252,8 @@ module PactBroker
|
|
252
252
|
else
|
253
253
|
"latest with tag #{selector.tag}"
|
254
254
|
end
|
255
|
+
elsif selector.latest_for_main_branch?
|
256
|
+
"latest from main branch"
|
255
257
|
elsif selector.latest_for_branch?
|
256
258
|
if selector.fallback_branch?
|
257
259
|
"latest from branch #{selector.fallback_branch}"
|
@@ -3,55 +3,112 @@ require "pact_broker/pacts/repository"
|
|
3
3
|
|
4
4
|
module PactBroker
|
5
5
|
module Repositories
|
6
|
+
REPOSITORY_FACTORIES = {}
|
7
|
+
|
8
|
+
extend self
|
9
|
+
|
10
|
+
def register_repository(name, &block)
|
11
|
+
REPOSITORY_FACTORIES[name] = block
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_repository(name)
|
15
|
+
REPOSITORY_FACTORIES[name].call
|
16
|
+
end
|
17
|
+
|
6
18
|
def pacticipant_repository
|
7
|
-
|
8
|
-
Pacticipants::Repository.new
|
19
|
+
get_repository(:pacticipant_repository)
|
9
20
|
end
|
10
21
|
|
11
22
|
def version_repository
|
12
|
-
|
13
|
-
Versions::Repository.new
|
23
|
+
get_repository(:version_repository)
|
14
24
|
end
|
15
25
|
|
16
26
|
def pact_repository
|
17
|
-
|
27
|
+
get_repository(:pact_repository)
|
18
28
|
end
|
19
29
|
|
20
30
|
def tag_repository
|
21
|
-
|
22
|
-
Tags::Repository.new
|
31
|
+
get_repository(:tag_repository)
|
23
32
|
end
|
24
33
|
|
25
34
|
def label_repository
|
26
|
-
|
27
|
-
Labels::Repository.new
|
35
|
+
get_repository(:label_repository)
|
28
36
|
end
|
29
37
|
|
30
38
|
def webhook_repository
|
31
|
-
|
32
|
-
Webhooks::Repository.new
|
39
|
+
get_repository(:webhook_repository)
|
33
40
|
end
|
34
41
|
|
35
42
|
def verification_repository
|
36
|
-
|
37
|
-
Verifications::Repository.new
|
43
|
+
get_repository(:verification_repository)
|
38
44
|
end
|
39
45
|
|
40
46
|
def matrix_repository
|
41
|
-
|
42
|
-
Matrix::Repository.new
|
47
|
+
get_repository(:matrix_repository)
|
43
48
|
end
|
44
49
|
|
45
50
|
def branch_version_repository
|
46
|
-
|
47
|
-
PactBroker::Versions::BranchVersionRepository.new
|
51
|
+
get_repository(:branch_version_repository)
|
48
52
|
end
|
49
53
|
|
50
54
|
def integration_repository
|
51
|
-
|
52
|
-
PactBroker::Integrations::Repository.new
|
55
|
+
get_repository(:integration_repository)
|
53
56
|
end
|
54
57
|
|
55
|
-
|
58
|
+
# rubocop: disable Metrics/MethodLength
|
59
|
+
def register_default_repositories
|
60
|
+
register_repository(:pacticipant_repository) do
|
61
|
+
require "pact_broker/pacticipants/repository"
|
62
|
+
Pacticipants::Repository.new
|
63
|
+
end
|
64
|
+
|
65
|
+
register_repository(:version_repository) do
|
66
|
+
require "pact_broker/versions/repository"
|
67
|
+
Versions::Repository.new
|
68
|
+
end
|
69
|
+
|
70
|
+
register_repository(:pact_repository) do
|
71
|
+
PactBroker::Pacts::Repository.new
|
72
|
+
end
|
73
|
+
|
74
|
+
register_repository(:tag_repository) do
|
75
|
+
require "pact_broker/tags/repository"
|
76
|
+
Tags::Repository.new
|
77
|
+
end
|
78
|
+
|
79
|
+
register_repository(:label_repository) do
|
80
|
+
require "pact_broker/labels/repository"
|
81
|
+
Labels::Repository.new
|
82
|
+
end
|
83
|
+
|
84
|
+
register_repository(:webhook_repository) do
|
85
|
+
require "pact_broker/webhooks/repository"
|
86
|
+
Webhooks::Repository.new
|
87
|
+
end
|
88
|
+
|
89
|
+
register_repository(:verification_repository) do
|
90
|
+
require "pact_broker/verifications/repository"
|
91
|
+
Verifications::Repository.new
|
92
|
+
end
|
93
|
+
|
94
|
+
register_repository(:matrix_repository) do
|
95
|
+
require "pact_broker/matrix/repository"
|
96
|
+
Matrix::Repository.new
|
97
|
+
end
|
98
|
+
|
99
|
+
register_repository(:branch_version_repository) do
|
100
|
+
require "pact_broker/versions/branch_version_repository"
|
101
|
+
PactBroker::Versions::BranchVersionRepository.new
|
102
|
+
end
|
103
|
+
|
104
|
+
register_repository(:integration_repository) do
|
105
|
+
require "pact_broker/integrations/repository"
|
106
|
+
PactBroker::Integrations::Repository.new
|
107
|
+
end
|
108
|
+
|
109
|
+
# rubocop: enable Metrics/MethodLength
|
110
|
+
end
|
56
111
|
end
|
57
112
|
end
|
113
|
+
|
114
|
+
PactBroker::Repositories.register_default_repositories
|
data/lib/pact_broker/services.rb
CHANGED
@@ -1,96 +1,96 @@
|
|
1
1
|
module PactBroker
|
2
2
|
module Services
|
3
3
|
|
4
|
-
|
4
|
+
SERVICE_FACTORIES = {}
|
5
5
|
|
6
6
|
extend self
|
7
7
|
|
8
8
|
def register_service(name, &block)
|
9
|
-
|
9
|
+
SERVICE_FACTORIES[name] = block
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
|
12
|
+
def get_service(name)
|
13
|
+
SERVICE_FACTORIES[name].call
|
14
14
|
end
|
15
15
|
|
16
16
|
def index_service
|
17
|
-
|
17
|
+
get_service(:index_service)
|
18
18
|
end
|
19
19
|
|
20
20
|
def pact_service
|
21
|
-
|
21
|
+
get_service(:pact_service)
|
22
22
|
end
|
23
23
|
|
24
24
|
def pacticipant_service
|
25
|
-
|
25
|
+
get_service(:pacticipant_service)
|
26
26
|
end
|
27
27
|
|
28
28
|
def tag_service
|
29
|
-
|
29
|
+
get_service(:tag_service)
|
30
30
|
end
|
31
31
|
|
32
32
|
def label_service
|
33
|
-
|
33
|
+
get_service(:label_service)
|
34
34
|
end
|
35
35
|
|
36
36
|
def group_service
|
37
|
-
|
37
|
+
get_service(:group_service)
|
38
38
|
end
|
39
39
|
|
40
40
|
def webhook_service
|
41
|
-
|
41
|
+
get_service(:webhook_service)
|
42
42
|
end
|
43
43
|
|
44
44
|
def version_service
|
45
|
-
|
45
|
+
get_service(:version_service)
|
46
46
|
end
|
47
47
|
|
48
48
|
def verification_service
|
49
|
-
|
49
|
+
get_service(:verification_service)
|
50
50
|
end
|
51
51
|
|
52
52
|
def badge_service
|
53
|
-
|
53
|
+
get_service(:badge_service)
|
54
54
|
end
|
55
55
|
|
56
56
|
def matrix_service
|
57
|
-
|
57
|
+
get_service(:matrix_service)
|
58
58
|
end
|
59
59
|
|
60
60
|
def certificate_service
|
61
|
-
|
61
|
+
get_service(:certificate_service)
|
62
62
|
end
|
63
63
|
|
64
64
|
def integration_service
|
65
|
-
|
65
|
+
get_service(:integration_service)
|
66
66
|
end
|
67
67
|
|
68
68
|
def webhook_trigger_service
|
69
|
-
|
69
|
+
get_service(:webhook_trigger_service)
|
70
70
|
end
|
71
71
|
|
72
72
|
def metrics_service
|
73
|
-
|
73
|
+
get_service(:metrics_service)
|
74
74
|
end
|
75
75
|
|
76
76
|
def environment_service
|
77
|
-
|
77
|
+
get_service(:environment_service)
|
78
78
|
end
|
79
79
|
|
80
80
|
def deployed_version_service
|
81
|
-
|
81
|
+
get_service(:deployed_version_service)
|
82
82
|
end
|
83
83
|
|
84
84
|
def released_version_service
|
85
|
-
|
85
|
+
get_service(:released_version_service)
|
86
86
|
end
|
87
87
|
|
88
88
|
def contract_service
|
89
|
-
|
89
|
+
get_service(:contract_service)
|
90
90
|
end
|
91
91
|
|
92
92
|
def branch_service
|
93
|
-
|
93
|
+
get_service(:branch_service)
|
94
94
|
end
|
95
95
|
|
96
96
|
# rubocop: disable Metrics/MethodLength
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require "faraday"
|
2
|
-
require "faraday_middleware"
|
3
2
|
require "logger"
|
4
3
|
require "erb"
|
5
4
|
require "yaml"
|
@@ -82,7 +81,7 @@ module PactBroker
|
|
82
81
|
available_environments = version_body["_links"]["pb:record-deployment"].collect{ | relation | relation["name"]}.join
|
83
82
|
puts "Environment with name #{environment_name} not found. Available environments: #{available_environments}"
|
84
83
|
else
|
85
|
-
client.post(environment_relation["href"]).tap { |response| check_for_error(response) }
|
84
|
+
client.post(environment_relation["href"], {}).tap { |response| check_for_error(response) }
|
86
85
|
end
|
87
86
|
|
88
87
|
separate
|
@@ -142,7 +141,7 @@ module PactBroker
|
|
142
141
|
self
|
143
142
|
end
|
144
143
|
|
145
|
-
def
|
144
|
+
def publish_pact_the_old_way(consumer: last_consumer_name, consumer_version:, provider: last_provider_name, content_id:, tag: nil, branch: nil)
|
146
145
|
@last_consumer_name = consumer
|
147
146
|
@last_provider_name = provider
|
148
147
|
@last_consumer_version_number = consumer_version
|
@@ -162,6 +161,19 @@ module PactBroker
|
|
162
161
|
self
|
163
162
|
end
|
164
163
|
|
164
|
+
def publish_contract_and_verify(consumer:, provider:, consumer_version:, content_id: nil, consumer_branch: "main", provider_version:, provider_branch: "main", success: true)
|
165
|
+
publish_contract(consumer: consumer, provider: provider, consumer_version: consumer_version, content_id: content_id || SecureRandom.rand.to_s, branch: consumer_branch)
|
166
|
+
.get_pacts_for_verification(provider: provider, consumer_version_selectors: [ { branch: consumer_branch }])
|
167
|
+
.verify_pact(
|
168
|
+
provider: provider,
|
169
|
+
provider_version_branch: provider_branch,
|
170
|
+
provider_version: provider_version,
|
171
|
+
success: success
|
172
|
+
)
|
173
|
+
end
|
174
|
+
|
175
|
+
alias_method :publish_pact, :publish_pact_the_old_way
|
176
|
+
|
165
177
|
def get_pacts_for_verification(provider: last_provider_name, provider_version_tag: nil, provider_version_branch: nil, consumer_version_selectors: nil, enable_pending: nil, include_wip_pacts_since: nil)
|
166
178
|
@last_provider_name = provider
|
167
179
|
@last_provider_version_tag = provider_version_tag
|
@@ -227,6 +239,7 @@ module PactBroker
|
|
227
239
|
create_webhook_for_event(**kwargs)
|
228
240
|
end
|
229
241
|
|
242
|
+
# rubocop: disable Metrics/MethodLength
|
230
243
|
def create_webhook_for_event(uuid: nil, url: "https://postman-echo.com/post", body: nil, provider: nil, consumer: nil, event_name:)
|
231
244
|
require "securerandom"
|
232
245
|
webhook_prefix = "global " if provider.nil? && consumer.nil?
|
@@ -237,11 +250,12 @@ module PactBroker
|
|
237
250
|
"eventName" => "${pactbroker.eventName}",
|
238
251
|
"consumerName" => "${pactbroker.consumerName}",
|
239
252
|
"consumerVersionNumber" => "${pactbroker.consumerVersionNumber}",
|
240
|
-
"
|
253
|
+
"consumerVersionTags" => "${pactbroker.consumerVersionTags}",
|
254
|
+
"consumerVersionBranch" => "${pactbroker.consumerVersionBranch}",
|
241
255
|
"providerName" => "${pactbroker.providerName}",
|
242
256
|
"providerVersionNumber" => "${pactbroker.providerVersionNumber}",
|
257
|
+
"providerVersionBranch" => "${pactbroker.providerVersionBranch}",
|
243
258
|
"providerVersionDescriptions" => "${pactbroker.providerVersionDescriptions}",
|
244
|
-
"consumerVersionBranch" => "${pactbroker.consumerVersionBranch}",
|
245
259
|
}
|
246
260
|
request_body = {
|
247
261
|
"consumer" => consumer,
|
@@ -259,11 +273,16 @@ module PactBroker
|
|
259
273
|
separate
|
260
274
|
self
|
261
275
|
end
|
276
|
+
# rubocop: enable Metrics/MethodLength
|
262
277
|
|
263
278
|
def create_global_webhook_for_contract_changed(uuid: nil, url: "https://postman-echo.com/post", body: nil)
|
264
279
|
create_global_webhook_for_event(uuid: uuid, url: url, body: body, event_name: "contract_content_changed")
|
265
280
|
end
|
266
281
|
|
282
|
+
def create_global_webhook_for_contract_requiring_verification_published(uuid: nil, url: "https://postman-echo.com/post", body: nil)
|
283
|
+
create_global_webhook_for_event(uuid: uuid, url: url, body: body, event_name: "contract_requiring_verification_published")
|
284
|
+
end
|
285
|
+
|
267
286
|
def create_global_webhook_for_anything_published(uuid: nil, url: "https://postman-echo.com/post")
|
268
287
|
puts "Creating global webhook for contract changed event with uuid #{uuid}"
|
269
288
|
uuid ||= SecureRandom.uuid
|
data/lib/pact_broker/version.rb
CHANGED
data/pact_broker.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.files = begin
|
20
20
|
if Dir.exist?(".git")
|
21
21
|
Dir.chdir(File.expand_path(__dir__)) do
|
22
|
-
include_patterns = %w[lib/**/* db/**/* docs/**/*.md public/**/* vendor/**/* README.md CHANGELOG.md Gemfile pact_broker.gemspec]
|
22
|
+
include_patterns = %w[lib/**/* db/**/* docs/**/*.md public/**/* vendor/**/* LICENSE.txt README.md CHANGELOG.md Gemfile pact_broker.gemspec]
|
23
23
|
exclude_patterns = %w[db/test/**/*]
|
24
24
|
include_list = include_patterns.flat_map{ | pattern | Dir.glob(pattern) } - exclude_patterns.flat_map{ | pattern | Dir.glob(pattern) }
|
25
25
|
|
@@ -50,7 +50,6 @@ Gem::Specification.new do |gem|
|
|
50
50
|
gem.license = "MIT"
|
51
51
|
|
52
52
|
#gem.add_runtime_dependency 'pact'
|
53
|
-
gem.add_runtime_dependency "httparty", "~> 0.14"
|
54
53
|
gem.add_runtime_dependency "json", "~> 2.3"
|
55
54
|
gem.add_runtime_dependency "roar", "~> 1.1"
|
56
55
|
gem.add_runtime_dependency "reform", "~> 2.3.3"
|
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.103.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bethany Skurrie
|
@@ -10,22 +10,8 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-09-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: httparty
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
requirements:
|
19
|
-
- - "~>"
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0.14'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
requirements:
|
26
|
-
- - "~>"
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '0.14'
|
29
15
|
- !ruby/object:Gem::Dependency
|
30
16
|
name: json
|
31
17
|
requirement: !ruby/object:Gem::Requirement
|
@@ -424,6 +410,7 @@ extra_rdoc_files: []
|
|
424
410
|
files:
|
425
411
|
- CHANGELOG.md
|
426
412
|
- Gemfile
|
413
|
+
- LICENSE.txt
|
427
414
|
- README.md
|
428
415
|
- db/ddl_statements.rb
|
429
416
|
- db/ddl_statements/all_verifications.rb
|
@@ -1240,7 +1227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1240
1227
|
- !ruby/object:Gem::Version
|
1241
1228
|
version: '0'
|
1242
1229
|
requirements: []
|
1243
|
-
rubygems_version: 3.3.
|
1230
|
+
rubygems_version: 3.3.22
|
1244
1231
|
signing_key:
|
1245
1232
|
specification_version: 4
|
1246
1233
|
summary: See description
|