pact_broker 2.98.0 → 2.101.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -0
  3. data/Gemfile +1 -0
  4. data/docs/CONFIGURATION.md +11 -1
  5. data/docs/api/PACTICIPANTS.md +290 -0
  6. data/docs/api/WEBHOOKS.md +40 -40
  7. data/lib/db.rb +1 -1
  8. data/lib/pact_broker/api/decorators/reason_decorator.rb +1 -15
  9. data/lib/pact_broker/api/decorators/triggered_webhook_decorator.rb +1 -2
  10. data/lib/pact_broker/api/middleware/http_debug_logs.rb +13 -7
  11. data/lib/pact_broker/api/resources/all_webhooks.rb +1 -4
  12. data/lib/pact_broker/api/resources/base_resource.rb +55 -5
  13. data/lib/pact_broker/api/resources/branch_version.rb +10 -1
  14. data/lib/pact_broker/api/resources/clean.rb +11 -9
  15. data/lib/pact_broker/api/resources/currently_deployed_versions_for_environment.rb +0 -4
  16. data/lib/pact_broker/api/resources/currently_supported_versions_for_environment.rb +0 -4
  17. data/lib/pact_broker/api/resources/deployed_version.rb +20 -16
  18. data/lib/pact_broker/api/resources/deployed_versions_for_version_and_environment.rb +1 -1
  19. data/lib/pact_broker/api/resources/environment.rb +5 -5
  20. data/lib/pact_broker/api/resources/environments.rb +1 -5
  21. data/lib/pact_broker/api/resources/label.rb +4 -0
  22. data/lib/pact_broker/api/resources/latest_pacts.rb +1 -1
  23. data/lib/pact_broker/api/resources/pact.rb +10 -13
  24. data/lib/pact_broker/api/resources/pact_content_diff.rb +7 -2
  25. data/lib/pact_broker/api/resources/pact_versions.rb +1 -5
  26. data/lib/pact_broker/api/resources/pact_versions_for_branch.rb +1 -5
  27. data/lib/pact_broker/api/resources/pact_webhooks.rb +1 -4
  28. data/lib/pact_broker/api/resources/pacticipant.rb +11 -5
  29. data/lib/pact_broker/api/resources/pacticipant_resource_methods.rb +0 -1
  30. data/lib/pact_broker/api/resources/pacticipant_webhooks.rb +1 -4
  31. data/lib/pact_broker/api/resources/pacticipants.rb +1 -4
  32. data/lib/pact_broker/api/resources/provider_pacts.rb +1 -1
  33. data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +19 -11
  34. data/lib/pact_broker/api/resources/publish_contracts.rb +12 -16
  35. data/lib/pact_broker/api/resources/released_version.rb +20 -8
  36. data/lib/pact_broker/api/resources/released_versions_for_version_and_environment.rb +11 -7
  37. data/lib/pact_broker/api/resources/tag.rb +7 -3
  38. data/lib/pact_broker/api/resources/tagged_pact_versions.rb +1 -5
  39. data/lib/pact_broker/api/resources/verification.rb +0 -4
  40. data/lib/pact_broker/api/resources/verifications.rb +7 -13
  41. data/lib/pact_broker/api/resources/version.rb +8 -0
  42. data/lib/pact_broker/api/resources/webhook.rb +5 -4
  43. data/lib/pact_broker/api/resources/webhook_execution.rb +4 -6
  44. data/lib/pact_broker/config/runtime_configuration.rb +2 -1
  45. data/lib/pact_broker/config/runtime_configuration_database_methods.rb +1 -1
  46. data/lib/pact_broker/contracts/contract_to_publish.rb +4 -0
  47. data/lib/pact_broker/contracts/contracts_to_publish.rb +4 -0
  48. data/lib/pact_broker/contracts/service.rb +23 -5
  49. data/lib/pact_broker/doc/views/index/pacticipant-branch-version.markdown +13 -2
  50. data/lib/pact_broker/doc/views/provider-pacts-for-verification.markdown +1 -1
  51. data/lib/pact_broker/domain/pacticipant.rb +1 -0
  52. data/lib/pact_broker/domain/tag.rb +8 -32
  53. data/lib/pact_broker/domain/version.rb +18 -10
  54. data/lib/pact_broker/locale/en.yml +8 -4
  55. data/lib/pact_broker/matrix/deployment_status_summary.rb +28 -19
  56. data/lib/pact_broker/matrix/every_row.rb +19 -1
  57. data/lib/pact_broker/matrix/integration.rb +5 -5
  58. data/lib/pact_broker/matrix/parse_query.rb +5 -0
  59. data/lib/pact_broker/matrix/quick_row.rb +41 -5
  60. data/lib/pact_broker/matrix/repository.rb +5 -3
  61. data/lib/pact_broker/matrix/resolved_selector.rb +47 -10
  62. data/lib/pact_broker/matrix/service.rb +4 -2
  63. data/lib/pact_broker/matrix/unresolved_selector.rb +14 -2
  64. data/lib/pact_broker/messages.rb +0 -15
  65. data/lib/pact_broker/pacticipants/repository.rb +5 -4
  66. data/lib/pact_broker/pacticipants/service.rb +11 -1
  67. data/lib/pact_broker/pacts/create_formatted_diff.rb +1 -0
  68. data/lib/pact_broker/pacts/eager_loaders.rb +4 -1
  69. data/lib/pact_broker/pacts/generate_sha.rb +1 -0
  70. data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +25 -0
  71. data/lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb +0 -15
  72. data/lib/pact_broker/pacts/verifiable_pact_messages.rb +4 -2
  73. data/lib/pact_broker/repositories/helpers.rb +13 -0
  74. data/lib/pact_broker/test/http_test_data_builder.rb +18 -2
  75. data/lib/pact_broker/test/test_data_builder.rb +20 -0
  76. data/lib/pact_broker/ui/views/groups/show.html.erb +2 -2
  77. data/lib/pact_broker/ui/views/matrix/show.haml +5 -2
  78. data/lib/pact_broker/version.rb +1 -1
  79. data/lib/pact_broker/versions/branch_service.rb +7 -0
  80. data/lib/pact_broker/versions/branch_version_repository.rb +17 -0
  81. data/lib/rack/pact_broker/cascade.rb +87 -0
  82. data/lib/webmachine/describe_routes.rb +43 -9
  83. metadata +5 -4
  84. 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: d9aac85ace2c0ba5eaacc6fe462dbe4fc3d7623414f13a9bf351bc70d7a8b37f
