pact_broker 2.100.0 → 2.101.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/Gemfile +1 -0
  4. data/docs/api/PACTICIPANTS.md +290 -0
  5. data/docs/api/WEBHOOKS.md +40 -40
  6. data/lib/db.rb +1 -1
  7. data/lib/pact_broker/api/decorators/triggered_webhook_decorator.rb +1 -2
  8. data/lib/pact_broker/api/resources/all_webhooks.rb +1 -4
  9. data/lib/pact_broker/api/resources/base_resource.rb +51 -5
  10. data/lib/pact_broker/api/resources/branch_version.rb +10 -1
  11. data/lib/pact_broker/api/resources/clean.rb +11 -9
  12. data/lib/pact_broker/api/resources/currently_deployed_versions_for_environment.rb +0 -4
  13. data/lib/pact_broker/api/resources/currently_supported_versions_for_environment.rb +0 -4
  14. data/lib/pact_broker/api/resources/deployed_version.rb +12 -14
  15. data/lib/pact_broker/api/resources/deployed_versions_for_version_and_environment.rb +4 -0
  16. data/lib/pact_broker/api/resources/environment.rb +5 -5
  17. data/lib/pact_broker/api/resources/environments.rb +1 -5
  18. data/lib/pact_broker/api/resources/label.rb +4 -0
  19. data/lib/pact_broker/api/resources/pact.rb +10 -5
  20. data/lib/pact_broker/api/resources/pact_webhooks.rb +1 -4
  21. data/lib/pact_broker/api/resources/pacticipant.rb +11 -5
  22. data/lib/pact_broker/api/resources/pacticipant_webhooks.rb +1 -4
  23. data/lib/pact_broker/api/resources/pacticipants.rb +1 -4
  24. data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +19 -11
  25. data/lib/pact_broker/api/resources/publish_contracts.rb +11 -15
  26. data/lib/pact_broker/api/resources/released_version.rb +12 -6
  27. data/lib/pact_broker/api/resources/released_versions_for_version_and_environment.rb +10 -6
  28. data/lib/pact_broker/api/resources/tag.rb +7 -3
  29. data/lib/pact_broker/api/resources/verifications.rb +7 -9
  30. data/lib/pact_broker/api/resources/version.rb +8 -8
  31. data/lib/pact_broker/api/resources/webhook.rb +5 -4
  32. data/lib/pact_broker/api/resources/webhook_execution.rb +4 -6
  33. data/lib/pact_broker/doc/views/index/pacticipant-branch-version.markdown +13 -2
  34. data/lib/pact_broker/doc/views/provider-pacts-for-verification.markdown +1 -1
  35. data/lib/pact_broker/domain/pacticipant.rb +1 -0
  36. data/lib/pact_broker/locale/en.yml +1 -0
  37. data/lib/pact_broker/pacticipants/repository.rb +5 -4
  38. data/lib/pact_broker/pacts/generate_sha.rb +1 -0
  39. data/lib/pact_broker/pacts/verifiable_pact_messages.rb +1 -1
  40. data/lib/pact_broker/test/test_data_builder.rb +20 -0
  41. data/lib/pact_broker/version.rb +1 -1
  42. data/lib/pact_broker/versions/branch_service.rb +7 -0
  43. data/lib/pact_broker/versions/branch_version_repository.rb +17 -0
  44. data/lib/rack/pact_broker/cascade.rb +87 -0
  45. data/lib/webmachine/describe_routes.rb +43 -9
  46. metadata +5 -4
  47. data/lib/pact_broker/api/resources/default_base_resource.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f22862d2054c07b06fb947f8a1f710dab261ae6ac1207e6a15adebb07dc488db
4
- data.tar.gz: 5cc63160ad026673f194af54237080aeb6eb8ab4f9ac93cbe5cd71b63727d60e
3
+ metadata.gz: '08222ce855214163448e53d62e9beea5b6b04c5fc6f9e56308ac27984c21599a'
4
+ data.tar.gz: 2e5f39087b8ff5a7b906d179554ba701043619910923465b10611fe198736a53
5
5
  SHA512:
