pact_broker 2.52.1 → 2.56.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 +80 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/README.md +2 -4
- data/db/migrations/20180828_create_latest_versions.rb +1 -1
- 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 +3 -3
- data/lib/pact_broker/api/resources/matrix_badge.rb +5 -0
- data/lib/pact_broker/api/resources/pact.rb +1 -17
- data/lib/pact_broker/api/resources/pacticipant.rb +0 -4
- data/lib/pact_broker/api/resources/pacticipants.rb +3 -2
- 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/hash_refinements.rb +4 -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 +8 -3
- 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/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/spec/migrations/rollback_spec.rb +6 -0
- data/spec/service_consumers/provider_states_for_pact_broker_client.rb +11 -0
- 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 +31 -28
- 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: f4391656ae9cddad910749af5c6bb4c3c94644cf605122e31a40ce8891feb49d
|
4
|
+
data.tar.gz: db46a7cdf21674996ed6271dac6c13e2238771004d76693fea6bc11e18fdd146
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77ebcb58e85910f527b5750b4a484d856cb7a84369e4d6dc89097e3cc706c8077e1f2cc83ff8f7c5e1e079eb55b686680cacccb52c79a20a6b42b903d98e8784
|
7
|
+
data.tar.gz: c151197191dab0a0b35dd08f7ec0df10a280f28f372a5d72365052a813b67265a2cd1e3d602927641169b5e72fd9e1b6547c0e04a260895693c6a65415fcace0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,83 @@
|
|
1
|
+
<a name="v2.56.0"></a>
|
2
|
+
### v2.56.0 (2020-06-01)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* **database**
|
8
|
+
* log schema versions and migration info on startup ([b385e535](/../../commit/b385e535))
|
9
|
+
* allow options to be passed to Sequel migrate via the MigrationTask ([143613e7](/../../commit/143613e7))
|
10
|
+
|
11
|
+
* allow Pactflow messages in logs to be hidden by setting PACT_BROKER_HIDE_PACTFLOW_MESSAGES=true ([a7550105](/../../commit/a7550105))
|
12
|
+
|
13
|
+
* **can-i-deploy**
|
14
|
+
* experimental - add a warning message if there are interactions missing verification test results. ([f7ab8cc5](/../../commit/f7ab8cc5))
|
15
|
+
|
16
|
+
|
17
|
+
#### Bug Fixes
|
18
|
+
|
19
|
+
* use relative URLs when base_url not explictly set to ensure app is not vulnerable to host header attacks ([92c45a0a](/../../commit/92c45a0a))
|
20
|
+
* raise PactBroker::Error when either pacticipant is not found in the business layer while attempting to delete an integration ([3c209a46](/../../commit/3c209a46))
|
21
|
+
|
22
|
+
|
23
|
+
<a name="v2.55.0"></a>
|
24
|
+
### v2.55.0 (2020-05-22)
|
25
|
+
|
26
|
+
|
27
|
+
#### Features
|
28
|
+
|
29
|
+
* support non root context (#344) ([dc480499](/../../commit/dc480499))
|
30
|
+
|
31
|
+
|
32
|
+
<a name="v2.54.0"></a>
|
33
|
+
### v2.54.0 (2020-05-13)
|
34
|
+
|
35
|
+
|
36
|
+
#### Features
|
37
|
+
|
38
|
+
* **hal browser**
|
39
|
+
* update to latest code ([a79ad290](/../../commit/a79ad290))
|
40
|
+
|
41
|
+
|
42
|
+
#### Bug Fixes
|
43
|
+
|
44
|
+
* update rack for CVE-2020-8161 ([96c3386a](/../../commit/96c3386a))
|
45
|
+
|
46
|
+
* **hal browser**
|
47
|
+
* fix xss vulnerability ([ac564412](/../../commit/ac564412))
|
48
|
+
|
49
|
+
* **webhooks**
|
50
|
+
* add missing validation for event names when creating webhooks ([5fc0563c](/../../commit/5fc0563c))
|
51
|
+
|
52
|
+
|
53
|
+
<a name="v2.53.0"></a>
|
54
|
+
### v2.53.0 (2020-05-12)
|
55
|
+
|
56
|
+
|
57
|
+
#### Features
|
58
|
+
|
59
|
+
* **badge**
|
60
|
+
* include tag names in matrix badge ([cce7cd01](/../../commit/cce7cd01))
|
61
|
+
|
62
|
+
|
63
|
+
#### Bug Fixes
|
64
|
+
|
65
|
+
* **pacts for verification**
|
66
|
+
* ensure a separate pact URL is returned for each consumer when multiple consumers share the same pact json content ([13e7b640](/../../commit/13e7b640))
|
67
|
+
|
68
|
+
* gracefully handle fetching matrix badge when specified pact does not exist ([e8ec4101](/../../commit/e8ec4101))
|
69
|
+
* include the base URL in the link to the webhook docs ([5363ab2e](/../../commit/5363ab2e))
|
70
|
+
|
71
|
+
|
72
|
+
<a name="v2.52.2"></a>
|
73
|
+
### v2.52.2 (2020-04-16)
|
74
|
+
|
75
|
+
|
76
|
+
#### Bug Fixes
|
77
|
+
|
78
|
+
* pact URL in matrix page ([5ed046f1](/../../commit/5ed046f1))
|
79
|
+
|
80
|
+
|
1
81
|
<a name="v2.52.1"></a>
|
2
82
|
### v2.52.1 (2020-03-30)
|
3
83
|
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at pact-support@googlegroups.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
|
+
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
74
|
+
|
75
|
+
For answers to common questions about this code of conduct, see
|
76
|
+
https://www.contributor-covenant.org/faq
|
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
|
@@ -76,7 +76,7 @@ module PactBroker
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def decorator_context options = {}
|
79
|
-
Decorators::DecoratorContext.new(base_url, resource_url, options)
|
79
|
+
Decorators::DecoratorContext.new(base_url, resource_url, request.env, options)
|
80
80
|
end
|
81
81
|
|
82
82
|
def handle_exception e
|