pact_broker 2.52.2 → 2.56.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +81 -0
- data/README.md +2 -4
- data/lib/pact_broker/api.rb +8 -0
- data/lib/pact_broker/api/contracts/webhook_contract.rb +8 -6
- data/lib/pact_broker/api/decorators/decorator_context.rb +6 -11
- data/lib/pact_broker/api/decorators/reason_decorator.rb +17 -0
- data/lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb +6 -1
- data/lib/pact_broker/api/pact_broker_urls.rb +6 -2
- data/lib/pact_broker/api/renderers/html_pact_renderer.rb +14 -14
- data/lib/pact_broker/api/resources/badge.rb +6 -2
- data/lib/pact_broker/api/resources/base_resource.rb +8 -3
- data/lib/pact_broker/api/resources/latest_pact.rb +1 -1
- data/lib/pact_broker/api/resources/matrix_badge.rb +5 -0
- data/lib/pact_broker/api/resources/pact.rb +3 -19
- data/lib/pact_broker/api/resources/pacticipant.rb +0 -4
- data/lib/pact_broker/api/resources/verifications.rb +0 -4
- data/lib/pact_broker/app.rb +13 -4
- data/lib/pact_broker/badges/service.rb +16 -13
- data/lib/pact_broker/db.rb +9 -1
- data/lib/pact_broker/doc/controllers/app.rb +11 -1
- data/lib/pact_broker/doc/views/layouts/main.haml +1 -1
- data/lib/pact_broker/domain/verification.rb +13 -0
- data/lib/pact_broker/integrations/service.rb +2 -2
- data/lib/pact_broker/locale/en.yml +1 -1
- data/lib/pact_broker/logging.rb +3 -1
- data/lib/pact_broker/matrix/deployment_status_summary.rb +23 -1
- data/lib/pact_broker/matrix/reason.rb +9 -0
- data/lib/pact_broker/matrix/unresolved_selector.rb +4 -0
- data/lib/pact_broker/pacticipants/repository.rb +6 -0
- data/lib/pact_broker/pacticipants/service.rb +8 -0
- data/lib/pact_broker/pacts/content.rb +26 -2
- data/lib/pact_broker/pacts/repository.rb +5 -4
- data/lib/pact_broker/tasks/migration_task.rb +20 -1
- data/lib/pact_broker/test/test_data_builder.rb +1 -1
- data/lib/pact_broker/ui/app.rb +1 -0
- data/lib/pact_broker/ui/controllers/base_controller.rb +3 -0
- data/lib/pact_broker/ui/controllers/clusters.rb +2 -2
- data/lib/pact_broker/ui/controllers/groups.rb +3 -2
- data/lib/pact_broker/ui/controllers/index.rb +3 -2
- data/lib/pact_broker/ui/controllers/matrix.rb +19 -3
- data/lib/pact_broker/ui/helpers/url_helper.rb +4 -4
- data/lib/pact_broker/ui/view_models/index_item.rb +16 -11
- data/lib/pact_broker/ui/view_models/index_items.rb +2 -2
- data/lib/pact_broker/ui/view_models/matrix_line.rb +12 -7
- data/lib/pact_broker/ui/view_models/matrix_lines.rb +2 -2
- data/lib/pact_broker/ui/views/groups/show.html.erb +3 -3
- data/lib/pact_broker/ui/views/index/_css_and_js.haml +9 -9
- data/lib/pact_broker/ui/views/index/_navbar.haml +3 -3
- data/lib/pact_broker/ui/views/index/_pagination.haml +1 -1
- data/lib/pact_broker/ui/views/index/show-with-tags.haml +3 -3
- data/lib/pact_broker/ui/views/index/show.haml +3 -3
- data/lib/pact_broker/ui/views/layouts/main.haml +4 -4
- data/lib/pact_broker/ui/views/matrix/show.haml +14 -11
- data/lib/pact_broker/verifications/repository.rb +4 -5
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/webhooks/service.rb +4 -3
- data/lib/pact_broker/webhooks/webhook_event.rb +1 -1
- data/lib/pact_broker/webhooks/webhook_request_logger.rb +8 -8
- data/pact_broker.gemspec +2 -2
- data/public/javascripts/pact.js +7 -6
- data/public/stylesheets/matrix.css +13 -0
- data/script/foo-bar-verification.json +3 -1
- data/script/foo-bar.json +11 -0
- data/script/seed.rb +1 -1
- data/spec/features/create_webhook_spec.rb +1 -1
- data/spec/features/delete_integration_spec.rb +2 -2
- data/spec/features/get_matrix_badge_spec.rb +9 -0
- data/spec/fixtures/webhook_valid.json +1 -1
- data/spec/fixtures/webhook_valid_with_pacticipants.json +1 -1
- data/spec/integration/ui/index_spec.rb +16 -0
- data/spec/integration/ui/matrix_spec.rb +11 -4
- data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +12 -0
- data/spec/lib/pact_broker/api/decorators/pact_version_decorator_spec.rb +1 -1
- data/spec/lib/pact_broker/api/decorators/reason_decorator_spec.rb +18 -1
- data/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb +1 -1
- data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +8 -0
- data/spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb +1 -1
- data/spec/lib/pact_broker/api/resources/badge_spec.rb +42 -22
- data/spec/lib/pact_broker/api/resources/latest_pact_spec.rb +1 -0
- data/spec/lib/pact_broker/api/resources/pact_spec.rb +1 -0
- data/spec/lib/pact_broker/api/resources/webhook_execution_spec.rb +1 -1
- data/spec/lib/pact_broker/badges/service_spec.rb +15 -3
- data/spec/lib/pact_broker/doc/controllers/app_spec.rb +16 -0
- data/spec/lib/pact_broker/domain/version_spec.rb +7 -7
- data/spec/lib/pact_broker/integrations/service_spec.rb +6 -0
- data/spec/lib/pact_broker/matrix/deployment_status_summary_spec.rb +6 -2
- data/spec/lib/pact_broker/matrix/integration_spec.rb +43 -0
- data/spec/lib/pact_broker/pacts/content_spec.rb +125 -0
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +18 -1
- data/spec/lib/pact_broker/verifications/repository_spec.rb +20 -0
- data/spec/lib/pact_broker/webhooks/webhook_request_logger_spec.rb +4 -1
- data/vendor/hal-browser/README.adoc +169 -0
- data/vendor/hal-browser/browser.html +36 -22
- data/vendor/hal-browser/js/hal.js +30 -7
- data/vendor/hal-browser/js/hal/http/client.js +14 -6
- data/vendor/hal-browser/js/hal/resource.js +4 -2
- data/vendor/hal-browser/js/hal/views/documentation.js +1 -1
- data/vendor/hal-browser/js/hal/views/embedded_resource.js +10 -4
- data/vendor/hal-browser/js/hal/views/links.js +3 -2
- data/vendor/hal-browser/js/hal/views/non_safe_request_dialog.js +1 -1
- data/vendor/hal-browser/js/hal/views/properties.js +101 -2
- data/vendor/hal-browser/js/hal/views/query_uri_dialog.js +1 -1
- data/vendor/hal-browser/js/hal/views/request_headers.js +1 -1
- data/vendor/hal-browser/js/hal/views/resource.js +4 -3
- data/vendor/hal-browser/js/hal/views/response_headers.js +12 -1
- data/vendor/hal-browser/login.html +76 -0
- data/vendor/hal-browser/styles.css +3 -1
- data/vendor/hal-browser/vendor/js/URI.min.js +84 -0
- metadata +28 -27
- data/lib/pact_broker/verifications/all_verifications.rb +0 -41
- data/vendor/hal-browser/README.md +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78ca82ae8d3f9574d9844689ebb3423e5a2c2966f5907253f82e996aa0dbdcd4
|
4
|
+
data.tar.gz: 64a1cec77d11ae9f82e4408736147afe69d294def7b07afa31bdab1c38947a72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c43133723319d295e3e3a9a818ef668e5f15b75b65589c90d77902737e807145e5647b92e4d7c80880e9886a4e75c20f23140716310f5c28dc77cd8a726e381c
|
7
|
+
data.tar.gz: 92cd37b6e992d89886fe7f9f6f9b220879b92c48f081c64ea344201229e45d8ca6a12fb676d0cecdba9d15da0ccd70163e54392acda943d4e66adea46706d9b6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,84 @@
|
|
1
|
+
<a name="v2.56.1"></a>
|
2
|
+
### v2.56.1 (2020-06-01)
|
3
|
+
|
4
|
+
|
5
|
+
#### Bug Fixes
|
6
|
+
|
7
|
+
* **matrix ui**
|
8
|
+
* fix home link ([67065b7d](/../../commit/67065b7d))
|
9
|
+
|
10
|
+
|
11
|
+
<a name="v2.56.0"></a>
|
12
|
+
### v2.56.0 (2020-06-01)
|
13
|
+
|
14
|
+
|
15
|
+
#### Features
|
16
|
+
|
17
|
+
* **database**
|
18
|
+
* log schema versions and migration info on startup ([b385e535](/../../commit/b385e535))
|
19
|
+
* allow options to be passed to Sequel migrate via the MigrationTask ([143613e7](/../../commit/143613e7))
|
20
|
+
|
21
|
+
* allow Pactflow messages in logs to be hidden by setting PACT_BROKER_HIDE_PACTFLOW_MESSAGES=true ([a7550105](/../../commit/a7550105))
|
22
|
+
|
23
|
+
* **can-i-deploy**
|
24
|
+
* experimental - add a warning message if there are interactions missing verification test results. ([f7ab8cc5](/../../commit/f7ab8cc5))
|
25
|
+
|
26
|
+
|
27
|
+
#### Bug Fixes
|
28
|
+
|
29
|
+
* use relative URLs when base_url not explictly set to ensure app is not vulnerable to host header attacks ([92c45a0a](/../../commit/92c45a0a))
|
30
|
+
* raise PactBroker::Error when either pacticipant is not found in the business layer while attempting to delete an integration ([3c209a46](/../../commit/3c209a46))
|
31
|
+
|
32
|
+
|
33
|
+
<a name="v2.55.0"></a>
|
34
|
+
### v2.55.0 (2020-05-22)
|
35
|
+
|
36
|
+
|
37
|
+
#### Features
|
38
|
+
|
39
|
+
* support non root context (#344) ([dc480499](/../../commit/dc480499))
|
40
|
+
|
41
|
+
|
42
|
+
<a name="v2.54.0"></a>
|
43
|
+
### v2.54.0 (2020-05-13)
|
44
|
+
|
45
|
+
|
46
|
+
#### Features
|
47
|
+
|
48
|
+
* **hal browser**
|
49
|
+
* update to latest code ([a79ad290](/../../commit/a79ad290))
|
50
|
+
|
51
|
+
|
52
|
+
#### Bug Fixes
|
53
|
+
|
54
|
+
* update rack for CVE-2020-8161 ([96c3386a](/../../commit/96c3386a))
|
55
|
+
|
56
|
+
* **hal browser**
|
57
|
+
* fix xss vulnerability ([ac564412](/../../commit/ac564412))
|
58
|
+
|
59
|
+
* **webhooks**
|
60
|
+
* add missing validation for event names when creating webhooks ([5fc0563c](/../../commit/5fc0563c))
|
61
|
+
|
62
|
+
|
63
|
+
<a name="v2.53.0"></a>
|
64
|
+
### v2.53.0 (2020-05-12)
|
65
|
+
|
66
|
+
|
67
|
+
#### Features
|
68
|
+
|
69
|
+
* **badge**
|
70
|
+
* include tag names in matrix badge ([cce7cd01](/../../commit/cce7cd01))
|
71
|
+
|
72
|
+
|
73
|
+
#### Bug Fixes
|
74
|
+
|
75
|
+
* **pacts for verification**
|
76
|
+
* ensure a separate pact URL is returned for each consumer when multiple consumers share the same pact json content ([13e7b640](/../../commit/13e7b640))
|
77
|
+
|
78
|
+
* gracefully handle fetching matrix badge when specified pact does not exist ([e8ec4101](/../../commit/e8ec4101))
|
79
|
+
* include the base URL in the link to the webhook docs ([5363ab2e](/../../commit/5363ab2e))
|
80
|
+
|
81
|
+
|
1
82
|
<a name="v2.52.2"></a>
|
2
83
|
### v2.52.2 (2020-04-16)
|
3
84
|
|
data/README.md
CHANGED
@@ -64,8 +64,6 @@ If you don't have a [Pact Broker CI Nerf Gun][nerf], you'll probably want to rea
|
|
64
64
|
|
65
65
|
#### Step 3. Back to the Consumer CI build
|
66
66
|
|
67
|
-
The following funcationality is in beta release. Your feedback would be appreciated.
|
68
|
-
|
69
67
|
1. The Consumer CI determines if the pact has been verified by running `pact-broker can-i-deploy --pacticipant CONSUMER_NAME --version CONSUMER_VERSION ...` (see documentation [here](https://github.com/pact-foundation/pact_broker-client#can-i-deploy))
|
70
68
|
1. If the pact has been verified, the deployment can proceed.
|
71
69
|
|
@@ -123,8 +121,8 @@ Use the HAL browser to view documentation as you browse.
|
|
123
121
|
* unix users just use your package manager
|
124
122
|
* Run `git clone git@github.com:pact-foundation/pact_broker.git && cd pact_broker/example`
|
125
123
|
* Run `bundle install`
|
126
|
-
* Run `bundle exec rackup -p
|
127
|
-
* Open [http://localhost:
|
124
|
+
* Run `bundle exec rackup -p 9292 -o 0.0.0.0` (this will use a Sqlite database. If you want to try it out with a Postgres database, see the [README](https://github.com/pact-foundation/pact_broker/tree/master/example) in the example directory.)
|
125
|
+
* Open [http://localhost:9292](http://localhost:9292) and you should see a list containing the pact between the Zoo App and the Animal Service.
|
128
126
|
* Click on the arrow to see the generated HTML documentation.
|
129
127
|
* Click on either service to see an autogenerated network diagram.
|
130
128
|
* Click on the HAL Browser link to have a poke around the API.
|
data/lib/pact_broker/api.rb
CHANGED
@@ -3,6 +3,14 @@ require 'webmachine/rack_adapter_monkey_patch'
|
|
3
3
|
require 'pact_broker/api/resources'
|
4
4
|
require 'pact_broker/feature_toggle'
|
5
5
|
|
6
|
+
module Webmachine
|
7
|
+
class Request
|
8
|
+
def patch?
|
9
|
+
method == "PATCH"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
6
14
|
module PactBroker
|
7
15
|
|
8
16
|
API ||= begin
|
@@ -2,6 +2,7 @@ require 'pact_broker/api/contracts/base_contract'
|
|
2
2
|
require 'pact_broker/webhooks/check_host_whitelist'
|
3
3
|
require 'pact_broker/webhooks/render'
|
4
4
|
require 'pact_broker/pacticipants/service'
|
5
|
+
require 'pact_broker/webhooks/webhook_event'
|
5
6
|
|
6
7
|
module PactBroker
|
7
8
|
module Api
|
@@ -13,11 +14,13 @@ module PactBroker
|
|
13
14
|
# I just cannot seem to get the validation to stop on the first error.
|
14
15
|
# If one rule fails, they all come back failed, and it's driving me nuts.
|
15
16
|
# Why on earth would I want that behaviour?
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
# I cannot believe I have to do this shit.
|
18
|
+
@first_errors = errors
|
19
|
+
@first_errors.messages.keys.each do | key |
|
20
|
+
@first_errors.messages[key] = @first_errors.messages[key][0...1]
|
19
21
|
end
|
20
|
-
|
22
|
+
|
23
|
+
def self.errors; @first_errors end
|
21
24
|
result
|
22
25
|
end
|
23
26
|
|
@@ -46,7 +49,6 @@ module PactBroker
|
|
46
49
|
|
47
50
|
required(:name).filled(:pacticipant_exists?)
|
48
51
|
end
|
49
|
-
|
50
52
|
end
|
51
53
|
|
52
54
|
property :provider do
|
@@ -155,7 +157,7 @@ module PactBroker
|
|
155
157
|
property :name
|
156
158
|
|
157
159
|
validation do
|
158
|
-
required(:name).filled
|
160
|
+
required(:name).filled(included_in?: PactBroker::Webhooks::WebhookEvent::EVENT_NAMES)
|
159
161
|
end
|
160
162
|
end
|
161
163
|
end
|
@@ -1,20 +1,15 @@
|
|
1
1
|
module PactBroker
|
2
2
|
module Api
|
3
3
|
module Decorators
|
4
|
-
|
5
4
|
class DecoratorContext < Hash
|
6
5
|
|
7
|
-
attr_reader :base_url, :resource_url, :resource_title
|
6
|
+
attr_reader :base_url, :resource_url, :resource_title, :env
|
8
7
|
|
9
|
-
def initialize base_url, resource_url, options = {}
|
10
|
-
@base_url = base_url
|
11
|
-
self[:
|
12
|
-
@
|
13
|
-
self[:
|
14
|
-
if options[:resource_title]
|
15
|
-
@resource_title = options[:resource_title]
|
16
|
-
self[:resource_title] = resource_title
|
17
|
-
end
|
8
|
+
def initialize base_url, resource_url, env, options = {}
|
9
|
+
@base_url = self[:base_url] = base_url
|
10
|
+
@resource_url = self[:resource_url]= resource_url
|
11
|
+
@resource_title = self[:resource_title] = options[:resource_title]
|
12
|
+
@env = self[:env] = env
|
18
13
|
merge!(options)
|
19
14
|
end
|
20
15
|
|
@@ -22,6 +22,11 @@ module PactBroker
|
|
22
22
|
"There are no missing dependencies"
|
23
23
|
when PactBroker::Matrix::Successful
|
24
24
|
"All required verification results are published and successful"
|
25
|
+
when PactBroker::Matrix::InteractionsMissingVerifications
|
26
|
+
descriptions = reason.interactions.collect do | interaction |
|
27
|
+
interaction_description(interaction)
|
28
|
+
end.join('; ')
|
29
|
+
"WARNING: Although the verification was reported as successful, the results for #{reason.consumer_selector.description} and #{reason.provider_selector.description} may be missing tests for the following interactions: #{descriptions}"
|
25
30
|
else
|
26
31
|
reason
|
27
32
|
end
|
@@ -44,6 +49,18 @@ module PactBroker
|
|
44
49
|
""
|
45
50
|
end
|
46
51
|
end
|
52
|
+
|
53
|
+
# TODO move this somewhere else
|
54
|
+
def interaction_description(interaction)
|
55
|
+
if interaction['providerState'] && interaction['providerState'] != ''
|
56
|
+
"#{interaction['description']} given #{interaction['providerState']}"
|
57
|
+
elsif interaction['providerStates'] && interaction['providerStates'].is_a?(Array) && interaction['providerStates'].any?
|
58
|
+
provider_states = interaction['providerStates'].collect{ |ps| ps['name'] }.compact.join(', ')
|
59
|
+
"#{interaction['description']} given #{provider_states}"
|
60
|
+
else
|
61
|
+
interaction['description']
|
62
|
+
end
|
63
|
+
end
|
47
64
|
end
|
48
65
|
end
|
49
66
|
end
|
@@ -78,8 +78,13 @@ module PactBroker
|
|
78
78
|
}
|
79
79
|
end
|
80
80
|
|
81
|
+
def to_hash(options)
|
82
|
+
@to_hash_options = options
|
83
|
+
super
|
84
|
+
end
|
85
|
+
|
81
86
|
def response_hidden_message
|
82
|
-
PactBroker::Messages.message('messages.response_body_hidden')
|
87
|
+
PactBroker::Messages.message('messages.response_body_hidden', base_url: @to_hash_options[:user_options][:base_url])
|
83
88
|
end
|
84
89
|
end
|
85
90
|
end
|
@@ -253,6 +253,10 @@ module PactBroker
|
|
253
253
|
"/matrix/provider/#{url_encode(provider_name)}/consumer/#{url_encode(consumer_name)}"
|
254
254
|
end
|
255
255
|
|
256
|
+
def matrix_badge_url_for_selectors consumer_selector, provider_selector, base_url = ''
|
257
|
+
"#{base_url}/matrix/provider/#{url_encode(provider_selector.pacticipant_name)}/latest/#{url_encode(provider_selector.tag)}/consumer/#{url_encode(consumer_selector.pacticipant_name)}/latest/#{url_encode(consumer_selector.tag)}/badge.svg"
|
258
|
+
end
|
259
|
+
|
256
260
|
def matrix_for_pacticipant_version_url(version, base_url = '')
|
257
261
|
query = {
|
258
262
|
q: [{ pacticipant: version.pacticipant.name, version: version.number }],
|
@@ -280,8 +284,8 @@ module PactBroker
|
|
280
284
|
"#{base_url}/groups/#{pacticipant_name}"
|
281
285
|
end
|
282
286
|
|
283
|
-
def hal_browser_url target_url
|
284
|
-
"/hal-browser/browser.html#" + target_url
|
287
|
+
def hal_browser_url target_url, base_url = ''
|
288
|
+
"#{base_url}/hal-browser/browser.html#" + target_url
|
285
289
|
end
|
286
290
|
|
287
291
|
def url_encode param
|
@@ -37,18 +37,18 @@ module PactBroker
|
|
37
37
|
|
38
38
|
def head
|
39
39
|
"<title>#{title}</title>
|
40
|
-
<link rel='stylesheet' type='text/css' href='/stylesheets/github.css'>
|
41
|
-
<link rel='stylesheet' type='text/css' href='/stylesheets/pact.css'>
|
42
|
-
<link rel='stylesheet' type='text/css' href='/stylesheets/github-json.css'>
|
43
|
-
<link rel='stylesheet' type='text/css' href='/css/bootstrap.min.css'>
|
44
|
-
<link rel='stylesheet' type='text/css' href='/stylesheets/material-menu.css'>
|
45
|
-
<link rel='stylesheet' type='text/css' href='/stylesheets/jquery-confirm.min.css'>
|
46
|
-
<script src='/javascripts/highlight.pack.js'></script>
|
47
|
-
<script src='/javascripts/jquery-3.3.1.min.js'></script>
|
48
|
-
<script src='/js/bootstrap.min.js'></script>
|
49
|
-
<script src='/javascripts/material-menu.js'></script>
|
50
|
-
<script src='/javascripts/pact.js'></script>
|
51
|
-
<script src='/javascripts/jquery-confirm.min.js'></script>
|
40
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/stylesheets/github.css'>
|
41
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/stylesheets/pact.css'>
|
42
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/stylesheets/github-json.css'>
|
43
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/css/bootstrap.min.css'>
|
44
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/stylesheets/material-menu.css'>
|
45
|
+
<link rel='stylesheet' type='text/css' href='#{base_url}/stylesheets/jquery-confirm.min.css'>
|
46
|
+
<script src='#{base_url}/javascripts/highlight.pack.js'></script>
|
47
|
+
<script src='#{base_url}/javascripts/jquery-3.3.1.min.js'></script>
|
48
|
+
<script src='#{base_url}/js/bootstrap.min.js'></script>
|
49
|
+
<script src='#{base_url}/javascripts/material-menu.js'></script>
|
50
|
+
<script src='#{base_url}/javascripts/pact.js'></script>
|
51
|
+
<script src='#{base_url}/javascripts/jquery-confirm.min.js'></script>
|
52
52
|
<script>hljs.initHighlightingOnLoad();</script>"
|
53
53
|
end
|
54
54
|
|
@@ -72,7 +72,7 @@ module PactBroker
|
|
72
72
|
<a href=\"#{matrix_url}\">View Matrix</a>
|
73
73
|
</li>
|
74
74
|
<li>
|
75
|
-
<a href=\"
|
75
|
+
<a href=\"#{base_url}\">Home</a>
|
76
76
|
</li>
|
77
77
|
<li>
|
78
78
|
<span data-consumer-name=\"#{@pact.consumer.name}\"
|
@@ -129,7 +129,7 @@ module PactBroker
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def json_url
|
132
|
-
PactBroker::Api::PactBrokerUrls.hal_browser_url pact_url
|
132
|
+
PactBroker::Api::PactBrokerUrls.hal_browser_url pact_url, base_url
|
133
133
|
end
|
134
134
|
|
135
135
|
def pact_url
|
@@ -34,12 +34,12 @@ module PactBroker
|
|
34
34
|
|
35
35
|
def to_svg
|
36
36
|
response.headers['Cache-Control'] = 'no-cache'
|
37
|
-
comment + badge_service.pact_verification_badge(pact, label, initials, pseudo_branch_verification_status)
|
37
|
+
comment + badge_service.pact_verification_badge(pact, label, initials, pseudo_branch_verification_status, tags)
|
38
38
|
end
|
39
39
|
|
40
40
|
def moved_temporarily?
|
41
41
|
response.headers['Cache-Control'] = 'no-cache'
|
42
|
-
badge_service.pact_verification_badge_url(pact, label, initials, pseudo_branch_verification_status)
|
42
|
+
badge_service.pact_verification_badge_url(pact, label, initials, pseudo_branch_verification_status, tags)
|
43
43
|
end
|
44
44
|
|
45
45
|
private
|
@@ -72,6 +72,10 @@ module PactBroker
|
|
72
72
|
verification_number = latest_verification ? latest_verification.number : "?"
|
73
73
|
"<!-- #{identifier_from_path[:consumer_name]} version #{consumer_version_number} revision #{pact_revision} #{identifier_from_path[:provider_name]} version #{provider_version_number} number #{verification_number} -->\n"
|
74
74
|
end
|
75
|
+
|
76
|
+
def tags
|
77
|
+
{}
|
78
|
+
end
|
75
79
|
end
|
76
80
|
end
|
77
81
|
end
|
@@ -33,8 +33,8 @@ module PactBroker
|
|
33
33
|
{ 'Access-Control-Allow-Methods' => allowed_methods.join(", ")}
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
|
36
|
+
def known_methods
|
37
|
+
super + ['PATCH']
|
38
38
|
end
|
39
39
|
|
40
40
|
def finish_request
|
@@ -62,6 +62,11 @@ module PactBroker
|
|
62
62
|
PactBroker.configuration.base_url || request.base_uri.to_s.chomp('/')
|
63
63
|
end
|
64
64
|
|
65
|
+
# See comments for base_url in lib/pact_broker/doc/controllers/app.rb
|
66
|
+
def ui_base_url
|
67
|
+
PactBroker.configuration.base_url || ''
|
68
|
+
end
|
69
|
+
|
65
70
|
def charsets_provided
|
66
71
|
[['utf-8', :encode]]
|
67
72
|
end
|
@@ -76,7 +81,7 @@ module PactBroker
|
|
76
81
|
end
|
77
82
|
|
78
83
|
def decorator_context options = {}
|
79
|
-
Decorators::DecoratorContext.new(base_url, resource_url, options)
|
84
|
+
Decorators::DecoratorContext.new(base_url, resource_url, request.env, options)
|
80
85
|
end
|
81
86
|
|
82
87
|
def handle_exception e
|
@@ -7,7 +7,12 @@ module PactBroker
|
|
7
7
|
|
8
8
|
private
|
9
9
|
|
10
|
+
def tags
|
11
|
+
{ consumer_tag: identifier_from_path[:tag], provider_tag: identifier_from_path[:provider_tag] }
|
12
|
+
end
|
13
|
+
|
10
14
|
def latest_verification
|
15
|
+
return nil unless pact
|
11
16
|
@latest_verification ||= verification_service.find_latest_verification_for_tags(
|
12
17
|
identifier_from_path[:consumer_name],
|
13
18
|
identifier_from_path[:provider_name],
|
@@ -9,14 +9,6 @@ require 'pact_broker/api/contracts/put_pact_params_contract'
|
|
9
9
|
require 'pact_broker/webhooks/execution_configuration'
|
10
10
|
require 'pact_broker/api/resources/webhook_execution_methods'
|
11
11
|
|
12
|
-
module Webmachine
|
13
|
-
class Request
|
14
|
-
def patch?
|
15
|
-
method == "PATCH"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
12
|
module PactBroker
|
21
13
|
module Api
|
22
14
|
module Resources
|
@@ -41,10 +33,6 @@ module PactBroker
|
|
41
33
|
["GET", "PUT", "DELETE", "PATCH", "OPTIONS"]
|
42
34
|
end
|
43
35
|
|
44
|
-
def known_methods
|
45
|
-
super + ['PATCH']
|
46
|
-
end
|
47
|
-
|
48
36
|
def is_conflict?
|
49
37
|
merge_conflict = request.patch? && resource_exists? &&
|
50
38
|
Pacts::Merger.conflict?(pact.json_content, pact_params.json_content)
|
@@ -89,8 +77,8 @@ module PactBroker
|
|
89
77
|
def to_html
|
90
78
|
PactBroker.configuration.html_pact_renderer.call(
|
91
79
|
pact, {
|
92
|
-
base_url:
|
93
|
-
badge_url: badge_url_for_latest_pact(pact,
|
80
|
+
base_url: ui_base_url,
|
81
|
+
badge_url: badge_url_for_latest_pact(pact, ui_base_url)
|
94
82
|
})
|
95
83
|
end
|
96
84
|
|
@@ -110,13 +98,9 @@ module PactBroker
|
|
110
98
|
@pact_params ||= PactBroker::Pacts::PactParams.from_request request, path_info
|
111
99
|
end
|
112
100
|
|
113
|
-
def update_matrix_after_request?
|
114
|
-
request.put? || request.patch?
|
115
|
-
end
|
116
|
-
|
117
101
|
def set_post_deletion_response
|
118
102
|
latest_pact = pact_service.find_latest_pact(pact_params)
|
119
|
-
response_body = { "_links" => {} }
|
103
|
+
response_body = { "_links" => { index: { href: base_url } } }
|
120
104
|
if latest_pact
|
121
105
|
response_body["_links"]["pb:latest-pact-version"] = {
|
122
106
|
href: latest_pact_url(base_url, latest_pact),
|