6
- metadata.gz: 8b6c0cefc1e4847ed53627f0b2aae7cfd5be46e351ce1969f21b80f5f8899990cca3f612d9ab14a82d58c0521b91fb5f5a820f4c7d9e72f17fbc391f1583daff
7
- data.tar.gz: 4c1c3fa1a8e983718f1f841c8b17088678c6f4ada22c36b3ededb71a46c2bf004712c4716a8af33c17e068c88b88a6b69f219a286549841c20fa8c79ae41a214
6
+ metadata.gz: 4bb5843f3f1fc44f56bfeea79d2315ecb61c278ebdbb089e8cd5405784f39ba4475c0a04bdeaddd179a5bf863fa46139f76692ebaff3c8185abc8c21075544e6
7
+ data.tar.gz: 6982da454c1f364143d0d3abd11777c25a8114dbd3dd6ab6c5987dadb2239e804dee6ec124ada34f7d8a1aabe62dabf29047bb12f0a48f306fb29ee7a54ca111
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ <a name="v2.101.0"></a>
2
+ ### v2.101.0 (2022-06-07)
3
+
4
+ #### Features
5
+
6
+ * recalculate the branch head if the deleted branch version was the latest for the branch ([db51d4fe](/../../commit/db51d4fe))
7
+ * support deleting branch versions (removing a version from a branch) ([661667b3](/../../commit/661667b3))
8
+ * improve error message when request has non UTF-8 characters (#559) ([3addc0c8](/../../commit/3addc0c8))
9
+
10
+ #### Bug Fixes
11
+
12
+ * add missing environment policy record for use when recording deployments ([09bb02a6](/../../commit/09bb02a6))
13
+ * fix bug where pacticipant with blank name was being created instead of updating existing record ([be24a8ad](/../../commit/be24a8ad))
14
+ * ensure pacticipant name is retained when updating with PUT ([eeac47c3](/../../commit/eeac47c3))
15
+
1
16
  <a name="v2.100.0"></a>
2
17
  ### v2.100.0 (2022-05-20)
3
18
 
data/Gemfile CHANGED
@@ -30,6 +30,7 @@ group :test do
30
30
  gem "faraday_middleware", "~> 0.14"
31
31
  gem "docker-api", "~>1.34"
32
32
  gem "approvals", ">=0.0.24", "<1.0.0"
33
+ gem "tzinfo", "~>2.0"
33
34
  end
34
35
 
35
36
  if ENV["INSTALL_MYSQL"] == "true"
@@ -0,0 +1,290 @@
1
+
2
+ # Pacticipants
3
+
4
+
5
+ ## Pacticipant
6
+
7
+ Path: `/pacticipants/:pacticipant_name`<br/>
8
+ Allowed methods: `GET`, `PUT`, `PATCH`, `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
+ "name": "foo",
26
+ "displayName": "Foo",
27
+ "repositoryUrl": "https://github.com/example-organization/foo",
28
+ "createdAt": "2021-09-01T00:07:21+00:00",
29
+ "_embedded": {
30
+ "latestVersion": {
31
+ "number": "3e1f00a04",
32
+ "_links": {
33
+ "self": {
34
+ "title": "Version",
35
+ "name": "3e1f00a04",
36
+ "href": "https://pact-broker/pacticipants/foo/versions/3e1f00a04"
37
+ }
38
+ }
39
+ },
40
+ "labels": [
41
+
42
+ ]
43
+ },
44
+ "_links": {
45
+ "self": {
46
+ "href": "https://pact-broker/pacticipants/foo"
47
+ },
48
+ "pb:versions": {
49
+ "href": "https://pact-broker/pacticipants/foo/versions"
50
+ },
51
+ "pb:version": {
52
+ "title": "Get, create or delete a pacticipant version",
53
+ "href": "https://pact-broker/pacticipants/foo/versions/{version}",
54
+ "templated": true
55
+ },
56
+ "pb:version-tag": {
57
+ "title": "Get, create or delete a tag for a version of foo",
58
+ "href": "https://pact-broker/pacticipants/foo/versions/{version}/tags/{tag}",
59
+ "templated": true
60
+ },
61
+ "pb:branch-version": {
62
+ "title": "Get or add/create a version for a branch of foo",
63
+ "href": "https://pact-broker/pacticipants/foo/branches/{branch}/versions/{version}",
64
+ "templated": true
65
+ },
66
+ "pb:label": {
67
+ "title": "Get, create or delete a label for foo",
68
+ "href": "https://pact-broker/pacticipants/foo/labels/{label}",
69
+ "templated": true
70
+ },
71
+ "pb:can-i-deploy-badge": {
72
+ "title": "Can I Deploy foo badge",
73
+ "href": "https://pact-broker/pacticipants/foo/latest-version/{tag}/can-i-deploy/to/{environmentTag}/badge",
74
+ "templated": true
75
+ },
76
+ "pb:can-i-deploy-branch-to-environment-badge": {
77
+ "title": "Can I Deploy foo from branch to environment badge",
78
+ "href": "https://pact-broker/pacticipants/foo/branches/{branch}/latest-version/can-i-deploy/to-environment/{environment}/badge",
79
+ "templated": true
80
+ },
81
+ "curies": [
82
+ {
83
+ "name": "pb",
84
+ "href": "https://pact-broker/doc/{rel}?context=pacticipant",
85
+ "templated": true
86
+ }
87
+ ]
88
+ }
89
+ }
90
+ ```
91
+
92
+
93
+ ### PUT
94
+
95
+ PUT replaces the entire resource with the specified body, so missing properties will effectively be nulled. Embedded properties (eg. versions) will not be affected.
96
+
97
+ #### Request
98
+
99
+ Headers: `{"Content-Type":"application/json","Accept":"application/hal+json"}`<br/>
100
+ Body:
101
+
102
+ ```
103
+ {
104
+ "displayName": "Foo",
105
+ "repositoryUrl": "https://github.com/example/foo",
106
+ "repositoryName": "foo",
107
+ "repositoryNamespace": "example",
108
+ "mainBranch": "main"
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
+ "name": "foo",
122
+ "displayName": "Foo",
123
+ "repositoryUrl": "https://github.com/example/foo",
124
+ "repositoryName": "foo",
125
+ "repositoryNamespace": "example",
126
+ "mainBranch": "main",
127
+ "createdAt": "2021-09-01T00:07:21+00:00",
128
+ "_embedded": {
129
+ "latestVersion": {
130
+ "number": "3e1f00a04",
131
+ "_links": {
132
+ "self": {
133
+ "title": "Version",
134
+ "name": "3e1f00a04",
135
+ "href": "https://pact-broker/pacticipants/foo/versions/3e1f00a04"
136
+ }
137
+ }
138
+ },
139
+ "labels": [
140
+
141
+ ]
142
+ },
143
+ "_links": {
144
+ "self": {
145
+ "href": "https://pact-broker/pacticipants/foo"
146
+ },
147
+ "pb:versions": {
148
+ "href": "https://pact-broker/pacticipants/foo/versions"
149
+ },
150
+ "pb:version": {
151
+ "title": "Get, create or delete a pacticipant version",
152
+ "href": "https://pact-broker/pacticipants/foo/versions/{version}",
153
+ "templated": true
154
+ },
155
+ "pb:version-tag": {
156
+ "title": "Get, create or delete a tag for a version of foo",
157
+ "href": "https://pact-broker/pacticipants/foo/versions/{version}/tags/{tag}",
158
+ "templated": true
159
+ },
160
+ "pb:branch-version": {
161
+ "title": "Get or add/create a version for a branch of foo",
162
+ "href": "https://pact-broker/pacticipants/foo/branches/{branch}/versions/{version}",
163
+ "templated": true
164
+ },
165
+ "pb:label": {
166
+ "title": "Get, create or delete a label for foo",
167
+ "href": "https://pact-broker/pacticipants/foo/labels/{label}",
168
+ "templated": true
169
+ },
170
+ "pb:can-i-deploy-badge": {
171
+ "title": "Can I Deploy foo badge",
172
+ "href": "https://pact-broker/pacticipants/foo/latest-version/{tag}/can-i-deploy/to/{environmentTag}/badge",
173
+ "templated": true
174
+ },
175
+ "pb:can-i-deploy-branch-to-environment-badge": {
176
+ "title": "Can I Deploy foo from branch to environment badge",
177
+ "href": "https://pact-broker/pacticipants/foo/branches/{branch}/latest-version/can-i-deploy/to-environment/{environment}/badge",
178
+ "templated": true
179
+ },
180
+ "curies": [
181
+ {
182
+ "name": "pb",
183
+ "href": "https://pact-broker/doc/{rel}?context=pacticipant",
184
+ "templated": true
185
+ }
186
+ ]
187
+ }
188
+ }
189
+ ```
190
+
191
+
192
+ ### PATCH
193
+
194
+ PATCH with the Content-Type application/merge-patch+json merges the pacticipant's existing properties with those from the request body. Embedded properties (eg. versions) will not be affected.
195
+
196
+ #### Request
197
+
198
+ Headers: `{"Content-Type":"application/merge-patch+json","Accept":"application/hal+json"}`<br/>
199
+ Body:
200
+
201
+ ```
202
+ {
203
+ "displayName": "Foo",
204
+ "repositoryUrl": "https://github.com/example/foo",
205
+ "repositoryName": "foo",
206
+ "repositoryNamespace": "example",
207
+ "mainBranch": "main"
208
+ }
209
+ ```
210
+
211
+
212
+ #### Response
213
+
214
+ Status: `200`<br/>
215
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8"}`<br/>
216
+ Body:
217
+
218
+ ```
219
+ {
220
+ "name": "foo",
221
+ "displayName": "Foo",
222
+ "repositoryUrl": "https://github.com/example/foo",
223
+ "repositoryName": "foo",
224
+ "repositoryNamespace": "example",
225
+ "mainBranch": "main",
226
+ "createdAt": "2021-09-01T00:07:21+00:00",
227
+ "_embedded": {
228
+ "latestVersion": {
229
+ "number": "3e1f00a04",
230
+ "_links": {
231
+ "self": {
232
+ "title": "Version",
233
+ "name": "3e1f00a04",
234
+ "href": "https://pact-broker/pacticipants/foo/versions/3e1f00a04"
235
+ }
236
+ }
237
+ },
238
+ "labels": [
239
+
240
+ ]
241
+ },
242
+ "_links": {
243
+ "self": {
244
+ "href": "https://pact-broker/pacticipants/foo"
245
+ },
246
+ "pb:versions": {
247
+ "href": "https://pact-broker/pacticipants/foo/versions"
248
+ },
249
+ "pb:version": {
250
+ "title": "Get, create or delete a pacticipant version",
251
+ "href": "https://pact-broker/pacticipants/foo/versions/{version}",
252
+ "templated": true
253
+ },
254
+ "pb:version-tag": {
255
+ "title": "Get, create or delete a tag for a version of foo",
256
+ "href": "https://pact-broker/pacticipants/foo/versions/{version}/tags/{tag}",
257
+ "templated": true
258
+ },
259
+ "pb:branch-version": {
260
+ "title": "Get or add/create a version for a branch of foo",
261
+ "href": "https://pact-broker/pacticipants/foo/branches/{branch}/versions/{version}",
262
+ "templated": true
263
+ },
264
+ "pb:label": {
265
+ "title": "Get, create or delete a label for foo",
266
+ "href": "https://pact-broker/pacticipants/foo/labels/{label}",
267
+ "templated": true
268
+ },
269
+ "pb:can-i-deploy-badge": {
270
+ "title": "Can I Deploy foo badge",
271
+ "href": "https://pact-broker/pacticipants/foo/latest-version/{tag}/can-i-deploy/to/{environmentTag}/badge",
272
+ "templated": true
273
+ },
274
+ "pb:can-i-deploy-branch-to-environment-badge": {
275
+ "title": "Can I Deploy foo from branch to environment badge",
276
+ "href": "https://pact-broker/pacticipants/foo/branches/{branch}/latest-version/can-i-deploy/to-environment/{environment}/badge",
277
+ "templated": true
278
+ },
279
+ "curies": [
280
+ {
281
+ "name": "pb",
282
+ "href": "https://pact-broker/doc/{rel}?context=pacticipant",
283
+ "templated": true
284
+ }
285
+ ]
286
+ }
287
+ }
288
+ ```
289
+
290
+
data/docs/api/WEBHOOKS.md CHANGED
@@ -33,7 +33,7 @@ Body:
33
33
  "enabled": true,
34
34
  "request": {
35
35
  "method": "POST",
36
- "url": "https://example.org/example",
36
+ "url": "https://example.org/webhook",
37
37
  "headers": {
38
38
  "Content-Type": "application/json"
39
39
  },
@@ -50,29 +50,29 @@ Body:
50
50
  "_links": {
51
51
  "self": {
52
52
  "title": "an example webhook",
53
- "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
53
+ "href": "https://pact-broker/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
54
54
  },
55
55
  "pb:execute": {
56
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"
57
+ "href": "https://pact-broker/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac/execute"
58
58
  },
59
59
  "pb:consumer": {
60
60
  "title": "Consumer",
61
61
  "name": "Foo",
62
- "href": "http://example.org/pacticipants/Foo"
62
+ "href": "https://pact-broker/pacticipants/Foo"
63
63
  },
64
64
  "pb:provider": {
65
65
  "title": "Provider",
66
66
  "name": "Bar",
67
- "href": "http://example.org/pacticipants/Bar"
67
+ "href": "https://pact-broker/pacticipants/Bar"
68
68
  },
69
69
  "pb:pact-webhooks": {
70
70
  "title": "All webhooks for consumer Foo and provider Bar",
71
- "href": "http://example.org/webhooks/provider/Bar/consumer/Foo"
71
+ "href": "https://pact-broker/webhooks/provider/Bar/consumer/Foo"
72
72
  },
73
73
  "pb:webhooks": {
74
74
  "title": "All webhooks",
75
- "href": "http://example.org/webhooks"
75
+ "href": "https://pact-broker/webhooks"
76
76
  }
77
77
  }
78
78
  }
@@ -142,15 +142,15 @@ Body:
142
142
  "_links": {
143
143
  "self": {
144
144
  "title": "an example webhook",
145
- "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
145
+ "href": "https://pact-broker/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
146
146
  },
147
147
  "pb:execute": {
148
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"
149
+ "href": "https://pact-broker/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac/execute"
150
150
  },
151
151
  "pb:webhooks": {
152
152
  "title": "All webhooks",
153
- "href": "http://example.org/webhooks"
153
+ "href": "https://pact-broker/webhooks"
154
154
  }
155
155
  }
156
156
  }
