pact_broker 2.59.2 → 2.63.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 +53 -0
- data/README.md +1 -1
- data/db/migrations/20200922_add_event_to_triggered_webhook.rb +5 -0
- data/lib/pact_broker/api.rb +1 -0
- data/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema.rb +10 -3
- data/lib/pact_broker/api/contracts/verifiable_pacts_query_schema.rb +1 -0
- data/lib/pact_broker/api/decorators/pacticipant_decorator.rb +16 -0
- data/lib/pact_broker/api/decorators/triggered_webhook_decorator.rb +1 -0
- data/lib/pact_broker/api/decorators/verifiable_pact_decorator.rb +5 -5
- data/lib/pact_broker/api/pact_broker_urls.rb +15 -4
- data/lib/pact_broker/api/resources/all_webhooks.rb +1 -6
- data/lib/pact_broker/api/resources/can_i_deploy.rb +0 -4
- data/lib/pact_broker/api/resources/can_i_deploy_badge.rb +85 -0
- data/lib/pact_broker/api/resources/default_base_resource.rb +9 -0
- data/lib/pact_broker/api/resources/error_handler.rb +4 -4
- data/lib/pact_broker/api/resources/error_test.rb +4 -2
- data/lib/pact_broker/api/resources/group.rb +0 -4
- data/lib/pact_broker/api/resources/index.rb +11 -8
- data/lib/pact_broker/api/resources/integration.rb +0 -4
- data/lib/pact_broker/api/resources/integrations.rb +0 -4
- data/lib/pact_broker/api/resources/label.rb +0 -8
- data/lib/pact_broker/api/resources/latest_pact.rb +1 -5
- data/lib/pact_broker/api/resources/latest_pacts.rb +1 -5
- data/lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb +0 -4
- data/lib/pact_broker/api/resources/matrix.rb +4 -0
- data/lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb +4 -0
- data/lib/pact_broker/api/resources/metrics.rb +4 -0
- data/lib/pact_broker/api/resources/pact.rb +4 -8
- data/lib/pact_broker/api/resources/pact_content_diff.rb +4 -0
- data/lib/pact_broker/api/resources/pact_triggered_webhooks.rb +5 -1
- data/lib/pact_broker/api/resources/pact_versions.rb +5 -1
- data/lib/pact_broker/api/resources/pact_webhooks.rb +5 -1
- data/lib/pact_broker/api/resources/pact_webhooks_status.rb +5 -1
- data/lib/pact_broker/api/resources/pacticipant.rb +5 -9
- data/lib/pact_broker/api/resources/pacticipants.rb +0 -4
- data/lib/pact_broker/api/resources/pacticipants_for_label.rb +4 -0
- data/lib/pact_broker/api/resources/previous_distinct_pact_version.rb +4 -9
- data/lib/pact_broker/api/resources/provider_pacts.rb +1 -5
- data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +8 -6
- data/lib/pact_broker/api/resources/relationships.rb +4 -2
- data/lib/pact_broker/api/resources/tag.rb +5 -5
- data/lib/pact_broker/api/resources/tagged_pact_versions.rb +5 -2
- data/lib/pact_broker/api/resources/triggered_webhook_logs.rb +7 -5
- data/lib/pact_broker/api/resources/verification.rb +5 -5
- data/lib/pact_broker/api/resources/verification_triggered_webhooks.rb +6 -12
- data/lib/pact_broker/api/resources/verifications.rb +5 -5
- data/lib/pact_broker/api/resources/version.rb +11 -12
- data/lib/pact_broker/api/resources/versions.rb +5 -2
- data/lib/pact_broker/api/resources/webhook.rb +4 -0
- data/lib/pact_broker/api/resources/webhook_execution.rb +4 -0
- data/lib/pact_broker/api/resources/webhooks.rb +5 -1
- data/lib/pact_broker/app.rb +1 -1
- data/lib/pact_broker/badges/service.rb +12 -1
- data/lib/pact_broker/certificates/service.rb +2 -2
- data/lib/pact_broker/configuration.rb +12 -1
- data/lib/pact_broker/db.rb +14 -0
- data/lib/pact_broker/db/table_dependency_calculator.rb +45 -0
- data/lib/pact_broker/doc/views/pacticipant/can-i-deploy-badge.markdown +9 -0
- data/lib/pact_broker/doc/views/provider-pacts-for-verification.markdown +78 -0
- data/lib/pact_broker/domain/pact.rb +9 -0
- data/lib/pact_broker/domain/webhook_request.rb +3 -1
- data/lib/pact_broker/pacts/build_verifiable_pact_notices.rb +7 -4
- data/lib/pact_broker/pacts/content.rb +28 -4
- data/lib/pact_broker/pacts/repository.rb +25 -31
- data/lib/pact_broker/pacts/selector.rb +8 -0
- data/lib/pact_broker/test/test_data_builder.rb +1 -1
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/webhooks/job.rb +8 -2
- data/lib/pact_broker/webhooks/repository.rb +3 -2
- data/lib/pact_broker/webhooks/service.rb +2 -2
- data/lib/pact_broker/webhooks/triggered_webhook.rb +1 -3
- data/lib/pact_broker/webhooks/webhook_event.rb +1 -2
- data/script/seed.rb +39 -17
- data/spec/features/get_can_i_deploy_badge_spec.rb +13 -0
- data/spec/features/get_matrix_badge_spec.rb +1 -1
- data/spec/features/get_provider_pacts_for_verification_spec.rb +8 -0
- data/spec/lib/pact_broker/api/contracts/verifiable_pacts_json_query_schema_spec.rb +23 -4
- data/spec/lib/pact_broker/api/decorators/pact_webhooks_status_decorator_spec.rb +2 -1
- data/spec/lib/pact_broker/api/decorators/triggered_webhook_decorator_spec.rb +3 -1
- data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +15 -0
- data/spec/lib/pact_broker/api/resources/can_i_deploy_badge_spec.rb +80 -0
- data/spec/lib/pact_broker/api/resources/default_base_resource_spec.rb +10 -5
- data/spec/lib/pact_broker/api/resources/provider_pacts_for_verification_spec.rb +1 -1
- data/spec/lib/pact_broker/api/resources/verification_triggered_webhooks_spec.rb +0 -1
- data/spec/lib/pact_broker/badges/service_spec.rb +1 -1
- data/spec/lib/pact_broker/certificates/service_spec.rb +3 -3
- data/spec/lib/pact_broker/pacts/content_spec.rb +82 -0
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_fallback_spec.rb +14 -0
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +62 -0
- data/spec/lib/pact_broker/webhooks/job_spec.rb +19 -1
- data/spec/lib/pact_broker/webhooks/repository_spec.rb +3 -2
- data/spec/lib/pact_broker/webhooks/service_spec.rb +2 -2
- data/spec/support/database_cleaner.rb +1 -5
- data/tasks/database.rb +1 -0
- data/tasks/database/table_dependency_calculator.rb +4 -41
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61338a93bd65ffa3ec70f4fdfd9b509a0d5c0608dce8cea3f779e3ac22151412
|
4
|
+
data.tar.gz: 99819023ba051657020d314fe6d3005a04660d70467a57c5b5369a08a5525e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7da446c51346413782377eb409c2d3159fcb322147d675324126243bfb8b115ff042d210b3cf25ee46ebe73093611e4de85db03f243c5ffb06299239d6aff637
|
7
|
+
data.tar.gz: 6b191f39b782bf811d58e15d149fa5e786227e6a86d93c0f8888a6134b992d6f60ad58ff2b2b6cf84ba612b72368cf569471b9214b85f7ce173e18872e89ddec
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,56 @@
|
|
1
|
+
<a name="v2.63.0"></a>
|
2
|
+
### v2.63.0 (2020-09-25)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* allow label of can-i-deploy badge to be customised by setting the label query parameter ([ed544f94](/../../commit/ed544f94))
|
7
|
+
* add badges for can-i-deploy ([887a9ca3](/../../commit/887a9ca3))
|
8
|
+
|
9
|
+
<a name="v2.62.0"></a>
|
10
|
+
### v2.62.0 (2020-09-23)
|
11
|
+
|
12
|
+
#### Features
|
13
|
+
|
14
|
+
* **webhooks**
|
15
|
+
* remove user-agent and accept-encoding headers which the Ruby HTTP library adds by default ([ef25b88c](/../../commit/ef25b88c))
|
16
|
+
|
17
|
+
* add event name to triggered webhook ([ecce16fd](/../../commit/ecce16fd))
|
18
|
+
|
19
|
+
#### Bug Fixes
|
20
|
+
|
21
|
+
* **webhooks**
|
22
|
+
* use path to initialise http request, rather than full URL ([ecbac9a6](/../../commit/ecbac9a6))
|
23
|
+
|
24
|
+
* gracefully handle corrupt webhook metadata in pact URL ([ba94c355](/../../commit/ba94c355))
|
25
|
+
|
26
|
+
<a name="v2.61.0"></a>
|
27
|
+
### v2.61.0 (2020-09-12)
|
28
|
+
|
29
|
+
#### Features
|
30
|
+
|
31
|
+
* add back support for GET requests to the 'pacts for verification' API with a deprecation notice in the response ([8f45cc9f](/../../commit/8f45cc9f))
|
32
|
+
|
33
|
+
<a name="v2.60.1"></a>
|
34
|
+
### v2.60.1 (2020-09-10)
|
35
|
+
|
36
|
+
#### Bug Fixes
|
37
|
+
|
38
|
+
* href for beta:provider-pacts-for-verification ([3949fdd1](/../../commit/3949fdd1))
|
39
|
+
|
40
|
+
<a name="v2.60.0"></a>
|
41
|
+
### v2.60.0 (2020-09-08)
|
42
|
+
|
43
|
+
#### Features
|
44
|
+
|
45
|
+
* **pacts for verification**
|
46
|
+
* add deprecation title to beta:provider-pacts-for-verification relation ([47a61f69](/../../commit/47a61f69))
|
47
|
+
* do not require environment variable feature toggle to enable feature ([7d0fe1ea](/../../commit/7d0fe1ea))
|
48
|
+
* allow consumer to be specified with fallback tags, and overall latest to be specified with or without a consumer ([2d52d173](/../../commit/2d52d173))
|
49
|
+
|
50
|
+
#### Bug Fixes
|
51
|
+
|
52
|
+
* correctly handle new test results format when merging test results with pact contents ([b35ab71b](/../../commit/b35ab71b))
|
53
|
+
|
1
54
|
<a name="v2.59.2"></a>
|
2
55
|
### v2.59.2 (2020-08-06)
|
3
56
|
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
[![Code Climate](https://codeclimate.com/github/pact-foundation/pact_broker/badges/gpa.svg)](https://codeclimate.com/github/pact-foundation/pact_broker)
|
7
7
|
[![Test Coverage](https://codeclimate.com/github/pact-foundation/pact_broker/badges/coverage.svg)](https://codeclimate.com/github/pact-foundation/pact_broker/coverage)
|
8
8
|
|
9
|
-
The Pact Broker is an application for sharing
|
9
|
+
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.
|
10
10
|
|
11
11
|
<br/>
|
12
12
|
<a href="https:/pactflow.io/?utm_source=github&utm_campaign=pact_broker_intro"><img src="docs/images/Pactflow logo - black small.png"></a>
|
data/lib/pact_broker/api.rb
CHANGED
@@ -71,6 +71,7 @@ module PactBroker
|
|
71
71
|
add ['pacticipants', :pacticipant_name, 'versions'], Api::Resources::Versions, {resource_name: "pacticipant_versions"}
|
72
72
|
add ['pacticipants', :pacticipant_name, 'versions', :pacticipant_version_number], Api::Resources::Version, {resource_name: "pacticipant_version"}
|
73
73
|
add ['pacticipants', :pacticipant_name, 'latest-version', :tag], Api::Resources::Version, {resource_name: "latest_tagged_pacticipant_version"}
|
74
|
+
add ['pacticipants', :pacticipant_name, 'latest-version', :tag, 'can-i-deploy', 'to', :to, 'badge'], Api::Resources::CanIDeployBadge, { resource_name: "can_i_deploy_badge" }
|
74
75
|
add ['pacticipants', :pacticipant_name, 'latest-version'], Api::Resources::Version, {resource_name: "latest_pacticipant_version"}
|
75
76
|
add ['pacticipants', :pacticipant_name, 'versions', :pacticipant_version_number, 'tags', :tag_name], Api::Resources::Tag, {resource_name: "pacticipant_version_tag"}
|
76
77
|
add ['pacticipants', :pacticipant_name, 'labels', :label_name], Api::Resources::Label, {resource_name: "pacticipant_label"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'dry-validation'
|
2
2
|
require 'pact_broker/hash_refinements'
|
3
|
+
require 'pact_broker/string_refinements'
|
3
4
|
require 'pact_broker/api/contracts/dry_validation_workarounds'
|
4
5
|
require 'pact_broker/api/contracts/dry_validation_predicates'
|
5
6
|
|
@@ -9,6 +10,7 @@ module PactBroker
|
|
9
10
|
class VerifiablePactsJSONQuerySchema
|
10
11
|
extend DryValidationWorkarounds
|
11
12
|
using PactBroker::HashRefinements
|
13
|
+
using PactBroker::StringRefinements
|
12
14
|
|
13
15
|
SCHEMA = Dry::Validation.Schema do
|
14
16
|
configure do
|
@@ -24,7 +26,7 @@ module PactBroker
|
|
24
26
|
# end
|
25
27
|
# end
|
26
28
|
|
27
|
-
|
29
|
+
optional(:tag).filled(:str?)
|
28
30
|
optional(:latest).filled(included_in?: [true, false])
|
29
31
|
optional(:fallbackTag).filled(:str?)
|
30
32
|
optional(:consumer).filled(:str?, :not_blank?)
|
@@ -54,8 +56,9 @@ module PactBroker
|
|
54
56
|
errors << "fallbackTag can only be set if latest is true (at index #{index})"
|
55
57
|
end
|
56
58
|
|
57
|
-
|
58
|
-
|
59
|
+
|
60
|
+
if not_provided?(selector[:tag]) && selector[:latest] != true
|
61
|
+
errors << "latest must be true, or a tag must be provided (at index #{index})"
|
59
62
|
end
|
60
63
|
end
|
61
64
|
if errors.any?
|
@@ -64,6 +67,10 @@ module PactBroker
|
|
64
67
|
end
|
65
68
|
end
|
66
69
|
end
|
70
|
+
|
71
|
+
def self.not_provided?(value)
|
72
|
+
value.nil? || value.blank?
|
73
|
+
end
|
67
74
|
end
|
68
75
|
end
|
69
76
|
end
|
@@ -58,6 +58,22 @@ module PactBroker
|
|
58
58
|
}
|
59
59
|
end
|
60
60
|
|
61
|
+
link :'pb:can-i-deploy-badge' do | options |
|
62
|
+
{
|
63
|
+
title: "Can I Deploy #{represented.name} badge",
|
64
|
+
href: templated_can_i_deploy_badge_url(represented.name, options[:base_url]),
|
65
|
+
templated: true
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
curies do | options |
|
70
|
+
[{
|
71
|
+
name: :pb,
|
72
|
+
href: options[:base_url] + '/doc/{rel}?context=pacticipant',
|
73
|
+
templated: true
|
74
|
+
}]
|
75
|
+
end
|
76
|
+
|
61
77
|
def to_hash options
|
62
78
|
h = super
|
63
79
|
dasherized = DasherizedVersionDecorator.new(represented).to_hash(options)
|
@@ -9,6 +9,7 @@ module PactBroker
|
|
9
9
|
property :number_of_attempts_made, as: :attemptsMade
|
10
10
|
property :number_of_attempts_remaining, as: :attemptsRemaining
|
11
11
|
property :trigger_type, as: :triggerType
|
12
|
+
property :event_name, as: :eventName
|
12
13
|
|
13
14
|
property :created_at, as: :triggeredAt
|
14
15
|
|
@@ -14,14 +14,14 @@ module PactBroker
|
|
14
14
|
|
15
15
|
property :pending,
|
16
16
|
if: ->(context) { context[:options][:user_options][:include_pending_status] }
|
17
|
-
property :wip,
|
18
|
-
|
19
|
-
property :notices,
|
20
|
-
|
17
|
+
property :wip,
|
18
|
+
if: -> (context) { context[:represented].wip }
|
19
|
+
property :notices,
|
20
|
+
getter: -> (context) { context[:decorator].notices(context[:options][:user_options]) }
|
21
21
|
|
22
22
|
def notices(user_options)
|
23
23
|
pact_url = pact_version_url(represented, user_options[:base_url])
|
24
|
-
PactBroker::Pacts::BuildVerifiablePactNotices.call(represented, pact_url,
|
24
|
+
PactBroker::Pacts::BuildVerifiablePactNotices.call(represented, pact_url, user_options)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'pact_broker/pacts/metadata'
|
3
|
+
require 'pact_broker/logging'
|
3
4
|
|
4
5
|
module PactBroker
|
5
6
|
module Api
|
6
7
|
module PactBrokerUrls
|
7
8
|
|
8
9
|
include PactBroker::Pacts::Metadata
|
10
|
+
include PactBroker::Logging
|
9
11
|
# TODO make base_url the last and optional argument for all methods, defaulting to ''
|
10
12
|
|
11
13
|
extend self
|
@@ -70,8 +72,13 @@ module PactBroker
|
|
70
72
|
|
71
73
|
def decode_webhook_metadata(metadata)
|
72
74
|
if metadata
|
73
|
-
|
74
|
-
|
75
|
+
begin
|
76
|
+
Rack::Utils.parse_nested_query(Base64.strict_decode64(metadata)).each_with_object({}) do | (k, v), new_hash |
|
77
|
+
new_hash[k.to_sym] = v
|
78
|
+
end
|
79
|
+
rescue StandardError => e
|
80
|
+
logger.warn("Exception parsing webhook metadata: #{metadata}", e)
|
81
|
+
{}
|
75
82
|
end
|
76
83
|
else
|
77
84
|
{}
|
@@ -190,11 +197,15 @@ module PactBroker
|
|
190
197
|
end
|
191
198
|
|
192
199
|
def templated_tag_url_for_pacticipant pacticipant_name, base_url = ""
|
193
|
-
pacticipant_url_from_params({pacticipant_name: pacticipant_name}, base_url) + "/versions/{version}/tags/{tag}"
|
200
|
+
pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/versions/{version}/tags/{tag}"
|
194
201
|
end
|
195
202
|
|
196
203
|
def templated_label_url_for_pacticipant pacticipant_name, base_url = ""
|
197
|
-
pacticipant_url_from_params({pacticipant_name: pacticipant_name}, base_url) + "/labels/{label}"
|
204
|
+
pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/labels/{label}"
|
205
|
+
end
|
206
|
+
|
207
|
+
def templated_can_i_deploy_badge_url pacticipant_name, base_url = ""
|
208
|
+
pacticipant_url_from_params({ pacticipant_name: pacticipant_name }, base_url) + "/latest-version/{tag}/can-i-deploy/to/{environmentTag}/badge"
|
198
209
|
end
|
199
210
|
|
200
211
|
def label_url label, base_url
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'pact_broker/matrix/can_i_deploy_query_schema'
|
2
|
+
require 'pact_broker/matrix/parse_can_i_deploy_query'
|
3
|
+
|
4
|
+
module PactBroker
|
5
|
+
module Api
|
6
|
+
module Resources
|
7
|
+
class CanIDeployBadge < BaseResource
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
selector = PactBroker::Matrix::UnresolvedSelector.new(pacticipant_name: pacticipant_name, latest: true, tag: identifier_from_path[:tag])
|
11
|
+
@options = {
|
12
|
+
latestby: 'cvp',
|
13
|
+
latest: true,
|
14
|
+
tag: identifier_from_path[:to]
|
15
|
+
}
|
16
|
+
@selectors = [selector]
|
17
|
+
end
|
18
|
+
|
19
|
+
def allowed_methods
|
20
|
+
["GET", "OPTIONS"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def content_types_provided
|
24
|
+
[['image/svg+xml', :to_svg]]
|
25
|
+
end
|
26
|
+
|
27
|
+
def resource_exists?
|
28
|
+
false
|
29
|
+
end
|
30
|
+
|
31
|
+
# Only called if resource_exists? returns false
|
32
|
+
def previously_existed?
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
def is_authorized?(authorization_header)
|
37
|
+
super || PactBroker.configuration.enable_public_badge_access
|
38
|
+
end
|
39
|
+
|
40
|
+
def forbidden?
|
41
|
+
false
|
42
|
+
end
|
43
|
+
|
44
|
+
def moved_temporarily?
|
45
|
+
response.headers['Cache-Control'] = 'no-cache'
|
46
|
+
begin
|
47
|
+
if pacticipant
|
48
|
+
if version
|
49
|
+
badge_service.can_i_deploy_badge_url(pacticipant_name, identifier_from_path[:tag], identifier_from_path[:to], label, results.deployable?)
|
50
|
+
else
|
51
|
+
badge_service.error_badge_url("version", "not found")
|
52
|
+
end
|
53
|
+
else
|
54
|
+
badge_service.error_badge_url(selectors.first.pacticipant_name, "not found")
|
55
|
+
end
|
56
|
+
rescue StandardError => e
|
57
|
+
# Want to render a badge, even if there's an error
|
58
|
+
badge_service.error_badge_url("error", ErrorHandler.display_message(e, "reference: #{ErrorHandler.generate_error_reference}"))
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def policy_name
|
63
|
+
:'badges::badge'
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
attr_reader :selectors, :options
|
69
|
+
|
70
|
+
def results
|
71
|
+
@results ||= matrix_service.find(selectors, options)
|
72
|
+
end
|
73
|
+
|
74
|
+
def version
|
75
|
+
@version ||= version_service.find_by_pacticipant_name_and_latest_tag(identifier_from_path[:pacticipant_name], identifier_from_path[:tag])
|
76
|
+
end
|
77
|
+
|
78
|
+
def label
|
79
|
+
lab = request.query['label']
|
80
|
+
lab && !lab.empty? ? lab : nil
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -202,6 +202,15 @@ module PactBroker
|
|
202
202
|
@pact ||= pact_service.find_pact(pact_params)
|
203
203
|
end
|
204
204
|
|
205
|
+
# Not necessarily an existing integration
|
206
|
+
def integration
|
207
|
+
if consumer_specified? && provider_specified?
|
208
|
+
OpenStruct.new(consumer: consumer, provider: provider)
|
209
|
+
else
|
210
|
+
nil
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
205
214
|
def database_connector
|
206
215
|
request.env["pactbroker.database_connector"]
|
207
216
|
end
|
@@ -32,11 +32,11 @@ module PactBroker
|
|
32
32
|
PactBroker.configuration.warning_error_classes.any? { |clazz| e.is_a?(clazz) }
|
33
33
|
end
|
34
34
|
|
35
|
-
def self.display_message(e,
|
35
|
+
def self.display_message(e, obfuscated_message)
|
36
36
|
if PactBroker.configuration.show_backtrace_in_error_response?
|
37
|
-
e.message ||
|
37
|
+
e.message || obfuscated_message
|
38
38
|
else
|
39
|
-
reportable?(e) ?
|
39
|
+
reportable?(e) ? obfuscated_message : e.message
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -47,7 +47,7 @@ module PactBroker
|
|
47
47
|
def self.response_body_hash e, error_reference
|
48
48
|
response_body = {
|
49
49
|
error: {
|
50
|
-
message: display_message(e, error_reference),
|
50
|
+
message: display_message(e, obfuscated_error_message(error_reference)),
|
51
51
|
reference: error_reference
|
52
52
|
}
|
53
53
|
}
|
@@ -4,9 +4,7 @@ require 'pact_broker/error'
|
|
4
4
|
module PactBroker
|
5
5
|
module Api
|
6
6
|
module Resources
|
7
|
-
|
8
7
|
class ErrorTest < BaseResource
|
9
|
-
|
10
8
|
def content_types_provided
|
11
9
|
[
|
12
10
|
["application/hal+json", :to_json]
|
@@ -24,6 +22,10 @@ module PactBroker
|
|
24
22
|
def process_post
|
25
23
|
raise PactBroker::TestError.new("Don't panic. This is a test API error.")
|
26
24
|
end
|
25
|
+
|
26
|
+
def policy_name
|
27
|
+
:'default'
|
28
|
+
end
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
@@ -121,6 +121,17 @@ module PactBroker
|
|
121
121
|
title: "Determine if an application can be safely deployed to an environment identified by the given tag",
|
122
122
|
templated: true
|
123
123
|
},
|
124
|
+
'pb:provider-pacts-for-verification' => {
|
125
|
+
href: base_url + '/pacts/provider/{provider}/for-verification',
|
126
|
+
title: 'Pact versions to be verified for the specified provider',
|
127
|
+
templated: true
|
128
|
+
},
|
129
|
+
'beta:provider-pacts-for-verification' => {
|
130
|
+
name: 'beta',
|
131
|
+
href: base_url + '/pacts/provider/{provider}/for-verification',
|
132
|
+
title: 'DEPRECATED - please use pb:provider-pacts-for-verification',
|
133
|
+
templated: true
|
134
|
+
},
|
124
135
|
'curies' =>
|
125
136
|
[{
|
126
137
|
name: 'pb',
|
@@ -133,14 +144,6 @@ module PactBroker
|
|
133
144
|
}]
|
134
145
|
}
|
135
146
|
|
136
|
-
if PactBroker.feature_enabled?(:pacts_for_verification)
|
137
|
-
links_hash['beta:provider-pacts-for-verification'] = {
|
138
|
-
href: base_url + '/pacts/provider/{provider}/for-verification',
|
139
|
-
title: 'Pact versions to be verified for the specified provider',
|
140
|
-
templated: true
|
141
|
-
}
|
142
|
-
end
|
143
|
-
|
144
147
|
links_hash
|
145
148
|
end
|
146
149
|
|