pact_broker 2.85.0 → 2.88.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/trigger_pact_docs_update.yml +22 -0
- data/CHANGELOG.md +67 -0
- data/DEVELOPER_DOCUMENTATION.md +0 -2
- data/db/migrations/20210914_add_labels_to_webhooks.rb +14 -0
- data/db/migrations/20210915_add_verified_by_to_verification.rb +6 -0
- data/db/migrations/20210929_increase_event_context_column_size.rb +14 -0
- data/docker-compose-ci-mysql.yml +1 -0
- data/docker-compose-test.yml +2 -0
- data/docs/CONFIGURATION.md +255 -66
- data/docs/api/WEBHOOKS.md +789 -0
- data/docs/configuration.yml +166 -101
- data/lib/db.rb +0 -1
- data/lib/pact/doc/interaction_view_model.rb +2 -2
- data/lib/pact/doc/markdown/consumer_contract_renderer.rb +1 -1
- data/lib/pact_broker/api/contracts/configuration.rb +33 -0
- data/lib/pact_broker/api/contracts/publish_contracts_schema.rb +35 -16
- data/lib/pact_broker/api/contracts/webhook_contract.rb +24 -2
- data/lib/pact_broker/api/decorators/matrix_decorator.rb +3 -1
- data/lib/pact_broker/api/decorators/pact_decorator.rb +12 -0
- data/lib/pact_broker/api/decorators/verification_decorator.rb +9 -3
- data/lib/pact_broker/api/decorators/webhook_decorator.rb +27 -4
- data/lib/pact_broker/api/pact_broker_urls.rb +30 -6
- data/lib/pact_broker/api/resources/all_webhooks.rb +2 -2
- data/lib/pact_broker/api/resources/default_base_resource.rb +5 -1
- data/lib/pact_broker/api/resources/environment.rb +4 -4
- data/lib/pact_broker/api/resources/environments.rb +1 -1
- data/lib/pact_broker/api/resources/index.rb +7 -1
- data/lib/pact_broker/api/resources/metadata_resource_methods.rb +33 -3
- data/lib/pact_broker/api/resources/pact_version.rb +4 -0
- data/lib/pact_broker/api/resources/previous_distinct_pact_version.rb +1 -1
- data/lib/pact_broker/api/resources/publish_contracts.rb +1 -1
- data/lib/pact_broker/api/resources/verification.rb +5 -2
- data/lib/pact_broker/api/resources/webhook_execution.rb +7 -3
- data/lib/pact_broker/api/resources/webhook_execution_methods.rb +23 -17
- data/lib/pact_broker/api.rb +6 -0
- data/lib/pact_broker/application_context.rb +5 -0
- data/lib/pact_broker/config/runtime_configuration.rb +4 -0
- data/lib/pact_broker/config/runtime_configuration_database_methods.rb +1 -1
- data/lib/pact_broker/db/clean.rb +1 -2
- data/lib/pact_broker/db/delete_overwritten_data.rb +41 -23
- data/lib/pact_broker/deployments/deployed_version.rb +1 -0
- data/lib/pact_broker/deployments/deployed_version_service.rb +1 -0
- data/lib/pact_broker/deployments/environment_service.rb +7 -2
- data/lib/pact_broker/deployments/released_version_service.rb +1 -0
- data/lib/pact_broker/doc/controllers/app.rb +1 -0
- data/lib/pact_broker/doc/views/can-i-deploy.markdown +2 -1
- data/lib/pact_broker/doc/views/index/publish-contracts.markdown +38 -9
- data/lib/pact_broker/doc/views/pacticipant/label.markdown +12 -0
- data/lib/pact_broker/doc/views/provider-pacts-for-verification.markdown +7 -7
- data/lib/pact_broker/doc/views/webhooks.markdown +17 -0
- data/lib/pact_broker/domain/index_item.rb +9 -0
- data/lib/pact_broker/domain/pacticipant.rb +4 -0
- data/lib/pact_broker/domain/verification.rb +19 -4
- data/lib/pact_broker/domain/webhook.rb +5 -5
- data/lib/pact_broker/domain/webhook_pacticipant.rb +6 -0
- data/lib/pact_broker/index/service.rb +4 -4
- data/lib/pact_broker/locale/en.yml +4 -1
- data/lib/pact_broker/matrix/head_row.rb +1 -1
- data/lib/pact_broker/matrix/parse_can_i_deploy_query.rb +5 -3
- data/lib/pact_broker/matrix/quick_row.rb +0 -1
- data/lib/pact_broker/matrix/repository.rb +0 -1
- data/lib/pact_broker/matrix/row.rb +2 -2
- data/lib/pact_broker/pacticipants/repository.rb +1 -1
- data/lib/pact_broker/pacts/latest_pact_publication_id_for_consumer_version.rb +0 -1
- data/lib/pact_broker/pacts/metadata.rb +7 -1
- data/lib/pact_broker/pacts/pact_publication.rb +7 -0
- data/lib/pact_broker/pacts/pact_publication_clean_selector_dataset_module.rb +19 -0
- data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +30 -2
- data/lib/pact_broker/pacts/pact_version.rb +24 -1
- data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +5 -4
- data/lib/pact_broker/pacts/repository.rb +50 -47
- data/lib/pact_broker/pacts/service.rb +5 -5
- data/lib/pact_broker/string_refinements.rb +1 -1
- data/lib/pact_broker/test/http_test_data_builder.rb +40 -10
- data/lib/pact_broker/test/test_data_builder.rb +28 -5
- data/lib/pact_broker/ui/helpers/url_helper.rb +12 -0
- data/lib/pact_broker/ui/view_models/index_item.rb +15 -1
- data/lib/pact_broker/ui/view_models/index_item_branch_head.rb +39 -0
- data/lib/pact_broker/ui/view_models/index_item_provider_branch_head.rb +39 -0
- data/lib/pact_broker/ui/views/dashboard/show.haml +14 -7
- data/lib/pact_broker/verifications/repository.rb +5 -2
- data/lib/pact_broker/verifications/service.rb +7 -4
- data/lib/pact_broker/version.rb +1 -1
- data/lib/pact_broker/versions/abbreviate_number.rb +8 -4
- data/lib/pact_broker/versions/branch_head.rb +0 -2
- data/lib/pact_broker/versions/branch_version.rb +1 -0
- data/lib/pact_broker/versions/repository.rb +0 -1
- data/lib/pact_broker/webhooks/event_listener.rb +4 -2
- data/lib/pact_broker/webhooks/pact_and_verification_parameters.rb +18 -3
- data/lib/pact_broker/webhooks/repository.rb +10 -4
- data/lib/pact_broker/webhooks/trigger_service.rb +1 -1
- data/lib/pact_broker/webhooks/webhook.rb +71 -8
- data/lib/webmachine/describe_routes.rb +62 -0
- data/public/stylesheets/index.css +5 -0
- data/script/data/auto-create-things-for-tags.rb +1 -0
- data/script/data/branches.rb +1 -1
- data/script/data/contract-published-requiring-verification.rb +0 -1
- data/script/data/verify-pact-for-multiple-selectors.rb +30 -0
- data/script/docs/generate-api-docs.rb +117 -0
- data/script/docs/generate-configuration-docs.rb +24 -3
- data/script/docs/regenerate-api-docs.sh +11 -0
- data/script/generate-erd +55 -0
- data/spec/features/create_webhook_spec.rb +55 -10
- data/spec/features/get_pact_spec.rb +2 -3
- data/spec/fixtures/approvals/docs_webhooks_executing_a_saved_webhook_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_executing_a_saved_webhook_post.approved.json +43 -0
- data/spec/fixtures/approvals/docs_webhooks_executing_an_unsaved_webhook_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_executing_an_unsaved_webhook_post.approved.json +63 -0
- data/spec/fixtures/approvals/docs_webhooks_logs_of_triggered_webhook_get.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_logs_of_triggered_webhook_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_pact_webhooks_get.approved.json +45 -0
- data/spec/fixtures/approvals/docs_webhooks_pact_webhooks_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_pact_publication_get.approved.json +52 -0
- data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_pact_publication_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_verification_publication_get.approved.json +32 -0
- data/spec/fixtures/approvals/docs_webhooks_triggered_webhooks_for_verification_publication_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_webhook_get.approved.json +74 -0
- data/spec/fixtures/approvals/docs_webhooks_webhook_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_webhook_put.approved.json +77 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_for_a_provider_get.approved.json +41 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_for_a_provider_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_and_provider_get.approved.json +45 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_and_provider_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_get.approved.json +41 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_for_consumer_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_get.approved.json +45 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_options.approved.json +20 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_post.approved.json +78 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_status_get.approved.json +79 -0
- data/spec/fixtures/approvals/docs_webhooks_webhooks_status_options.approved.json +20 -0
- data/spec/fixtures/approvals/get_provider_pacts_for_verification.approved.json +1 -2
- data/spec/fixtures/approvals/publish_contract_no_branch.approved.json +1 -2
- data/spec/fixtures/approvals/publish_contract_nothing_exists.approved.json +1 -2
- data/spec/fixtures/approvals/publish_contract_nothing_exists_with_webhook.approved.json +1 -2
- data/spec/fixtures/approvals/publish_contract_verification_already_exists.approved.json +1 -2
- data/spec/fixtures/approvals/publish_contract_with_validation_error.approved.json +1 -2
- data/spec/fixtures/invalid-publish-contract-body.json +38 -0
- data/spec/fixtures/verification.json +4 -0
- data/spec/integration/pact_metdata_spec.rb +105 -0
- data/spec/integration/webhooks/contract_publication_spec.rb +68 -0
- data/spec/integration/webhooks/contract_requiring_verification_published_spec.rb +67 -0
- data/spec/integration/webhooks/pact_publication_spec.rb +51 -0
- data/spec/integration/webhooks_documentation_spec.rb +348 -0
- data/spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb +2 -2
- data/spec/lib/pact_broker/api/contracts/publish_contracts_schema_spec.rb +13 -0
- data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +50 -0
- data/spec/lib/pact_broker/api/decorators/matrix_decorator_spec.rb +1 -1
- data/spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb +15 -7
- data/spec/lib/pact_broker/api/decorators/verification_summary_decorator_spec.rb +4 -2
- data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +4 -4
- data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +18 -0
- data/spec/lib/pact_broker/api/resources/triggered_webhook_logs_spec.rb +6 -5
- data/spec/lib/pact_broker/config/runtime_configuration_documentation_spec.rb +30 -0
- data/spec/lib/pact_broker/deployments/environment_service_spec.rb +22 -1
- data/spec/lib/pact_broker/domain/webhook_spec.rb +35 -0
- data/spec/lib/pact_broker/matrix/head_row_spec.rb +9 -5
- data/spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb +13 -0
- data/spec/lib/pact_broker/pacts/{latest_tagged_pact_publications_spec.rb → pact_publication_clean_selector_dataset_module_spec.rb} +7 -9
- data/spec/lib/pact_broker/pacts/pact_version_spec.rb +32 -0
- data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +4 -5
- data/spec/lib/pact_broker/pacts/repository_spec.rb +33 -0
- data/spec/lib/pact_broker/ui/view_models/index_item_spec.rb +1 -1
- data/spec/lib/pact_broker/verifications/service_spec.rb +22 -8
- data/spec/lib/pact_broker/versions/abbreviate_number_spec.rb +2 -1
- data/spec/lib/pact_broker/webhooks/render_spec.rb +3 -2
- data/spec/lib/pact_broker/webhooks/repository_spec.rb +158 -15
- data/spec/lib/pact_broker/webhooks/webhook_spec.rb +8 -5
- data/spec/support/documentation.rb +64 -0
- data/spec/support/rack_helpers.rb +1 -1
- data/tasks/db.rake +4 -1
- data/tasks/development.rake +14 -13
- metadata +89 -12
- data/lib/pact_broker/pacts/all_pact_publications.rb +0 -158
- data/lib/pact_broker/pacts/latest_pact_publications.rb +0 -48
- data/lib/pact_broker/pacts/latest_pact_publications_by_consumer_version.rb +0 -26
- data/lib/pact_broker/pacts/latest_tagged_pact_publications.rb +0 -45
- data/lib/pact_broker/verifications/latest_verification_for_pact_version.rb +0 -39
- data/spec/lib/pact_broker/verifications/latest_verification_for_pact_version_spec.rb +0 -18
@@ -0,0 +1,789 @@
|
|
1
|
+
|
2
|
+
# Webhooks
|
3
|
+
|
4
|
+
|
5
|
+
## Webhook
|
6
|
+
|
7
|
+
Path: `/webhooks/:uuid`<br/>
|
8
|
+
Allowed methods: `GET`, `PUT`, `DELETE`<br/>
|
9
|
+
|
10
|
+
### GET
|
11
|
+
|
12
|
+
#### Request
|
13
|
+
|
14
|
+
Headers: `{"Accept":"application/hal+json"}`<br/>
|
15
|
+
|
16
|
+
|
17
|
+
#### Response
|
18
|
+
|
19
|
+
Status: `200`<br/>
|
20
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
21
|
+
Body:
|
22
|
+
|
23
|
+
```
|
24
|
+
{
|
25
|
+
"uuid": "d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
|
26
|
+
"description": "an example webhook",
|
27
|
+
"consumer": {
|
28
|
+
"name": "Foo"
|
29
|
+
},
|
30
|
+
"provider": {
|
31
|
+
"name": "Bar"
|
32
|
+
},
|
33
|
+
"enabled": true,
|
34
|
+
"request": {
|
35
|
+
"method": "POST",
|
36
|
+
"url": "https://example.org/example",
|
37
|
+
"headers": {
|
38
|
+
"Content-Type": "application/json"
|
39
|
+
},
|
40
|
+
"body": {
|
41
|
+
"pactUrl": "${pactbroker.pactUrl}"
|
42
|
+
}
|
43
|
+
},
|
44
|
+
"events": [
|
45
|
+
{
|
46
|
+
"name": "contract_content_changed"
|
47
|
+
}
|
48
|
+
],
|
49
|
+
"createdAt": "2021-09-01T00:07:21+00:00",
|
50
|
+
"_links": {
|
51
|
+
"self": {
|
52
|
+
"title": "an example webhook",
|
53
|
+
"href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
|
54
|
+
},
|
55
|
+
"pb:execute": {
|
56
|
+
"title": "Test the execution of the webhook with the latest matching pact or verification by sending a POST request to this URL",
|
57
|
+
"href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac/execute"
|
58
|
+
},
|
59
|
+
"pb:consumer": {
|
60
|
+
"title": "Consumer",
|
61
|
+
"name": "Foo",
|
62
|
+
"href": "http://example.org/pacticipants/Foo"
|
63
|
+
},
|
64
|
+
"pb:provider": {
|
65
|
+
"title": "Provider",
|
66
|
+
"name": "Bar",
|
67
|
+
"href": "http://example.org/pacticipants/Bar"
|
68
|
+
},
|
69
|
+
"pb:pact-webhooks": {
|
70
|
+
"title": "All webhooks for consumer Foo and provider Bar",
|
71
|
+
"href": "http://example.org/webhooks/provider/Bar/consumer/Foo"
|
72
|
+
},
|
73
|
+
"pb:webhooks": {
|
74
|
+
"title": "All webhooks",
|
75
|
+
"href": "http://example.org/webhooks"
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
```
|
80
|
+
|
81
|
+
|
82
|
+
### PUT
|
83
|
+
|
84
|
+
#### Request
|
85
|
+
|
86
|
+
Headers: `{"Content-Type":"application/json","Accept":"application/hal+json"}`<br/>
|
87
|
+
Body:
|
88
|
+
|
89
|
+
```
|
90
|
+
{
|
91
|
+
"description": "an example webhook",
|
92
|
+
"events": [
|
93
|
+
{
|
94
|
+
"name": "contract_content_changed"
|
95
|
+
}
|
96
|
+
],
|
97
|
+
"request": {
|
98
|
+
"method": "POST",
|
99
|
+
"url": "https://example.org/example",
|
100
|
+
"username": "username",
|
101
|
+
"password": "password",
|
102
|
+
"headers": {
|
103
|
+
"Accept": "application/json"
|
104
|
+
},
|
105
|
+
"body": {
|
106
|
+
"pactUrl": "${pactbroker.pactUrl}"
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
```
|
111
|
+
|
112
|
+
|
113
|
+
#### Response
|
114
|
+
|
115
|
+
Status: `200`<br/>
|
116
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
117
|
+
Body:
|
118
|
+
|
119
|
+
```
|
120
|
+
{
|
121
|
+
"uuid": "d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
|
122
|
+
"description": "an example webhook",
|
123
|
+
"enabled": true,
|
124
|
+
"request": {
|
125
|
+
"method": "POST",
|
126
|
+
"url": "https://example.org/example",
|
127
|
+
"headers": {
|
128
|
+
"Accept": "application/json"
|
129
|
+
},
|
130
|
+
"body": {
|
131
|
+
"pactUrl": "${pactbroker.pactUrl}"
|
132
|
+
},
|
133
|
+
"username": "username",
|
134
|
+
"password": "**********"
|
135
|
+
},
|
136
|
+
"events": [
|
137
|
+
{
|
138
|
+
"name": "contract_content_changed"
|
139
|
+
}
|
140
|
+
],
|
141
|
+
"createdAt": "2021-09-01T00:07:21+00:00",
|
142
|
+
"_links": {
|
143
|
+
"self": {
|
144
|
+
"title": "an example webhook",
|
145
|
+
"href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
|
146
|
+
},
|
147
|
+
"pb:execute": {
|
148
|
+
"title": "Test the execution of the webhook with the latest matching pact or verification by sending a POST request to this URL",
|
149
|
+
"href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac/execute"
|
150
|
+
},
|
151
|
+
"pb:webhooks": {
|
152
|
+
"title": "All webhooks",
|
153
|
+
"href": "http://example.org/webhooks"
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
```
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
## Webhooks
|
162
|
+
|
163
|
+
Path: `/webhooks`<br/>
|
164
|
+
Allowed methods: `GET`, `POST`<br/>
|
165
|
+
|
166
|
+
### GET
|
167
|
+
|
168
|
+
#### Request
|
169
|
+
|
170
|
+
Headers: `{"Accept":"application/hal+json"}`<br/>
|
171
|
+
|
172
|
+
|
173
|
+
#### Response
|
174
|
+
|
175
|
+
Status: `200`<br/>
|
176
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
177
|
+
Body:
|
178
|
+
|
179
|
+
```
|
180
|
+
{
|
181
|
+
"_links": {
|
182
|
+
"self": {
|
183
|
+
"title": "Webhooks",
|
184
|
+
"href": "http://example.org/webhooks"
|
185
|
+
},
|
186
|
+
"pb:create": {
|
187
|
+
"title": "POST to create a webhook",
|
188
|
+
"href": "http://example.org/webhooks"
|
189
|
+
},
|
190
|
+
"pb:webhooks": [
|
191
|
+
{
|
192
|
+
"title": "A webhook for the pact between Foo and Bar",
|
193
|
+
"name": "an example webhook",
|
194
|
+
"href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
|
195
|
+
}
|
196
|
+
],
|
197
|
+
"curies": [
|
198
|
+
{
|
199
|
+
"name": "pb",
|
200
|
+
"href": "http://example.org/doc/webhooks-{rel}",
|
201
|
+
"templated": true
|
202
|
+
}
|
203
|
+
]
|
204
|
+
}
|
205
|
+
}
|
206
|
+
```
|
207
|
+
|
208
|
+
|
209
|
+
### POST
|
210
|
+
|
211
|
+
#### Request
|
212
|
+
|
213
|
+
Headers: `{"Content-Type":"application/json","Accept":"application/hal+json"}`<br/>
|
214
|
+
Body:
|
215
|
+
|
216
|
+
```
|
217
|
+
{
|
218
|
+
"description": "an example webhook",
|
219
|
+
"events": [
|
220
|
+
{
|
221
|
+
"name": "contract_content_changed"
|
222
|
+
}
|
223
|
+
],
|
224
|
+
"request": {
|
225
|
+
"method": "POST",
|
226
|
+
"url": "https://example.org/example",
|
227
|
+
"username": "username",
|
228
|
+
"password": "password",
|
229
|
+
"headers": {
|
230
|
+
"Accept": "application/json"
|
231
|
+
},
|
232
|
+
"body": {
|
233
|
+
"pactUrl": "${pactbroker.pactUrl}"
|
234
|
+
}
|
235
|
+
}
|
236
|
+
}
|
237
|
+
```
|
238
|
+
|
239
|
+
|
240
|
+
#### Response
|
241
|
+
|
242
|
+
Status: `201`<br/>
|
243
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8","Location":"http://example.org/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ"}`<br/>
|
244
|
+
Body:
|
245
|
+
|
246
|
+
```
|
247
|
+
{
|
248
|
+
"uuid": "dCGCl-Ba3PqEFJ_iE9mJkQ",
|
249
|
+
"description": "an example webhook",
|
250
|
+
"enabled": true,
|
251
|
+
"request": {
|
252
|
+
"method": "POST",
|
253
|
+
"url": "https://example.org/example",
|
254
|
+
"headers": {
|
255
|
+
"Accept": "application/json"
|
256
|
+
},
|
257
|
+
"body": {
|
258
|
+
"pactUrl": "${pactbroker.pactUrl}"
|
259
|
+
},
|
260
|
+
"username": "username",
|
261
|
+
"password": "**********"
|
262
|
+
},
|
263
|
+
"events": [
|
264
|
+
{
|
265
|
+
"name": "contract_content_changed"
|
266
|
+
}
|
267
|
+
],
|
268
|
+
"createdAt": "2021-09-01T00:07:21+00:00",
|
269
|
+
"_links": {
|
270
|
+
"self": {
|
271
|
+
"title": "an example webhook",
|
272
|
+
"href": "http://example.org/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ"
|
273
|
+
},
|
274
|
+
"pb:execute": {
|
275
|
+
"title": "Test the execution of the webhook with the latest matching pact or verification by sending a POST request to this URL",
|
276
|
+
"href": "http://example.org/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ/execute"
|
277
|
+
},
|
278
|
+
"pb:webhooks": {
|
279
|
+
"title": "All webhooks",
|
280
|
+
"href": "http://example.org/webhooks"
|
281
|
+
}
|
282
|
+
}
|
283
|
+
}
|
284
|
+
```
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
## Webhooks for consumer
|
289
|
+
|
290
|
+
Path: `/webhooks/consumer/:consumer_name`<br/>
|
291
|
+
Allowed methods: `POST`, `GET`<br/>
|
292
|
+
|
293
|
+
### GET
|
294
|
+
|
295
|
+
#### Request
|
296
|
+
|
297
|
+
Headers: `{"Accept":"application/hal+json"}`<br/>
|
298
|
+
|
299
|
+
|
300
|
+
#### Response
|
301
|
+
|
302
|
+
Status: `200`<br/>
|
303
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
304
|
+
Body:
|
305
|
+
|
306
|
+
```
|
307
|
+
{
|
308
|
+
"_links": {
|
309
|
+
"self": {
|
310
|
+
"title": "Webhooks",
|
311
|
+
"href": "http://example.org/webhooks/consumer/Foo"
|
312
|
+
},
|
313
|
+
"pb:create": {
|
314
|
+
"title": "POST to create a webhook",
|
315
|
+
"href": "http://example.org/webhooks/consumer/Foo"
|
316
|
+
},
|
317
|
+
"pb:webhooks": [
|
318
|
+
|
319
|
+
],
|
320
|
+
"curies": [
|
321
|
+
{
|
322
|
+
"name": "pb",
|
323
|
+
"href": "http://example.org/doc/webhooks-{rel}",
|
324
|
+
"templated": true
|
325
|
+
}
|
326
|
+
]
|
327
|
+
}
|
328
|
+
}
|
329
|
+
```
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
## Webhooks for a provider
|
334
|
+
|
335
|
+
Path: `/webhooks/provider/:provider_name`<br/>
|
336
|
+
Allowed methods: `POST`, `GET`<br/>
|
337
|
+
|
338
|
+
### GET
|
339
|
+
|
340
|
+
#### Request
|
341
|
+
|
342
|
+
Headers: `{"Accept":"application/hal+json"}`<br/>
|
343
|
+
|
344
|
+
|
345
|
+
#### Response
|
346
|
+
|
347
|
+
Status: `200`<br/>
|
348
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
349
|
+
Body:
|
350
|
+
|
351
|
+
```
|
352
|
+
{
|
353
|
+
"_links": {
|
354
|
+
"self": {
|
355
|
+
"title": "Webhooks",
|
356
|
+
"href": "http://example.org/webhooks/provider/Bar"
|
357
|
+
},
|
358
|
+
"pb:create": {
|
359
|
+
"title": "POST to create a webhook",
|
360
|
+
"href": "http://example.org/webhooks/provider/Bar"
|
361
|
+
},
|
362
|
+
"pb:webhooks": [
|
363
|
+
|
364
|
+
],
|
365
|
+
"curies": [
|
366
|
+
{
|
367
|
+
"name": "pb",
|
368
|
+
"href": "http://example.org/doc/webhooks-{rel}",
|
369
|
+
"templated": true
|
370
|
+
}
|
371
|
+
]
|
372
|
+
}
|
373
|
+
}
|
374
|
+
```
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
## Webhooks for consumer and provider
|
379
|
+
|
380
|
+
Path: `/webhooks/provider/:provider_name/consumer/:consumer_name`<br/>
|
381
|
+
Allowed methods: `POST`, `GET`<br/>
|
382
|
+
|
383
|
+
### GET
|
384
|
+
|
385
|
+
#### Request
|
386
|
+
|
387
|
+
Headers: `{"Accept":"application/hal+json"}`<br/>
|
388
|
+
|
389
|
+
|
390
|
+
#### Response
|
391
|
+
|
392
|
+
Status: `200`<br/>
|
393
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
394
|
+
Body:
|
395
|
+
|
396
|
+
```
|
397
|
+
{
|
398
|
+
"_links": {
|
399
|
+
"self": {
|
400
|
+
"title": "Webhooks",
|
401
|
+
"href": "http://example.org/webhooks/provider/Bar/consumer/Foo"
|
402
|
+
},
|
403
|
+
"pb:create": {
|
404
|
+
"title": "POST to create a webhook",
|
405
|
+
"href": "http://example.org/webhooks/provider/Bar/consumer/Foo"
|
406
|
+
},
|
407
|
+
"pb:webhooks": [
|
408
|
+
{
|
409
|
+
"title": "A webhook for the pact between Foo and Bar",
|
410
|
+
"name": "an example webhook",
|
411
|
+
"href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
|
412
|
+
}
|
413
|
+
],
|
414
|
+
"curies": [
|
415
|
+
{
|
416
|
+
"name": "pb",
|
417
|
+
"href": "http://example.org/doc/webhooks-{rel}",
|
418
|
+
"templated": true
|
419
|
+
}
|
420
|
+
]
|
421
|
+
}
|
422
|
+
}
|
423
|
+
```
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
## Pact webhooks
|
428
|
+
|
429
|
+
Path: `/pacts/provider/:provider_name/consumer/:consumer_name/webhooks`<br/>
|
430
|
+
Allowed methods: `POST`, `GET`<br/>
|
431
|
+
|
432
|
+
### GET
|
433
|
+
|
434
|
+
#### Request
|
435
|
+
|
436
|
+
Headers: `{"Accept":"application/hal+json"}`<br/>
|
437
|
+
|
438
|
+
|
439
|
+
#### Response
|
440
|
+
|
441
|
+
Status: `200`<br/>
|
442
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
443
|
+
Body:
|
444
|
+
|
445
|
+
```
|
446
|
+
{
|
447
|
+
"_links": {
|
448
|
+
"self": {
|
449
|
+
"title": "Pact webhooks",
|
450
|
+
"href": "http://example.org/pacts/provider/Bar/consumer/Foo/webhooks"
|
451
|
+
},
|
452
|
+
"pb:create": {
|
453
|
+
"title": "POST to create a webhook",
|
454
|
+
"href": "http://example.org/pacts/provider/Bar/consumer/Foo/webhooks"
|
455
|
+
},
|
456
|
+
"pb:webhooks": [
|
457
|
+
{
|
458
|
+
"title": "A webhook for the pact between Foo and Bar",
|
459
|
+
"name": "an example webhook",
|
460
|
+
"href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
|
461
|
+
}
|
462
|
+
],
|
463
|
+
"curies": [
|
464
|
+
{
|
465
|
+
"name": "pb",
|
466
|
+
"href": "http://example.org/doc/webhooks-{rel}",
|
467
|
+
"templated": true
|
468
|
+
}
|
469
|
+
]
|
470
|
+
}
|
471
|
+
}
|
472
|
+
```
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
## Webhooks status
|
477
|
+
|
478
|
+
Path: `/pacts/provider/:provider_name/consumer/:consumer_name/webhooks/status`<br/>
|
479
|
+
Allowed methods: `GET`<br/>
|
480
|
+
|
481
|
+
### GET
|
482
|
+
|
483
|
+
#### Request
|
484
|
+
|
485
|
+
Headers: `{"Accept":"application/hal+json"}`<br/>
|
486
|
+
|
487
|
+
|
488
|
+
#### Response
|
489
|
+
|
490
|
+
Status: `200`<br/>
|
491
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
492
|
+
Body:
|
493
|
+
|
494
|
+
```
|
495
|
+
{
|
496
|
+
"summary": {
|
497
|
+
"successful": 0,
|
498
|
+
"failed": 0,
|
499
|
+
"notRun": 1
|
500
|
+
},
|
501
|
+
"_embedded": {
|
502
|
+
"triggeredWebhooks": [
|
503
|
+
{
|
504
|
+
"name": "POST example.org",
|
505
|
+
"status": "not_run",
|
506
|
+
"attemptsMade": 1,
|
507
|
+
"attemptsRemaining": 6,
|
508
|
+
"triggerType": "resource_creation",
|
509
|
+
"eventName": "contract_content_changed",
|
510
|
+
"triggeredAt": "2021-09-01T00:07:21+00:00",
|
511
|
+
"_links": {
|
512
|
+
"pb:logs": {
|
513
|
+
"href": "http://example.org/triggered-webhooks/6cd5cc48-db3c-4a4c-a36d-e9bedeb9d91e/logs",
|
514
|
+
"title": "Webhook execution logs",
|
515
|
+
"name": "POST example.org"
|
516
|
+
},
|
517
|
+
"pb:webhook": {
|
518
|
+
"href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
|
519
|
+
"title": "Webhook",
|
520
|
+
"name": "POST example.org"
|
521
|
+
}
|
522
|
+
}
|
523
|
+
}
|
524
|
+
]
|
525
|
+
},
|
526
|
+
"_links": {
|
527
|
+
"self": {
|
528
|
+
"href": "http://example.org/pacts/provider/Bar/consumer/Foo/webhooks/status",
|
529
|
+
"title": "Webhooks status"
|
530
|
+
},
|
531
|
+
"pb:error-logs": [
|
532
|
+
|
533
|
+
],
|
534
|
+
"pb:pact-webhooks": {
|
535
|
+
"title": "Webhooks for the pact between Foo and Bar",
|
536
|
+
"href": "http://example.org/pacts/provider/Bar/consumer/Foo/webhooks"
|
537
|
+
},
|
538
|
+
"pb:pact-version": {
|
539
|
+
"href": "http://example.org/pacts/provider/Bar/consumer/Foo/version/2",
|
540
|
+
"title": "Pact",
|
541
|
+
"name": "Pact between Foo (2) and Bar"
|
542
|
+
},
|
543
|
+
"pb:consumer": {
|
544
|
+
"href": "http://example.org/pacticipants/Foo",
|
545
|
+
"title": "Consumer",
|
546
|
+
"name": "Foo"
|
547
|
+
},
|
548
|
+
"pb:provider": {
|
549
|
+
"href": "http://example.org/pacticipants/Bar",
|
550
|
+
"title": "Provider",
|
551
|
+
"name": "Bar"
|
552
|
+
}
|
553
|
+
}
|
554
|
+
}
|
555
|
+
```
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
## Executing a saved webhook
|
560
|
+
|
561
|
+
Path: `/webhooks/:uuid/execute`<br/>
|
562
|
+
Allowed methods: `POST`<br/>
|
563
|
+
|
564
|
+
### POST
|
565
|
+
|
566
|
+
#### Request
|
567
|
+
|
568
|
+
Headers: `{"Content-Type":"application/json","Accept":"application/hal+json"}`<br/>
|
569
|
+
|
570
|
+
|
571
|
+
#### Response
|
572
|
+
|
573
|
+
Status: `200`<br/>
|
574
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
575
|
+
Body:
|
576
|
+
|
577
|
+
```
|
578
|
+
{
|
579
|
+
"request": {
|
580
|
+
"headers": {
|
581
|
+
"accept": "*/*",
|
582
|
+
"user-agent": "Pact Broker v2.87.0",
|
583
|
+
"content-type": "application/json"
|
584
|
+
},
|
585
|
+
"body": {
|
586
|
+
"pactUrl": "http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/Y3ZuPTImdz10cnVl"
|
587
|
+
},
|
588
|
+
"url": "/example"
|
589
|
+
},
|
590
|
+
"response": {
|
591
|
+
"status": 200,
|
592
|
+
"headers": {
|
593
|
+
},
|
594
|
+
"body": ""
|
595
|
+
},
|
596
|
+
"logs": "[2021-09-01T10:07:21Z] DEBUG: Webhook context {\"base_url\":\"http://example.org\",\"event_name\":\"test\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.1 POST https://example.org/example\n[2021-09-01T10:07:21Z] INFO: accept: */*\n[2021-09-01T10:07:21Z] INFO: user-agent: Pact Broker v2.87.0\n[2021-09-01T10:07:21Z] INFO: content-type: application/json\n[2021-09-01T10:07:21Z] INFO: {\"pactUrl\":\"http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/Y3ZuPTImdz10cnVl\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.0 200 \n[2021-09-01T10:07:21Z] INFO: \n",
|
597
|
+
"success": true,
|
598
|
+
"_links": {
|
599
|
+
}
|
600
|
+
}
|
601
|
+
```
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
## Executing an unsaved webhook
|
606
|
+
|
607
|
+
Path: `/webhooks/execute`<br/>
|
608
|
+
Allowed methods: `POST`<br/>
|
609
|
+
|
610
|
+
### POST
|
611
|
+
|
612
|
+
#### Request
|
613
|
+
|
614
|
+
Headers: `{"Content-Type":"application/json","Accept":"application/hal+json"}`<br/>
|
615
|
+
Body:
|
616
|
+
|
617
|
+
```
|
618
|
+
{
|
619
|
+
"description": "an example webhook",
|
620
|
+
"events": [
|
621
|
+
{
|
622
|
+
"name": "contract_content_changed"
|
623
|
+
}
|
624
|
+
],
|
625
|
+
"request": {
|
626
|
+
"method": "POST",
|
627
|
+
"url": "https://example.org/example",
|
628
|
+
"username": "username",
|
629
|
+
"password": "password",
|
630
|
+
"headers": {
|
631
|
+
"Accept": "application/json"
|
632
|
+
},
|
633
|
+
"body": {
|
634
|
+
"pactUrl": "${pactbroker.pactUrl}"
|
635
|
+
}
|
636
|
+
}
|
637
|
+
}
|
638
|
+
```
|
639
|
+
|
640
|
+
|
641
|
+
#### Response
|
642
|
+
|
643
|
+
Status: `200`<br/>
|
644
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
645
|
+
Body:
|
646
|
+
|
647
|
+
```
|
648
|
+
{
|
649
|
+
"request": {
|
650
|
+
"headers": {
|
651
|
+
"accept": "application/json",
|
652
|
+
"user-agent": "Pact Broker v2.87.0",
|
653
|
+
"authorization": "**********"
|
654
|
+
},
|
655
|
+
"body": {
|
656
|
+
"pactUrl": "http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/Y3ZuPTImdz10cnVl"
|
657
|
+
},
|
658
|
+
"url": "/example"
|
659
|
+
},
|
660
|
+
"response": {
|
661
|
+
"status": 200,
|
662
|
+
"headers": {
|
663
|
+
},
|
664
|
+
"body": ""
|
665
|
+
},
|
666
|
+
"logs": "[2021-09-01T10:07:21Z] DEBUG: Webhook context {\"base_url\":\"http://example.org\",\"event_name\":\"test\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.1 POST https://example.org/example\n[2021-09-01T10:07:21Z] INFO: accept: application/json\n[2021-09-01T10:07:21Z] INFO: user-agent: Pact Broker v2.87.0\n[2021-09-01T10:07:21Z] INFO: authorization: **********\n[2021-09-01T10:07:21Z] INFO: {\"pactUrl\":\"http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/Y3ZuPTImdz10cnVl\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.0 200 \n[2021-09-01T10:07:21Z] INFO: \n",
|
667
|
+
"success": true,
|
668
|
+
"_links": {
|
669
|
+
}
|
670
|
+
}
|
671
|
+
```
|
672
|
+
|
673
|
+
|
674
|
+
|
675
|
+
## Triggered webhooks for pact publication
|
676
|
+
|
677
|
+
Path: `/pacts/provider/:provider_name/consumer/:consumer_name/version/:consumer_version_number/triggered-webhooks`<br/>
|
678
|
+
Allowed methods: `GET`<br/>
|
679
|
+
|
680
|
+
### GET
|
681
|
+
|
682
|
+
#### Request
|
683
|
+
|
684
|
+
Headers: `{"Accept":"application/hal+json"}`<br/>
|
685
|
+
|
686
|
+
|
687
|
+
#### Response
|
688
|
+
|
689
|
+
Status: `200`<br/>
|
690
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
691
|
+
Body:
|
692
|
+
|
693
|
+
```
|
694
|
+
{
|
695
|
+
"_embedded": {
|
696
|
+
"triggeredWebhooks": [
|
697
|
+
{
|
698
|
+
"name": "POST example.org",
|
699
|
+
"status": "not_run",
|
700
|
+
"attemptsMade": 1,
|
701
|
+
"attemptsRemaining": 6,
|
702
|
+
"triggerType": "resource_creation",
|
703
|
+
"eventName": "contract_content_changed",
|
704
|
+
"triggeredAt": "2021-09-01T00:07:21+00:00",
|
705
|
+
"_links": {
|
706
|
+
"pb:logs": {
|
707
|
+
"href": "http://example.org/triggered-webhooks/6cd5cc48-db3c-4a4c-a36d-e9bedeb9d91e/logs",
|
708
|
+
"title": "Webhook execution logs",
|
709
|
+
"name": "POST example.org"
|
710
|
+
},
|
711
|
+
"pb:webhook": {
|
712
|
+
"href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
|
713
|
+
"title": "Webhook",
|
714
|
+
"name": "POST example.org"
|
715
|
+
}
|
716
|
+
}
|
717
|
+
}
|
718
|
+
]
|
719
|
+
},
|
720
|
+
"_links": {
|
721
|
+
"self": {
|
722
|
+
"title": "Webhooks triggered by the publication of the pact between Foo (2) and Bar",
|
723
|
+
"href": "http://example.org/pacts/provider/Bar/consumer/Foo/version/2/triggered-webhooks"
|
724
|
+
}
|
725
|
+
}
|
726
|
+
}
|
727
|
+
```
|
728
|
+
|
729
|
+
|
730
|
+
|
731
|
+
## Triggered webhooks for verification publication
|
732
|
+
|
733
|
+
Path: `/pacts/provider/:provider_name/consumer/:consumer_name/pact-version/:pact_version_sha/verification-results/:verification_number/triggered-webhooks`<br/>
|
734
|
+
Allowed methods: `GET`<br/>
|
735
|
+
|
736
|
+
### GET
|
737
|
+
|
738
|
+
#### Request
|
739
|
+
|
740
|
+
Headers: `{"Accept":"application/hal+json"}`<br/>
|
741
|
+
|
742
|
+
|
743
|
+
#### Response
|
744
|
+
|
745
|
+
Status: `200`<br/>
|
746
|
+
Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
|
747
|
+
Body:
|
748
|
+
|
749
|
+
```
|
750
|
+
{
|
751
|
+
"_embedded": {
|
752
|
+
"triggeredWebhooks": [
|
753
|
+
|
754
|
+
]
|
755
|
+
},
|
756
|
+
"_links": {
|
757
|
+
"self": {
|
758
|
+
"title": "Webhooks triggered by the publication of verification result 1",
|
759
|
+
"href": "http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/verification-results/1/triggered-webhooks"
|
760
|
+
}
|
761
|
+
}
|
762
|
+
}
|
763
|
+
```
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
## Logs of triggered webhook
|
768
|
+
|
769
|
+
Path: `/triggered-webhooks/:uuid/logs`<br/>
|
770
|
+
Allowed methods: `GET`<br/>
|
771
|
+
|
772
|
+
### GET
|
773
|
+
|
774
|
+
#### Request
|
775
|
+
|
776
|
+
Headers: `{"Accept":"application/hal+json"}`<br/>
|
777
|
+
|
778
|
+
|
779
|
+
#### Response
|
780
|
+
|
781
|
+
Status: `200`<br/>
|
782
|
+
Headers: `{"Content-Type":"text/plain;charset=utf-8"}`<br/>
|
783
|
+
Body:
|
784
|
+
|
785
|
+
```
|
786
|
+
logs
|
787
|
+
```
|
788
|
+
|
789
|
+
|