@@ -191,13 +191,13 @@ Body:
191
191
  {
192
192
  "title": "A webhook for the pact between Foo and Bar",
193
193
  "name": "an example webhook",
194
- "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
194
+ "href": "https://pact-broker/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
195
195
  }
196
196
  ],
197
197
  "curies": [
198
198
  {
199
199
  "name": "pb",
200
- "href": "http://example.org/doc/webhooks-{rel}",
200
+ "href": "https://pact-broker/doc/webhooks-{rel}",
201
201
  "templated": true
202
202
  }
203
203
  ]
@@ -240,7 +240,7 @@ Body:
240
240
  #### Response
241
241
 
242
242
  Status: `201`<br/>
243
- Headers: `{"Content-Type":"application/hal+json;charset=utf-8","Location":"http://example.org/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ"}`<br/>
243
+ Headers: `{"Content-Type":"application/hal+json;charset=utf-8","Location":"https://pact-broker/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ"}`<br/>
244
244
  Body:
245
245
 
246
246
  ```
@@ -269,15 +269,15 @@ Body:
269
269
  "_links": {
270
270
  "self": {
271
271
  "title": "an example webhook",
272
- "href": "http://example.org/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ"
272
+ "href": "https://pact-broker/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ"
273
273
  },
274
274
  "pb:execute": {
275
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"
276
+ "href": "https://pact-broker/webhooks/dCGCl-Ba3PqEFJ_iE9mJkQ/execute"
277
277
  },
278
278
  "pb:webhooks": {
279
279
  "title": "All webhooks",
280
- "href": "http://example.org/webhooks"
280
+ "href": "https://pact-broker/webhooks"
281
281
  }
282
282
  }
283
283
  }
@@ -320,7 +320,7 @@ Body:
320
320
  "curies": [
321
321
  {
322
322
  "name": "pb",
323
- "href": "http://example.org/doc/webhooks-{rel}",
323
+ "href": "https://pact-broker/doc/webhooks-{rel}",
324
324
  "templated": true
325
325
  }
326
326
  ]
@@ -365,7 +365,7 @@ Body:
365
365
  "curies": [
366
366
  {
367
367
  "name": "pb",
368
- "href": "http://example.org/doc/webhooks-{rel}",
368
+ "href": "https://pact-broker/doc/webhooks-{rel}",
369
369
  "templated": true
370
370
  }
371
371
  ]
@@ -408,13 +408,13 @@ Body:
408
408
  {
409
409
  "title": "A webhook for the pact between Foo and Bar",
410
410
  "name": "an example webhook",
411
- "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
411
+ "href": "https://pact-broker/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
412
412
  }
413
413
  ],
414
414
  "curies": [
415
415
  {
416
416
  "name": "pb",
417
- "href": "http://example.org/doc/webhooks-{rel}",
417
+ "href": "https://pact-broker/doc/webhooks-{rel}",
418
418
  "templated": true
419
419
  }
420
420
  ]
@@ -457,13 +457,13 @@ Body:
457
457
  {
458
458
  "title": "A webhook for the pact between Foo and Bar",
459
459
  "name": "an example webhook",
460
- "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
460
+ "href": "https://pact-broker/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac"
461
461
  }
462
462
  ],
463
463
  "curies": [
464
464
  {
465
465
  "name": "pb",
466
- "href": "http://example.org/doc/webhooks-{rel}",
466
+ "href": "https://pact-broker/doc/webhooks-{rel}",
467
467
  "templated": true
468
468
  }
469
469
  ]
@@ -510,12 +510,12 @@ Body:
510
510
  "triggeredAt": "2021-09-01T00:07:21+00:00",
511
511
  "_links": {
512
512
  "pb:logs": {
513
- "href": "http://example.org/triggered-webhooks/6cd5cc48-db3c-4a4c-a36d-e9bedeb9d91e/logs",
513
+ "href": "https://pact-broker/triggered-webhooks/6cd5cc48-db3c-4a4c-a36d-e9bedeb9d91e/logs",
514
514
  "title": "Webhook execution logs",
515
515
  "name": "POST example.org"
516
516
  },
517
517
  "pb:webhook": {
518
- "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
518
+ "href": "https://pact-broker/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
519
519
  "title": "Webhook",
520
520
  "name": "POST example.org"
521
521
  }
@@ -533,20 +533,20 @@ Body:
533
533
  ],
534
534
  "pb:pact-webhooks": {
535
535
  "title": "Webhooks for the pact between Foo and Bar",
536
- "href": "http://example.org/pacts/provider/Bar/consumer/Foo/webhooks"
536
+ "href": "https://pact-broker/pacts/provider/Bar/consumer/Foo/webhooks"
537
537
  },
538
538
  "pb:pact-version": {
539
- "href": "http://example.org/pacts/provider/Bar/consumer/Foo/version/2",
539
+ "href": "https://pact-broker/pacts/provider/Bar/consumer/Foo/version/3e1f00a04",
540
540
  "title": "Pact",
541
- "name": "Pact between Foo (2) and Bar"
541
+ "name": "Pact between Foo (3e1f00a04) and Bar"
542
542
  },
543
543
  "pb:consumer": {
544
- "href": "http://example.org/pacticipants/Foo",
544
+ "href": "https://pact-broker/pacticipants/Foo",
545
545
  "title": "Consumer",
546
546
  "name": "Foo"
547
547
  },
548
548
  "pb:provider": {
549
- "href": "http://example.org/pacticipants/Bar",
549
+ "href": "https://pact-broker/pacticipants/Bar",
550
550
  "title": "Provider",
551
551
  "name": "Bar"
552
552
  }
@@ -579,13 +579,13 @@ Body:
579
579
  "request": {
580
580
  "headers": {
581
581
  "accept": "*/*",
582
- "user-agent": "Pact Broker v2.87.0",
582
+ "user-agent": "Pact Broker",
583
583
  "content-type": "application/json"
584
584
  },
585
585
  "body": {
586
- "pactUrl": "http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/Y3ZuPTImdz10cnVl"
586
+ "pactUrl": "https://pact-broker/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/3e193ecb37ad04b43ce974a38352c704b2e0ed6b"
587
587
  },
588
- "url": "/example"
588
+ "url": "/webhook"
589
589
  },
590
590
  "response": {
591
591
  "status": 200,
@@ -593,7 +593,7 @@ Body:
593
593
  },
594
594
  "body": ""
595
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",
596
+ "logs": "[2021-09-01T10:07:21Z] DEBUG: Webhook context {\"base_url\":\"https://pact-broker\",\"event_name\":\"test\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.1 POST https://example.org/webhook\n[2021-09-01T10:07:21Z] INFO: accept: */*\n[2021-09-01T10:07:21Z] INFO: user-agent: Pact Broker\n[2021-09-01T10:07:21Z] INFO: content-type: application/json\n[2021-09-01T10:07:21Z] INFO: {\"pactUrl\":\"https://pact-broker/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/3e193ecb37ad04b43ce974a38352c704b2e0ed6b\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.0 200 \n[2021-09-01T10:07:21Z] INFO: \n",
597
597
  "success": true,
598
598
  "_links": {
599
599
  }
@@ -649,11 +649,11 @@ Body:
649
649
  "request": {
650
650
  "headers": {
651
651
  "accept": "application/json",
652
- "user-agent": "Pact Broker v2.87.0",
652
+ "user-agent": "Pact Broker",
653
653
  "authorization": "**********"
654
654
  },
655
655
  "body": {
656
- "pactUrl": "http://example.org/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/Y3ZuPTImdz10cnVl"
656
+ "pactUrl": "https://pact-broker/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/3e193ecb37ad04b43ce974a38352c704b2e0ed6b"
657
657
  },
658
658
  "url": "/example"
659
659
  },
@@ -663,7 +663,7 @@ Body:
663
663
  },
664
664
  "body": ""
665
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",
666
+ "logs": "[2021-09-01T10:07:21Z] DEBUG: Webhook context {\"base_url\":\"https://pact-broker\",\"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\n[2021-09-01T10:07:21Z] INFO: authorization: **********\n[2021-09-01T10:07:21Z] INFO: {\"pactUrl\":\"https://pact-broker/pacts/provider/Bar/consumer/Foo/pact-version/3e193ecb37ad04b43ce974a38352c704b2e0ed6b/metadata/3e193ecb37ad04b43ce974a38352c704b2e0ed6b\"}\n[2021-09-01T10:07:21Z] INFO: HTTP/1.0 200 \n[2021-09-01T10:07:21Z] INFO: \n",
667
667
  "success": true,
668
668
  "_links": {
669
669
  }
@@ -704,12 +704,12 @@ Body:
704
704
  "triggeredAt": "2021-09-01T00:07:21+00:00",
705
705
  "_links": {
706
706
  "pb:logs": {
707
- "href": "http://example.org/triggered-webhooks/6cd5cc48-db3c-4a4c-a36d-e9bedeb9d91e/logs",
707
+ "href": "https://pact-broker/triggered-webhooks/6cd5cc48-db3c-4a4c-a36d-e9bedeb9d91e/logs",
708
708
  "title": "Webhook execution logs",
709
709
  "name": "POST example.org"
710
710
  },
711
711
  "pb:webhook": {
712
- "href": "http://example.org/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
712
+ "href": "https://pact-broker/webhooks/d2181b32-8b03-4daf-8cc0-d9168b2f6fac",
713
713
  "title": "Webhook",
714
714
  "name": "POST example.org"
715
715
  }
@@ -719,8 +719,8 @@ Body:
719
719
  },
720
720
  "_links": {
721
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"
722
+ "title": "Webhooks triggered by the publication of the pact between Foo (3e1f00a04) and Bar",
723
+ "href": "http://example.org/pacts/provider/Bar/consumer/Foo/version/3e1f00a04/triggered-webhooks"
724
724
  }
725
725
  }
726
726
  }
data/lib/db.rb CHANGED
@@ -28,7 +28,7 @@ module DB
28
28
  def self.connect db_credentials
29
29
  # Keep this conifiguration in sync with lib/pact_broker/app.rb#configure_database_connection
30
30
  Sequel.datetime_class = DateTime
31
- if ENV["DEBUG"] == "true" && ENV["PACT_BROKER_SQL_LOG_LEVEL"] != "none"
31
+ if ENV["DEBUG"] == "true" && ENV["PACT_BROKER_SQL_LOG_LEVEL"] && ENV["PACT_BROKER_SQL_LOG_LEVEL"] != "none"
32
32
  logger = Logger.new($stdout)
33
33
  end
34
34
  if db_credentials.fetch("adapter") == "sqlite"
@@ -10,8 +10,7 @@ module PactBroker
10
10
  property :number_of_attempts_remaining, as: :attemptsRemaining
11
11
  property :trigger_type, as: :triggerType
12
12
  property :event_name, as: :eventName
13
-
14
- property :created_at, as: :triggeredAt
13
+ property :created_at, as: :triggeredAt, getter: lambda { |_| FormatDateTime.call(created_at) }, writeable: false
15
14
 
16
15
  link :'pb:logs' do | context |
17
16
  {
@@ -30,10 +30,7 @@ module PactBroker
30
30
  end
31
31
 
32
32
  def malformed_request?
33
- if request.post?
34
- return invalid_json? || validation_errors?(webhook)
35
- end
36
- false
33
+ super || (request.post? && validation_errors?(webhook))
37
34
  end
38
35
 
39
36
  def to_json