4
- data.tar.gz: 8bae3685f8b675c447aa986c0629875dad4e5e5e614411dea6ca75d77ed0918d
3
+ metadata.gz: '08222ce855214163448e53d62e9beea5b6b04c5fc6f9e56308ac27984c21599a'
4
+ data.tar.gz: 2e5f39087b8ff5a7b906d179554ba701043619910923465b10611fe198736a53
5
5
  SHA512:
6
- metadata.gz: d2249bef385597430fa0f9c296a4b83e489a71dc027b681f60c57e82efe6805403ae9054d996afeb2a65c20fa7f363e868dd754b4a589249c7a639e86b616c9d
7
- data.tar.gz: 60605b088a39d895374fc10028525b012b7d3a33579ade4f9f3c9119b014fbbf7857a18bb2f09147c65059d35f37a0858fcd126a408ba010dbd1c82ccc7e7788
6
+ metadata.gz: 4bb5843f3f1fc44f56bfeea79d2315ecb61c278ebdbb089e8cd5405784f39ba4475c0a04bdeaddd179a5bf863fa46139f76692ebaff3c8185abc8c21075544e6
7
+ data.tar.gz: 6982da454c1f364143d0d3abd11777c25a8114dbd3dd6ab6c5987dadb2239e804dee6ec124ada34f7d8a1aabe62dabf29047bb12f0a48f306fb29ee7a54ca111
data/CHANGELOG.md CHANGED
@@ -1,3 +1,63 @@
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
+
16
+ <a name="v2.100.0"></a>
17
+ ### v2.100.0 (2022-05-20)
18
+
19
+ #### Features
20
+
21
+ * check for potential duplicate pacticipants in publish contracts endpoint (#558) ([ed714f03](/../../commit/ed714f03))
22
+ * add support for "can i merge" matrix query ([bb108ed2](/../../commit/bb108ed2))
23
+ * remove inefficient skynet query for tags ([bdc2599c](/../../commit/bdc2599c))
24
+ * update text for matrix version description when no version is in an enviroment ([3eb5581d](/../../commit/3eb5581d))
25
+
26
+ * **pacts for verification**
27
+ * update wip and pending descriptions for wip pacts ([b06d4477](/../../commit/b06d4477))
28
+
29
+ * **matrix**
30
+ * add support for selectors specified by branch and environment name when reporting that a version does not exist ([07ff8044](/../../commit/07ff8044))
31
+
32
+ #### Bug Fixes
33
+
34
+ * **matrix**
35
+ * identify the correct failed version when a selector resolves to multiple versions ([11e7dc1c](/../../commit/11e7dc1c))
36
+
37
+ <a name="v2.99.0"></a>
38
+ ### v2.99.0 (2022-05-13)
39
+
40
+ #### Features
41
+
42
+ * remove disable_use_branch_heads_for_latest_branch_pacts feature toggle ([5c6f1766](/../../commit/5c6f1766))
43
+ * remove new_wip_calculation feature toggle ([add6cb08](/../../commit/add6cb08))
44
+ * timeout long running pact content diff requests (#555) ([88abb2cf](/../../commit/88abb2cf))
45
+ * change sql_log_level default from debug to none ([9f7aed46](/../../commit/9f7aed46))
46
+
47
+ #### Bug Fixes
48
+
49
+ * **ui**
50
+ * fix unescaped pacticipant name and main branch in details and network pages ([b8b1d306](/../../commit/b8b1d306))
51
+
52
+ * return a 400 when invalid JSON is used to create a version ([9af2cfaf](/../../commit/9af2cfaf))
53
+ * only log API requests/responses, not web assets, when http_debug_logging_enabled is true ([1f232c08](/../../commit/1f232c08))
54
+
55
+ * **matrix**
56
+ * fix performance issue when querying matrix with one selector ([3a08d128](/../../commit/3a08d128))
57
+
58
+ * **pacts for verification**
59
+ * return the pacts for the branch heads when using the branch selector ([6dac495e](/../../commit/6dac495e))
60
+
1
61
  <a name="v2.98.0"></a>
2
62
  ### v2.98.0 (2022-03-29)
3
63
 
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"
@@ -57,6 +57,7 @@ While the default is `file` for the Ruby application, it is set to `stdout` on t
57
57
 
58
58
  Enable this setting to print the entire request and response to the logs at debug level. Used for troubleshooting issues.
59
59
  Do not leave this on permanently, as it will have performance and security issues.
60
+ Ensure the application [`log_level`](#log_level) is set to `debug` when this setting is enabled.
60
61
 
61
62
  **Supported versions:** From v2.98.0<br/>
62
63
  **Environment variable name:** `PACT_BROKER_HTTP_DEBUG_LOGGING_ENABLED`<br/>
@@ -156,7 +157,7 @@ To disable noisy SQL query logging when the application `log_level` is set to `d
156
157
 
157
158
  **Environment variable name:** `PACT_BROKER_SQL_LOG_LEVEL`<br/>
158
159
  **YAML configuration key name:** `sql_log_level`<br/>
159
- **Default:** `debug`<br/>
160
+ **Default:** From 2.99+, the default is `none`. In previous versions, the default is `debug`.<br/>
160
161
  **Allowed values:** `none`, `debug`, `info`, `warn`, `error`, `fatal`<br/>
161
162
 
162
163
  ### sql_log_warn_duration
@@ -654,6 +655,15 @@ with a unique version number.
654
655
  **Allowed values:** `true`, `false`<br/>
655
656
  **More information:** https://docs.pact.io/versioning<br/>
656
657
 
658
+ ### pact_content_diff_timeout
659
+
660
+ The maximum amount of time in seconds to attempt to generate the diff between two pacts before aborting the request. This is required due to performance issues in the underlying diff generation code.
661
+
662
+ **Supported versions:** From 2.99.0<br/>
663
+ **Environment variable name:** `PACT_BROKER_PACT_CONTENT_DIFF_TIMEOUT`<br/>
664
+ **YAML configuration key name:** `pact_content_diff_timeout`<br/>
665
+ **Default:** `15`<br/>
666
+
657
667
  <br/>
658
668
 
659
669
  ## Miscellaneous
@@ -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
+