pact_broker 2.30.0 → 2.31.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 +51 -0
- data/README.md +3 -3
- data/config/database.yml +5 -3
- data/lib/db.rb +1 -0
- data/lib/pact/doc/markdown/consumer_contract_renderer.rb +9 -5
- data/lib/pact/doc/markdown/interaction.erb +3 -3
- data/lib/pact/doc/markdown/interaction_renderer.rb +6 -2
- data/lib/pact_broker.rb +0 -9
- data/lib/pact_broker/api.rb +2 -0
- data/lib/pact_broker/api/contracts/base_contract.rb +15 -0
- data/lib/pact_broker/api/contracts/pacticipant_name_contract.rb +2 -3
- data/lib/pact_broker/api/contracts/put_pact_params_contract.rb +3 -4
- data/lib/pact_broker/api/contracts/request_validations.rb +1 -2
- data/lib/pact_broker/api/contracts/verification_contract.rb +2 -3
- data/lib/pact_broker/api/contracts/webhook_contract.rb +2 -3
- data/lib/pact_broker/api/decorators/base_decorator.rb +2 -0
- data/lib/pact_broker/api/decorators/dashboard_decorator.rb +10 -4
- data/lib/pact_broker/api/decorators/format_date_time.rb +15 -0
- data/lib/pact_broker/api/decorators/matrix_decorator.rb +4 -2
- data/lib/pact_broker/api/decorators/timestamps.rb +3 -6
- data/lib/pact_broker/api/pact_broker_urls.rb +5 -1
- data/lib/pact_broker/api/renderers/html_pact_renderer.rb +23 -8
- data/lib/pact_broker/api/resources.rb +0 -7
- data/lib/pact_broker/api/resources/error_handler.rb +1 -3
- data/lib/pact_broker/api/resources/error_test.rb +1 -7
- data/lib/pact_broker/api/resources/integration.rb +22 -0
- data/lib/pact_broker/api/resources/integrations.rb +6 -1
- data/lib/pact_broker/api/resources/pact.rb +14 -0
- data/lib/pact_broker/api/resources/pact_versions.rb +1 -1
- data/lib/pact_broker/api/resources/tagged_pact_versions.rb +1 -1
- data/lib/pact_broker/app.rb +27 -3
- data/lib/pact_broker/config/load.rb +1 -18
- data/lib/pact_broker/config/repository.rb +16 -0
- data/lib/pact_broker/config/save.rb +9 -51
- data/lib/pact_broker/config/setting.rb +60 -0
- data/lib/pact_broker/configuration.rb +8 -2
- data/lib/pact_broker/db/migrate.rb +2 -1
- data/lib/pact_broker/db/migrate_data.rb +8 -0
- data/lib/pact_broker/db/seed/pact_1.json +35 -0
- data/lib/pact_broker/db/seed/pact_2.json +40 -0
- data/lib/pact_broker/db/seed/pact_3.json +76 -0
- data/lib/pact_broker/db/seed_example_data.rb +64 -0
- data/lib/pact_broker/doc/views/index/publish-pact.markdown +1 -1
- data/lib/pact_broker/doc/views/webhooks.markdown +3 -1
- data/lib/pact_broker/domain/index_item.rb +3 -0
- data/lib/pact_broker/domain/pacticipant.rb +5 -0
- data/lib/pact_broker/domain/verification.rb +2 -12
- data/lib/pact_broker/domain/version.rb +10 -3
- data/lib/pact_broker/domain/webhook.rb +1 -1
- data/lib/pact_broker/integrations/service.rb +27 -0
- data/lib/pact_broker/pacticipants/repository.rb +9 -0
- data/lib/pact_broker/pacticipants/service.rb +4 -1
- data/lib/pact_broker/pacts/content.rb +26 -0
- data/lib/pact_broker/pacts/generate_interaction_sha.rb +18 -0
- data/lib/pact_broker/pacts/merger.rb +5 -1
- data/lib/pact_broker/pacts/order_hash_keys.rb +29 -0
- data/lib/pact_broker/pacts/pact_params.rb +3 -1
- data/lib/pact_broker/pacts/pact_publication.rb +7 -1
- data/lib/pact_broker/pacts/pact_version.rb +2 -0
- data/lib/pact_broker/pacts/repository.rb +41 -12
- data/lib/pact_broker/pacts/service.rb +27 -22
- data/lib/pact_broker/pacts/sort_content.rb +6 -22
- data/lib/pact_broker/services.rb +10 -0
- data/lib/pact_broker/test/test_data_builder.rb +353 -0
- data/lib/pact_broker/ui/controllers/index.rb +6 -1
- data/lib/pact_broker/ui/view_models/index_item.rb +13 -0
- data/lib/pact_broker/ui/views/index/_css_and_js.haml +8 -0
- data/lib/pact_broker/ui/views/index/show-with-tags.haml +44 -41
- data/lib/pact_broker/ui/views/index/show.haml +29 -28
- data/lib/pact_broker/ui/views/layouts/main.haml +1 -1
- data/lib/pact_broker/ui/views/matrix/show.haml +5 -5
- data/lib/pact_broker/verifications/all_verifications.rb +15 -0
- data/lib/pact_broker/verifications/latest_verification_for_pact_version.rb +16 -0
- data/lib/pact_broker/verifications/repository.rb +6 -0
- data/lib/pact_broker/verifications/service.rb +4 -0
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/versions/repository.rb +12 -0
- data/lib/pact_broker/webhooks/execution.rb +1 -1
- data/lib/pact_broker/webhooks/job.rb +4 -3
- data/lib/pact_broker/webhooks/render.rb +4 -5
- data/lib/pact_broker/webhooks/repository.rb +5 -0
- data/lib/pact_broker/webhooks/service.rb +7 -2
- data/lib/pact_broker/webhooks/trigger_service.rb +68 -0
- data/lib/pact_broker/webhooks/triggered_webhook.rb +3 -0
- data/lib/pact_broker/webhooks/webhook.rb +1 -0
- data/lib/pact_broker/webhooks/webhook_request_template.rb +7 -6
- data/lib/rack/pact_broker/reset_thread_data.rb +22 -0
- data/lib/rack/pact_broker/store_base_url.rb +1 -1
- data/lib/rack/pact_broker/ui_request_filter.rb +65 -0
- data/lib/webmachine/rack_adapter_monkey_patch.rb +39 -0
- data/public/css/bootstrap-theme.css +342 -101
- data/public/css/bootstrap-theme.css.map +1 -0
- data/public/css/bootstrap-theme.min.css +4 -5
- data/public/css/bootstrap-theme.min.css.map +1 -0
- data/public/css/bootstrap.css +3805 -2828
- data/public/css/bootstrap.css.map +1 -0
- data/public/css/bootstrap.min.css +4 -5
- data/public/css/bootstrap.min.css.map +1 -0
- data/public/fonts/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2 +0 -0
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +272 -213
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/public/javascripts/index.js +169 -0
- data/public/javascripts/jquery-3.3.1.js +10364 -0
- data/public/javascripts/jquery-3.3.1.min.js +2 -0
- data/public/javascripts/jquery-3.3.1.min.map +1 -0
- data/public/javascripts/jquery-confirm.min.js +10 -0
- data/public/javascripts/material-menu.js +241 -0
- data/public/javascripts/pact.js +160 -3
- data/public/js/bootstrap.js +1180 -746
- data/public/js/bootstrap.min.js +5 -5
- data/public/js/npm.js +13 -0
- data/public/stylesheets/index.css +5 -1
- data/public/stylesheets/jquery-confirm.min.css +9 -0
- data/public/stylesheets/material-icon.css +23 -0
- data/public/stylesheets/material-menu.css +108 -0
- data/public/stylesheets/pact.css +3 -3
- data/script/insert-self-signed-certificate-from-url.rb +2 -0
- data/spec/features/delete_integration_spec.rb +27 -0
- data/spec/features/delete_pact_spec.rb +2 -2
- data/spec/features/execute_webhook_spec.rb +2 -6
- data/spec/features/get_pacts_to_verify_spec.rb +37 -0
- data/spec/features/merge_pact_spec.rb +1 -1
- data/spec/features/publish_pact_spec.rb +2 -2
- data/spec/integration/app_spec.rb +16 -8
- data/spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb +18 -5
- data/spec/lib/pact_broker/api/contracts/put_pact_params_contract_spec.rb +0 -1
- data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +0 -1
- data/spec/lib/pact_broker/api/decorators/dashboard_decorator_spec.rb +15 -3
- data/spec/lib/pact_broker/api/decorators/pact_decorator_spec.rb +1 -1
- data/spec/lib/pact_broker/api/decorators/pacticipant_decorator_spec.rb +2 -2
- data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +2 -2
- data/spec/lib/pact_broker/api/renderers/html_pact_renderer_spec.rb +2 -3
- data/spec/lib/pact_broker/api/resources/base_resource_spec.rb +2 -2
- data/spec/lib/pact_broker/api/resources/error_handler_spec.rb +1 -2
- data/spec/lib/pact_broker/api/resources/pact_spec.rb +2 -3
- data/spec/lib/pact_broker/api/resources/tagged_pact_versions_spec.rb +2 -2
- data/spec/lib/pact_broker/domain/order_versions_spec.rb +4 -4
- data/spec/lib/pact_broker/domain/webhook_spec.rb +3 -2
- data/spec/lib/pact_broker/integrations/service_spec.rb +227 -0
- data/spec/lib/pact_broker/pacts/content_spec.rb +58 -0
- data/spec/lib/pact_broker/pacts/generate_interaction_sha_spec.rb +45 -0
- data/spec/lib/pact_broker/pacts/merger_spec.rb +33 -0
- data/spec/lib/pact_broker/pacts/pact_params_spec.rb +5 -1
- data/spec/lib/pact_broker/pacts/repository_spec.rb +100 -32
- data/spec/lib/pact_broker/pacts/service_spec.rb +39 -89
- data/spec/lib/pact_broker/webhooks/job_spec.rb +11 -8
- data/spec/lib/pact_broker/webhooks/render_spec.rb +8 -5
- data/spec/lib/pact_broker/webhooks/service_spec.rb +3 -1
- data/spec/lib/pact_broker/webhooks/trigger_service_spec.rb +140 -0
- data/spec/lib/pact_broker/webhooks/webhook_request_template_spec.rb +5 -4
- data/spec/lib/rack/pact_broker/ui_request_filter_spec.rb +60 -0
- data/spec/lib/webmachine/rack_adapter_monkey_patch_spec.rb +50 -0
- data/spec/service_consumers/pact_helper.rb +1 -1
- data/spec/service_consumers/provider_states_for_pact_broker_client.rb +6 -6
- data/spec/spec_helper.rb +5 -0
- data/spec/support/markdown_pact_with_html.json +27 -0
- data/spec/support/shared_context.rb +6 -0
- data/spec/support/test_data_builder.rb +2 -353
- data/tasks/rspec.rake +2 -2
- metadata +51 -7
- data/lib/rack/pact_broker/accepts_html_filter.rb +0 -31
- data/lib/webmachine/convert_request_to_rack_env.rb +0 -37
- data/public/javascripts/jquery-2.1.1.min.js +0 -4
- data/spec/lib/webmachine/convert_request_to_rack_env_spec.rb +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f778ef154be3a35cb2cc58deeaa7445228413820
|
4
|
+
data.tar.gz: 27d7c415594fe68b43f0813d7a47392faeb49b25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93b6226a1d82f747454a48513a789b2215dedc12fce7e1173554ef2fc36d7584369b551d050c2b6f067f5199e43d1a37a640d7b596717fc8a114826773abca97
|
7
|
+
data.tar.gz: 1d6c6605ea29d1c827b0f2073cde3b9782eefca979b3851b8c84804e210fc1ba71c56d8306de77abde51707557d0e2db8906475903634c6c9e0a10b2921efea9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,54 @@
|
|
1
|
+
<a name="v2.31.0"></a>
|
2
|
+
### v2.31.0 (2019-04-30)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* display times in UTC in API responses ([a4231117](/../../commit/a4231117))
|
8
|
+
* log the reason why a webhook has been triggered ([30522c0d](/../../commit/30522c0d))
|
9
|
+
* add _ids to interactions added via the TestDataBuilder ([d21e7092](/../../commit/d21e7092))
|
10
|
+
* update names of example apps ([2b2a3f81](/../../commit/2b2a3f81))
|
11
|
+
* ignore order of keys when generating interaction sha ([e6a0e8d8](/../../commit/e6a0e8d8))
|
12
|
+
* use _id instead of id for the interaction identifier ([010a14ab](/../../commit/010a14ab))
|
13
|
+
* add ids to interactions when pacts are published ([cd377850](/../../commit/cd377850))
|
14
|
+
* remove whitespace from pact content when saving to database ([1f53682e](/../../commit/1f53682e))
|
15
|
+
* monkeypatch webmachine to make the rack env available on the request ([40be97db](/../../commit/40be97db))
|
16
|
+
* ensure index page is not cached ([0cfa9bbf](/../../commit/0cfa9bbf))
|
17
|
+
* correct provider state matching for merging ([41ff6e5d](/../../commit/41ff6e5d))
|
18
|
+
* only seed example data when database is empty ([0f2d00a6](/../../commit/0f2d00a6))
|
19
|
+
* seed app with example data on first startup ([cf27ad8c](/../../commit/cf27ad8c))
|
20
|
+
* batch delete versions and tags using delete instead of destroy for efficiency ([1315e0b1](/../../commit/1315e0b1))
|
21
|
+
* allow pact to be deleted through the UI ([df0f35cb](/../../commit/df0f35cb))
|
22
|
+
* upgrade bootstrap ([1be9f1b2](/../../commit/1be9f1b2))
|
23
|
+
* allow an integration to be deleted via the UI ([f520520e](/../../commit/f520520e))
|
24
|
+
* add delete integration which deletes all objects pertaining to an integration that are not referenced by other objects ([718f0218](/../../commit/718f0218))
|
25
|
+
* simplify the logic that determines if the request is for the UI or the API ([73ae0fc2](/../../commit/73ae0fc2))
|
26
|
+
* change pact rendering log message from warn to info ([93229103](/../../commit/93229103))
|
27
|
+
* upgrade jquery version to 3.3.1 ([82b830cf](/../../commit/82b830cf))
|
28
|
+
|
29
|
+
* **dashboard**
|
30
|
+
* sort items by most recent activity ([f6f8fb20](/../../commit/f6f8fb20))
|
31
|
+
|
32
|
+
* **index**
|
33
|
+
* add button to delete all pact versions ([b5d15d5d](/../../commit/b5d15d5d))
|
34
|
+
|
35
|
+
|
36
|
+
#### Bug Fixes
|
37
|
+
|
38
|
+
* ensure datetime tests run correctly regardless of timezone ([0506be30](/../../commit/0506be30))
|
39
|
+
* correct logic for filtering ui/api requests ([725c6ccb](/../../commit/725c6ccb))
|
40
|
+
* ensure that the templating in the webhook body uses the correct base URL for the broker ([3d5a5380](/../../commit/3d5a5380))
|
41
|
+
* handle deleting integration when consumer and provider are the same pacticipant ([f31e8df2](/../../commit/f31e8df2))
|
42
|
+
* correct tbody in show-with-tags index page ([325a98ed](/../../commit/325a98ed))
|
43
|
+
* delete overwritten pact publications when deleting all pact publications between a consumer and provider ([5456eda5](/../../commit/5456eda5))
|
44
|
+
* escape html on index pages ([6ee34afe](/../../commit/6ee34afe))
|
45
|
+
* sanitize html in matrix ([c4d74d87](/../../commit/c4d74d87))
|
46
|
+
* sanitize fields when rendering pact html ([dca76506](/../../commit/dca76506))
|
47
|
+
|
48
|
+
* **readme**
|
49
|
+
* Change gitter link to slack. + Minor typo ([6b1c7843](/../../commit/6b1c7843))
|
50
|
+
|
51
|
+
|
1
52
|
<a name="v2.30.0"></a>
|
2
53
|
### v2.30.0 (2019-03-29)
|
3
54
|
|
data/README.md
CHANGED
@@ -43,7 +43,7 @@ Features:
|
|
43
43
|
#### Step 1. Consumer CI build
|
44
44
|
1. The consumer project runs its tests using the [Pact][pact] library to provide a mock service.
|
45
45
|
2. While the tests run, the mock service writes the requests and the expected responses to a JSON "pact" file - this is the consumer contract.
|
46
|
-
3. The generated pact is then published to the Pact Broker. Most Pact
|
46
|
+
3. The generated pact is then published to the Pact Broker. Most Pact libraries will make a task available for you to do this easily, however, at its simplest, it is a `PUT` to a resource that specifies the consumer name and application version, and the provider name. eg `http://my-pact-broker/pacts/provider/Animal%20Service/consumer/Zoo%20App/version/1.0.0`
|
47
47
|
(Note that you are specifying the _consumer application version_ in the URL, not the pact version. The broker will take care of versioning the pact behind the scenes when its content changes. It is expected that the consumer application version will increment with every CI build.)
|
48
48
|
4. When a pact is published, a webhook in the Pact Broker kicks off a build of the provider project if the pact content has changed since the previous version.
|
49
49
|
|
@@ -73,7 +73,7 @@ See the [wiki][wiki] for documentation on the Pact Broker. Please read the [over
|
|
73
73
|
* Check the [wiki][wiki] first.
|
74
74
|
* See if there is an existing or closed [issue][issues] and raise a new issue if not.
|
75
75
|
* See if there is an existing question on [stackoverflow][stackoverflow] tagged with `pact-broker`, and ask a new question if not.
|
76
|
-
* Have a chat to us on the Pact [
|
76
|
+
* Have a chat to us on the Pact [slack][slack].
|
77
77
|
* Tweet us at [@pact_up][twitter] on the twitters.
|
78
78
|
|
79
79
|
### Screenshots
|
@@ -166,7 +166,7 @@ Please read the [UPGRADING.md](UPGRADING.md) documentation before upgrading your
|
|
166
166
|
[reverse-proxy-docs]: https://github.com/pact-foundation/pact_broker/wiki/Configuration#running-the-broker-behind-a-reverse-proxy
|
167
167
|
[stackoverflow]: http://stackoverflow.com/questions/tagged/pact-broker
|
168
168
|
[twitter]: https://twitter.com/pact_up
|
169
|
-
[
|
169
|
+
[slack]: https://slack.pact.io/
|
170
170
|
[issues]: https://github.com/pact-foundation/pact_broker/issues
|
171
171
|
[pact-docs]: http://docs.pact.io
|
172
172
|
[cli]: https://github.com/pact-foundation/pact-ruby-standalone/releases
|
data/config/database.yml
CHANGED
@@ -12,10 +12,12 @@ test:
|
|
12
12
|
<<: *default
|
13
13
|
adapter: postgres
|
14
14
|
docker_postgres:
|
15
|
-
<<: *default
|
16
15
|
adapter: postgres
|
17
|
-
|
18
|
-
|
16
|
+
database: postgres
|
17
|
+
username: postgres
|
18
|
+
password: postgres
|
19
|
+
host: "localhost"
|
20
|
+
port: "5432"
|
19
21
|
docker_compose_postgres:
|
20
22
|
<<: *default
|
21
23
|
adapter: postgres
|
data/lib/db.rb
CHANGED
@@ -26,6 +26,7 @@ module DB
|
|
26
26
|
#
|
27
27
|
def self.connect db_credentials
|
28
28
|
Sequel.datetime_class = DateTime
|
29
|
+
# logger = Logger.new($stdout)
|
29
30
|
con = Sequel.connect(db_credentials.merge(:logger => logger, :pool_class => Sequel::ThreadedConnectionPool, :encoding => 'utf8'))
|
30
31
|
con.extension(:connection_validator)
|
31
32
|
con.pool.connection_validation_timeout = -1 #Check the connection on every request
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'pact/doc/markdown/interaction_renderer'
|
2
2
|
require 'pact/doc/sort_interactions'
|
3
|
+
require 'rack/utils'
|
3
4
|
|
4
5
|
module Pact
|
5
6
|
module Doc
|
@@ -15,7 +16,7 @@ module Pact
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def call
|
18
|
-
title + summaries_title + summaries
|
19
|
+
title + summaries_title + summaries + interactions_title + full_interactions
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
@@ -39,11 +40,11 @@ module Pact
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def summaries
|
42
|
-
interaction_renderers.collect(&:render_summary)
|
43
|
+
interaction_renderers.collect(&:render_summary).join
|
43
44
|
end
|
44
45
|
|
45
46
|
def full_interactions
|
46
|
-
interaction_renderers.collect(&:render_full_interaction)
|
47
|
+
interaction_renderers.collect(&:render_full_interaction).join
|
47
48
|
end
|
48
49
|
|
49
50
|
def sorted_interactions
|
@@ -51,17 +52,20 @@ module Pact
|
|
51
52
|
end
|
52
53
|
|
53
54
|
def consumer_name
|
54
|
-
markdown_escape consumer_contract.consumer.name
|
55
|
+
h(markdown_escape consumer_contract.consumer.name)
|
55
56
|
end
|
56
57
|
|
57
58
|
def provider_name
|
58
|
-
markdown_escape consumer_contract.provider.name
|
59
|
+
h(markdown_escape consumer_contract.provider.name)
|
59
60
|
end
|
60
61
|
|
61
62
|
def markdown_escape string
|
62
63
|
string.gsub('*','\*').gsub('_','\_')
|
63
64
|
end
|
64
65
|
|
66
|
+
def h(text)
|
67
|
+
Rack::Utils.escape_html(text)
|
68
|
+
end
|
65
69
|
end
|
66
70
|
end
|
67
71
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<a name="<%= interaction.id %>"></a>
|
2
2
|
<%= if interaction.has_provider_state?
|
3
|
-
"Given **#{interaction.provider_state}**, upon receiving"
|
3
|
+
"Given **#{h(interaction.provider_state)}**, upon receiving"
|
4
4
|
else
|
5
5
|
"Upon receiving"
|
6
6
|
end
|
7
|
-
%> **<%= interaction.description %>** from <%= interaction.consumer_name %>, with
|
7
|
+
%> **<%= h(interaction.description) %>** from <%= h(interaction.consumer_name) %>, with
|
8
8
|
```json
|
9
9
|
<%= interaction.request %>
|
10
10
|
```
|
11
|
-
<%= interaction.provider_name %> will respond with:
|
11
|
+
<%= h(interaction.provider_name) %> will respond with:
|
12
12
|
```json
|
13
13
|
<%= interaction.response %>
|
14
14
|
```
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'pact/doc/interaction_view_model'
|
3
|
+
require 'rack/utils'
|
3
4
|
|
4
5
|
module Pact
|
5
6
|
module Doc
|
@@ -12,8 +13,8 @@ module Pact
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def render_summary
|
15
|
-
suffix = interaction.has_provider_state? ? " given #{interaction.provider_state}" : ""
|
16
|
-
"* [#{interaction.description(true)}](##{interaction.id})#{suffix}\n\n"
|
16
|
+
suffix = interaction.has_provider_state? ? " given #{h(interaction.provider_state)}" : ""
|
17
|
+
"* [#{h(interaction.description(true))}](##{interaction.id})#{suffix}\n\n"
|
17
18
|
end
|
18
19
|
|
19
20
|
def render_full_interaction
|
@@ -36,6 +37,9 @@ module Pact
|
|
36
37
|
File.dirname(__FILE__) + template_file
|
37
38
|
end
|
38
39
|
|
40
|
+
def h(text)
|
41
|
+
Rack::Utils.escape_html(text)
|
42
|
+
end
|
39
43
|
end
|
40
44
|
end
|
41
45
|
end
|
data/lib/pact_broker.rb
CHANGED
@@ -1,13 +1,4 @@
|
|
1
|
-
require 'reform'
|
2
|
-
require 'reform/form/dry'
|
3
|
-
|
4
1
|
require 'pact_broker/version'
|
5
2
|
require 'pact_broker/logging'
|
6
3
|
require 'pact_broker/app'
|
7
4
|
require 'pact_broker/db/log_quietener'
|
8
|
-
|
9
|
-
module PactBroker
|
10
|
-
Reform::Form.class_eval do
|
11
|
-
feature Reform::Form::Dry
|
12
|
-
end
|
13
|
-
end
|
data/lib/pact_broker/api.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'webmachine/adapters/rack_mapped'
|
2
|
+
require 'webmachine/rack_adapter_monkey_patch'
|
2
3
|
require 'pact_broker/api/resources'
|
3
4
|
require 'pact_broker/feature_toggle'
|
4
5
|
|
@@ -86,6 +87,7 @@ module PactBroker
|
|
86
87
|
add ['test','error'], Api::Resources::ErrorTest, {resource_name: "error_test"}
|
87
88
|
|
88
89
|
add ['integrations'], Api::Resources::Integrations, {resource_name: "integrations"}
|
90
|
+
add ['integrations', 'provider', :provider_name, 'consumer', :consumer_name], Api::Resources::Integration, {resource_name: "integration"}
|
89
91
|
add [], Api::Resources::Index, {resource_name: "index"}
|
90
92
|
end
|
91
93
|
end
|
@@ -1,10 +1,9 @@
|
|
1
|
-
require '
|
2
|
-
require 'reform/form'
|
1
|
+
require 'pact_broker/api/contracts/base_contract'
|
3
2
|
|
4
3
|
module PactBroker
|
5
4
|
module Api
|
6
5
|
module Contracts
|
7
|
-
class PacticipantNameContract <
|
6
|
+
class PacticipantNameContract < BaseContract
|
8
7
|
property :name
|
9
8
|
property :name_in_pact
|
10
9
|
property :pacticipant
|
@@ -1,10 +1,9 @@
|
|
1
|
-
require '
|
2
|
-
require 'reform/form'
|
1
|
+
require 'pact_broker/api/contracts/base_contract'
|
3
2
|
|
4
3
|
module PactBroker
|
5
4
|
module Api
|
6
5
|
module Contracts
|
7
|
-
class PutPacticipantNameContract <
|
6
|
+
class PutPacticipantNameContract < BaseContract
|
8
7
|
property :name
|
9
8
|
property :name_in_pact
|
10
9
|
property :pacticipant
|
@@ -24,7 +23,7 @@ module PactBroker
|
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
class PutPactParamsContract <
|
26
|
+
class PutPactParamsContract < BaseContract
|
28
27
|
property :consumer_version_number
|
29
28
|
property :consumer, form: PutPacticipantNameContract
|
30
29
|
property :provider, form: PutPacticipantNameContract
|
@@ -1,11 +1,10 @@
|
|
1
|
-
require '
|
2
|
-
require 'reform/form'
|
1
|
+
require 'pact_broker/api/contracts/base_contract'
|
3
2
|
require 'uri'
|
4
3
|
|
5
4
|
module PactBroker
|
6
5
|
module Api
|
7
6
|
module Contracts
|
8
|
-
class VerificationContract <
|
7
|
+
class VerificationContract < BaseContract
|
9
8
|
|
10
9
|
property :success
|
11
10
|
property :provider_version, as: :providerApplicationVersion
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'reform/form'
|
1
|
+
require 'pact_broker/api/contracts/base_contract'
|
3
2
|
require 'pact_broker/webhooks/check_host_whitelist'
|
4
3
|
require 'pact_broker/webhooks/render'
|
5
4
|
require 'pact_broker/pacticipants/service'
|
@@ -7,7 +6,7 @@ require 'pact_broker/pacticipants/service'
|
|
7
6
|
module PactBroker
|
8
7
|
module Api
|
9
8
|
module Contracts
|
10
|
-
class WebhookContract <
|
9
|
+
class WebhookContract < BaseContract
|
11
10
|
|
12
11
|
def validate(*)
|
13
12
|
result = super
|
@@ -2,6 +2,7 @@ require 'roar/decorator'
|
|
2
2
|
require 'roar/json/hal'
|
3
3
|
require 'pact_broker/api/pact_broker_urls'
|
4
4
|
require 'pact_broker/api/decorators/decorator_context'
|
5
|
+
require 'pact_broker/api/decorators/format_date_time'
|
5
6
|
|
6
7
|
module PactBroker
|
7
8
|
|
@@ -13,6 +14,7 @@ module PactBroker
|
|
13
14
|
include Roar::JSON::HAL
|
14
15
|
include Roar::JSON::HAL::Links
|
15
16
|
include PactBroker::Api::PactBrokerUrls
|
17
|
+
include FormatDateTime
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
require 'pact_broker/api/pact_broker_urls'
|
3
|
+
require 'pact_broker/api/decorators/format_date_time'
|
3
4
|
|
4
5
|
module PactBroker
|
5
6
|
module Api
|
6
7
|
module Decorators
|
7
8
|
class DashboardDecorator
|
8
9
|
include PactBroker::Api::PactBrokerUrls
|
10
|
+
include FormatDateTime
|
9
11
|
|
10
12
|
def initialize(index_items)
|
11
13
|
@index_items = index_items
|
@@ -26,11 +28,15 @@ module PactBroker
|
|
26
28
|
attr_reader :index_items
|
27
29
|
|
28
30
|
def items(index_items, base_url)
|
29
|
-
|
31
|
+
sorted_index_items.collect do | index_item |
|
30
32
|
index_item_hash(index_item.consumer, index_item.provider, index_item.consumer_version, index_item, base_url)
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
36
|
+
def sorted_index_items
|
37
|
+
index_items.sort{ |i1, i2| i2.last_activity_date <=> i1.last_activity_date }
|
38
|
+
end
|
39
|
+
|
34
40
|
def index_item_hash(consumer, provider, consumer_version, index_item, base_url)
|
35
41
|
{
|
36
42
|
consumer: consumer_hash(index_item, consumer, consumer_version, base_url),
|
@@ -86,7 +92,7 @@ module PactBroker
|
|
86
92
|
|
87
93
|
def pact_hash(index_item, base_url)
|
88
94
|
{
|
89
|
-
createdAt: index_item.latest_pact.created_at
|
95
|
+
createdAt: format_date_time(index_item.latest_pact.created_at),
|
90
96
|
_links: {
|
91
97
|
self: {
|
92
98
|
href: pact_url(base_url, index_item.latest_pact)
|
@@ -99,7 +105,7 @@ module PactBroker
|
|
99
105
|
if index_item.latest_verification
|
100
106
|
{
|
101
107
|
success: index_item.latest_verification.success,
|
102
|
-
verifiedAt: index_item.latest_verification.created_at
|
108
|
+
verifiedAt: format_date_time(index_item.latest_verification.created_at),
|
103
109
|
_links: {
|
104
110
|
self: {
|
105
111
|
href: verification_url(index_item.latest_verification, base_url)
|
@@ -144,7 +150,7 @@ module PactBroker
|
|
144
150
|
def latest_webhook_execution(index_item, base_url)
|
145
151
|
if index_item.last_webhook_execution_date
|
146
152
|
{
|
147
|
-
triggeredAt: index_item.last_webhook_execution_date
|
153
|
+
triggeredAt: format_date_time(index_item.last_webhook_execution_date)
|
148
154
|
}
|
149
155
|
end
|
150
156
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module PactBroker
|
2
|
+
module Api
|
3
|
+
module Decorators
|
4
|
+
module FormatDateTime
|
5
|
+
def self.call(date_time)
|
6
|
+
date_time.to_time.utc.to_datetime.xmlschema if date_time
|
7
|
+
end
|
8
|
+
|
9
|
+
def format_date_time(date_time)
|
10
|
+
FormatDateTime.call(date_time)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
require 'pact_broker/api/pact_broker_urls'
|
3
3
|
require 'pact_broker/api/decorators/reason_decorator'
|
4
|
+
require 'pact_broker/api/decorators/format_date_time'
|
4
5
|
|
5
6
|
module PactBroker
|
6
7
|
module Api
|
7
8
|
module Decorators
|
8
9
|
class MatrixDecorator
|
9
10
|
include PactBroker::Api::PactBrokerUrls
|
11
|
+
include FormatDateTime
|
10
12
|
|
11
13
|
def initialize(query_results_with_deployment_status_summary)
|
12
14
|
@query_results_with_deployment_status_summary = query_results_with_deployment_status_summary
|
@@ -102,7 +104,7 @@ module PactBroker
|
|
102
104
|
|
103
105
|
def pact_hash(line, base_url)
|
104
106
|
{
|
105
|
-
createdAt: line.pact_created_at
|
107
|
+
createdAt: format_date_time(line.pact_created_at),
|
106
108
|
_links: {
|
107
109
|
self: {
|
108
110
|
href: pact_url(base_url, line)
|
@@ -120,7 +122,7 @@ module PactBroker
|
|
120
122
|
}
|
121
123
|
{
|
122
124
|
success: line.success,
|
123
|
-
verifiedAt: line.verification_executed_at
|
125
|
+
verifiedAt: format_date_time(line.verification_executed_at),
|
124
126
|
_links: {
|
125
127
|
self: {
|
126
128
|
href: verification_url_from_params(url_params, base_url)
|