pact_broker 2.84.0 → 2.87.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/trigger_pact_docs_update.yml +22 -0
  3. data/CHANGELOG.md +63 -0
  4. data/DEVELOPER_DOCUMENTATION.md +0 -2
  5. data/db/migrations/20210913_add_pending_to_verifications.rb +7 -0
  6. data/db/migrations/20210914_add_labels_to_webhooks.rb +14 -0
  7. data/db/migrations/20210915_add_verified_by_to_verification.rb +6 -0
  8. data/db/migrations/20210929_increase_event_context_column_size.rb +14 -0
  9. data/docker-compose-ci-mysql.yml +1 -0
  10. data/docker-compose-test.yml +2 -0
  11. data/docs/CONFIGURATION.md +255 -66
  12. data/docs/configuration.yml +166 -101
  13. data/lib/db.rb +0 -1
  14. data/lib/pact/doc/interaction_view_model.rb +2 -2
  15. data/lib/pact/doc/markdown/consumer_contract_renderer.rb +4 -4
  16. data/lib/pact_broker/api/contracts/configuration.rb +33 -0
  17. data/lib/pact_broker/api/contracts/publish_contracts_schema.rb +35 -16
  18. data/lib/pact_broker/api/contracts/webhook_contract.rb +24 -2
  19. data/lib/pact_broker/api/decorators/matrix_decorator.rb +3 -1
  20. data/lib/pact_broker/api/decorators/reason_decorator.rb +2 -2
  21. data/lib/pact_broker/api/decorators/verification_decorator.rb +9 -3
  22. data/lib/pact_broker/api/decorators/verification_summary_decorator.rb +1 -2
  23. data/lib/pact_broker/api/decorators/webhook_decorator.rb +27 -4
  24. data/lib/pact_broker/api/middleware/configuration.rb +33 -0
  25. data/lib/pact_broker/api/pact_broker_urls.rb +35 -7
  26. data/lib/pact_broker/api/renderers/html_pact_renderer.rb +15 -11
  27. data/lib/pact_broker/api/resources/all_webhooks.rb +2 -2
  28. data/lib/pact_broker/api/resources/default_base_resource.rb +4 -0
  29. data/lib/pact_broker/api/resources/environment.rb +1 -1
  30. data/lib/pact_broker/api/resources/environments.rb +1 -1
  31. data/lib/pact_broker/api/resources/index.rb +7 -1
  32. data/lib/pact_broker/api/resources/pact_versions_for_branch.rb +40 -0
  33. data/lib/pact_broker/api/resources/publish_contracts.rb +1 -1
  34. data/lib/pact_broker/api/resources/verification.rb +5 -2
  35. data/lib/pact_broker/api/resources/verifications.rb +5 -1
  36. data/lib/pact_broker/api/resources/webhook_execution_methods.rb +23 -17
  37. data/lib/pact_broker/api.rb +2 -0
  38. data/lib/pact_broker/app.rb +2 -0
  39. data/lib/pact_broker/application_context.rb +5 -0
  40. data/lib/pact_broker/badges/service.rb +3 -1
  41. data/lib/pact_broker/config/runtime_configuration.rb +4 -0
  42. data/lib/pact_broker/config/runtime_configuration_database_methods.rb +1 -1
  43. data/lib/pact_broker/configuration.rb +33 -29
  44. data/lib/pact_broker/db/clean.rb +1 -2
  45. data/lib/pact_broker/db/delete_overwritten_data.rb +41 -23
  46. data/lib/pact_broker/deployments/deployed_version.rb +1 -0
  47. data/lib/pact_broker/deployments/deployed_version_service.rb +1 -0
  48. data/lib/pact_broker/deployments/environment_service.rb +4 -1
  49. data/lib/pact_broker/deployments/released_version_service.rb +1 -0
  50. data/lib/pact_broker/doc/controllers/app.rb +1 -0
  51. data/lib/pact_broker/doc/views/can-i-deploy.markdown +2 -1
  52. data/lib/pact_broker/doc/views/index/publish-contracts.markdown +38 -9
  53. data/lib/pact_broker/doc/views/pacticipant/label.markdown +12 -0
  54. data/lib/pact_broker/doc/views/webhooks.markdown +17 -0
  55. data/lib/pact_broker/domain/index_item.rb +9 -0
  56. data/lib/pact_broker/domain/pacticipant.rb +4 -0
  57. data/lib/pact_broker/domain/verification.rb +28 -4
  58. data/lib/pact_broker/domain/webhook.rb +27 -15
  59. data/lib/pact_broker/domain/webhook_pacticipant.rb +6 -0
  60. data/lib/pact_broker/domain/webhook_request.rb +2 -2
  61. data/lib/pact_broker/index/service.rb +77 -26
  62. data/lib/pact_broker/locale/en.yml +6 -1
  63. data/lib/pact_broker/matrix/head_row.rb +1 -1
  64. data/lib/pact_broker/matrix/parse_can_i_deploy_query.rb +5 -3
  65. data/lib/pact_broker/matrix/quick_row.rb +0 -1
  66. data/lib/pact_broker/matrix/repository.rb +0 -1
  67. data/lib/pact_broker/matrix/row.rb +2 -2
  68. data/lib/pact_broker/pacticipants/repository.rb +1 -1
  69. data/lib/pact_broker/pacts/latest_pact_publication_id_for_consumer_version.rb +0 -1
  70. data/lib/pact_broker/pacts/metadata.rb +11 -3
  71. data/lib/pact_broker/pacts/pact_publication.rb +44 -0
  72. data/lib/pact_broker/pacts/pact_publication_clean_selector_dataset_module.rb +19 -0
  73. data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +68 -1
  74. data/lib/pact_broker/pacts/pact_version.rb +24 -1
  75. data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +5 -4
  76. data/lib/pact_broker/pacts/repository.rb +52 -48
  77. data/lib/pact_broker/pacts/service.rb +5 -5
  78. data/lib/pact_broker/string_refinements.rb +1 -1
  79. data/lib/pact_broker/test/http_test_data_builder.rb +40 -11
  80. data/lib/pact_broker/test/test_data_builder.rb +27 -6
  81. data/lib/pact_broker/ui/app.rb +7 -1
  82. data/lib/pact_broker/ui/controllers/dashboard.rb +80 -0
  83. data/lib/pact_broker/ui/controllers/groups.rb +23 -8
  84. data/lib/pact_broker/ui/helpers/url_helper.rb +17 -1
  85. data/lib/pact_broker/ui/view_models/index_item.rb +64 -8
  86. data/lib/pact_broker/ui/view_models/index_item_branch_head.rb +39 -0
  87. data/lib/pact_broker/ui/view_models/index_item_provider_branch_head.rb +39 -0
  88. data/lib/pact_broker/ui/view_models/matrix_branch.rb +1 -1
  89. data/lib/pact_broker/ui/view_models/matrix_tag.rb +0 -1
  90. data/lib/pact_broker/ui/views/dashboard/show.haml +202 -0
  91. data/lib/pact_broker/ui/views/groups/show.html.erb +60 -14
  92. data/lib/pact_broker/ui/views/index/_dashboard_navbar.haml +7 -0
  93. data/lib/pact_broker/ui/views/index/_navbar.haml +0 -7
  94. data/lib/pact_broker/ui/views/index/show-with-tags.haml +3 -1
  95. data/lib/pact_broker/ui/views/index/show.haml +35 -13
  96. data/lib/pact_broker/ui/views/matrix/show.haml +7 -3
  97. data/lib/pact_broker/verifications/pseudo_branch_status.rb +2 -0
  98. data/lib/pact_broker/verifications/repository.rb +5 -2
  99. data/lib/pact_broker/verifications/service.rb +8 -4
  100. data/lib/pact_broker/version.rb +1 -1
  101. data/lib/pact_broker/versions/branch_head.rb +0 -2
  102. data/lib/pact_broker/versions/branch_version.rb +1 -0
  103. data/lib/pact_broker/versions/repository.rb +0 -1
  104. data/lib/pact_broker/webhooks/event_listener.rb +7 -5
  105. data/lib/pact_broker/webhooks/execution_configuration.rb +16 -0
  106. data/lib/pact_broker/webhooks/execution_configuration_creator.rb +3 -0
  107. data/lib/pact_broker/webhooks/job.rb +1 -1
  108. data/lib/pact_broker/webhooks/pact_and_verification_parameters.rb +18 -3
  109. data/lib/pact_broker/webhooks/repository.rb +10 -4
  110. data/lib/pact_broker/webhooks/trigger_service.rb +3 -3
  111. data/lib/pact_broker/webhooks/webhook.rb +71 -8
  112. data/lib/pact_broker/webhooks/webhook_execution_result.rb +3 -7
  113. data/lib/pact_broker/webhooks/webhook_request_logger.rb +4 -12
  114. data/lib/pact_broker/webhooks/webhook_request_template.rb +6 -8
  115. data/pact_broker.gemspec +4 -0
  116. data/public/javascripts/index.js +75 -68
  117. data/public/javascripts/pact.js +14 -14
  118. data/public/stylesheets/index.css +6 -2
  119. data/public/stylesheets/pact.css +11 -0
  120. data/script/data/auto-create-things-for-tags.rb +3 -0
  121. data/script/data/branches.rb +2 -2
  122. data/script/data/contract-published-requiring-verification.rb +0 -1
  123. data/script/data/environments.rb +0 -0
  124. data/script/data/pending.rb +26 -0
  125. data/script/data/tags.rb +35 -0
  126. data/script/data/verify-pact-for-multiple-selectors.rb +30 -0
  127. data/script/data/webhook.rb +22 -0
  128. data/script/docs/generate-configuration-docs.rb +24 -3
  129. data/script/generate-erd +55 -0
  130. data/script/seed.rb +50 -89
  131. data/spec/features/create_webhook_spec.rb +55 -10
  132. data/spec/features/delete_pact_versions_for_branch_spec.rb +34 -0
  133. data/spec/features/get_pact_spec.rb +2 -3
  134. data/spec/fixtures/approvals/modifiable_resources.approved.json +4 -0
  135. data/spec/fixtures/invalid-publish-contract-body.json +38 -0
  136. data/spec/fixtures/verification.json +4 -0
  137. data/spec/integration/app_spec.rb +6 -6
  138. data/spec/integration/webhooks/contract_publication_spec.rb +68 -0
  139. data/spec/integration/webhooks/contract_requiring_verification_published_spec.rb +67 -0
  140. data/spec/integration/webhooks/pact_publication_spec.rb +51 -0
  141. data/spec/lib/pact/doc/markdown/consumer_contract_renderer_spec.rb +2 -2
  142. data/spec/lib/pact_broker/api/contracts/publish_contracts_schema_spec.rb +13 -0
  143. data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +50 -0
  144. data/spec/lib/pact_broker/api/decorators/matrix_decorator_spec.rb +1 -1
  145. data/spec/lib/pact_broker/api/decorators/reason_decorator_spec.rb +2 -2
  146. data/spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb +15 -7
  147. data/spec/lib/pact_broker/api/decorators/verification_summary_decorator_spec.rb +6 -2
  148. data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +4 -4
  149. data/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb +1 -1
  150. data/spec/lib/pact_broker/api/middleware/configuration_spec.rb +43 -0
  151. data/spec/lib/pact_broker/api/pact_broker_urls_spec.rb +18 -0
  152. data/spec/lib/pact_broker/api/resources/triggered_webhook_logs_spec.rb +6 -5
  153. data/spec/lib/pact_broker/api/resources/verifications_spec.rb +2 -3
  154. data/spec/lib/pact_broker/api/resources/webhook_execution_spec.rb +1 -1
  155. data/spec/lib/pact_broker/badges/service_spec.rb +22 -0
  156. data/spec/lib/pact_broker/config/runtime_configuration_documentation_spec.rb +30 -0
  157. data/spec/lib/pact_broker/deployments/environment_service_spec.rb +1 -1
  158. data/spec/lib/pact_broker/domain/webhook_request_spec.rb +2 -1
  159. data/spec/lib/pact_broker/domain/webhook_spec.rb +15 -5
  160. data/spec/lib/pact_broker/index/service_spec.rb +1 -5
  161. data/spec/lib/pact_broker/index/service_view_spec.rb +144 -0
  162. data/spec/lib/pact_broker/matrix/head_row_spec.rb +9 -5
  163. data/spec/lib/pact_broker/matrix/parse_can_i_deploy_query_spec.rb +13 -0
  164. data/spec/lib/pact_broker/pacts/metadata_spec.rb +11 -2
  165. data/spec/lib/pact_broker/pacts/{latest_tagged_pact_publications_spec.rb → pact_publication_clean_selector_dataset_module_spec.rb} +7 -9
  166. data/spec/lib/pact_broker/pacts/pact_publication_latest_verification_spec.rb +29 -0
  167. data/spec/lib/pact_broker/pacts/pact_version_spec.rb +32 -0
  168. data/spec/lib/pact_broker/pacts/repository_find_for_verification_spec.rb +4 -5
  169. data/spec/lib/pact_broker/pacts/repository_spec.rb +48 -2
  170. data/spec/lib/pact_broker/ui/view_models/index_item_spec.rb +12 -9
  171. data/spec/lib/pact_broker/verifications/pseudo_branch_status_spec.rb +9 -1
  172. data/spec/lib/pact_broker/verifications/service_spec.rb +24 -8
  173. data/spec/lib/pact_broker/webhooks/job_spec.rb +4 -4
  174. data/spec/lib/pact_broker/webhooks/render_spec.rb +3 -2
  175. data/spec/lib/pact_broker/webhooks/repository_spec.rb +158 -15
  176. data/spec/lib/pact_broker/webhooks/trigger_service_spec.rb +9 -5
  177. data/spec/lib/pact_broker/webhooks/webhook_request_logger_spec.rb +6 -12
  178. data/spec/lib/pact_broker/webhooks/webhook_request_template_spec.rb +3 -2
  179. data/spec/lib/pact_broker/webhooks/webhook_spec.rb +8 -5
  180. data/spec/support/generated_markdown.md +3 -3
  181. data/tasks/db.rake +4 -1
  182. metadata +72 -14
  183. data/lib/pact_broker/pacts/all_pact_publications.rb +0 -158
  184. data/lib/pact_broker/pacts/latest_pact_publications.rb +0 -48
  185. data/lib/pact_broker/pacts/latest_pact_publications_by_consumer_version.rb +0 -26
  186. data/lib/pact_broker/pacts/latest_tagged_pact_publications.rb +0 -45
  187. data/lib/pact_broker/verifications/latest_verification_for_pact_version.rb +0 -39
  188. data/spec/lib/pact_broker/api/resources/webhook_execution_result_spec.rb +0 -56
  189. data/spec/lib/pact_broker/verifications/latest_verification_for_pact_version_spec.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d104329cabc691c2ec288acee11837621c8970181a6dddf7d4bf7e4c5d3f48fe
4
- data.tar.gz: d7c5c2a75605aa5f947495670d995d5d5500f487dff86ae676da3bd883c55510
3
+ metadata.gz: f376a0bea2db36abf0b4b601badefb182b836bad4c43be53063388ad65ecc1c0
4
+ data.tar.gz: 5ab7478d03702755dea935bde89173461b6221c4723c719267a9a6e8360d6e9c
5
5
  SHA512:
6
- metadata.gz: 7a973402c0c004acd5f94cc0c04efec0ded2039f43dfd3e2ca7ba014b853f958345b2ada02c05af05748416dbe466596920d8112c34efd71a5533c212ab6002c
7
- data.tar.gz: 9bf006fa32ad47353df1bb9704a8da05205de57da618273ca0c0cb3b487c570951caa1e0ab3624177aa82a12c329d63aeba11c07c87b1eaa1e368956edd72250
6
+ metadata.gz: 7bb19660447b2f13d2f815b6ce13b3aa27dac289ba023d4463de204fd6605c1f2d787f8e08d36c5868947ba4fa44fb277cf04a77a9e90ad1a9c5e0642d5ec269
7
+ data.tar.gz: 1a68a6c2393f42469045b4fffd1fa548b4833e66401733e75a43382103c8481f38c54d5ed4241e3f4232596b5a23dab6af6a518bad5398d8777b23137c8d9fc9
@@ -0,0 +1,22 @@
1
+ name: Trigger update to docs.pact.io
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ paths:
8
+ - '**/*.md'
9
+ repository_dispatch:
10
+ types:
11
+ - gem-released
12
+
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Trigger docs.pact.io update workflow
18
+ uses: peter-evans/repository-dispatch@v1
19
+ with:
20
+ token: ${{ secrets.GHTOKENFORTRIGGERINGPACTDOCSUPDATE }}
21
+ repository: pact-foundation/docs.pact.io
22
+ event-type: pact-broker-docs-updated
data/CHANGELOG.md CHANGED
@@ -1,3 +1,66 @@
1
+ <a name="v2.87.0"></a>
2
+ ### v2.87.0 (2021-10-05)
3
+
4
+ #### Features
5
+
6
+ * **matrix**
7
+ * preselect the consumer version when clicking through to matrix page from integration dashboard ([b550b470](/../../commit/b550b470))
8
+
9
+ * **dashboard**
10
+ * show tooltip explaining auto created branches ([cdaf7f6e](/../../commit/cdaf7f6e))
11
+
12
+ * **can-i-deploy**
13
+ * support ignoring specific version numbers ([2ac5a946](/../../commit/2ac5a946))
14
+ * make verification results URL reference the appropriate consumer version as the pb:pact-version ([145bb37b](/../../commit/145bb37b))
15
+
16
+ * add pb:can-i-deploy-pacticipant-version-to-environment relation ([67328194](/../../commit/67328194))
17
+
18
+ * **webhooks**
19
+ * support ${pactbroker.providerVersionDescriptions} template parameter ([54a073eb](/../../commit/54a073eb))
20
+ * support ${pactbroker.buildUrl} template parameter ([9b79b33f](/../../commit/9b79b33f))
21
+ * support $pactbroker.consumerVersionBranch template parameter ([b97ba84c](/../../commit/b97ba84c))
22
+
23
+ #### Bug Fixes
24
+
25
+ * **mysql**
26
+ * increase size of event_context column ([c1596419](/../../commit/c1596419))
27
+
28
+ * correctly merge dry validation and custom validation error messages when publishing contracts ([688b1e3f](/../../commit/688b1e3f))
29
+
30
+ * **pacts for verification**
31
+ * correct logic for returning pact for main branch when no consumer version selectors are specified ([8847e442](/../../commit/8847e442))
32
+
33
+ * **db clean**
34
+ * optimise calls to identify overwritten data to delete ([aaef9e6d](/../../commit/aaef9e6d))
35
+
36
+ <a name="v2.86.0"></a>
37
+ ### v2.86.0 (2021-09-17)
38
+
39
+ #### Features
40
+
41
+ * allow webhooks to match pacticipants by label (#501) ([f30a9dcc](/../../commit/f30a9dcc))
42
+ * in the webhook body for contract_published and contract_content_changed, use the latest verification from the main branch if present ([b45398bd](/../../commit/b45398bd))
43
+ * change default database_connection_validation_timeout from -1 (every request) to nil (which Sequel will set to 3600 seconds) ([0c508572](/../../commit/0c508572))
44
+ * add version details of the implementation that verified a Pact (#363) ([021a8692](/../../commit/021a8692))
45
+
46
+ <a name="v2.85.1"></a>
47
+ ### v2.85.1 (2021-09-14)
48
+
49
+ #### Bug Fixes
50
+
51
+ * fix bug identifying latest verification for tagged pact ([43ac4b03](/../../commit/43ac4b03))
52
+
53
+ <a name="v2.85.0"></a>
54
+ ### v2.85.0 (2021-09-13)
55
+
56
+ #### Features
57
+
58
+ * show in the UI whether or not a pact was pending when verification failed ([326c068e](/../../commit/326c068e))
59
+ * thread safe configuration overrides (#500) ([50900231](/../../commit/50900231))
60
+ * allow dashboard pacts to be viewed by branch, tag, environment or all ([1ec8fc82](/../../commit/1ec8fc82))
61
+ * support deleting pacts by branch in the UI ([bc8fef1d](/../../commit/bc8fef1d))
62
+ * update UI ([0ba5eda3](/../../commit/0ba5eda3))
63
+
1
64
  <a name="v2.84.0"></a>
2
65
  ### v2.84.0 (2021-09-10)
3
66
 
@@ -85,8 +85,6 @@ pact publication resource will be created with an incremented revision number, b
85
85
 
86
86
  * `latest_pact_publications_by_consumer_versions` - This view has the same columns as `all_pact_publications`, but it only contains the latest revision of the pact for each provider/consumer/version. It maps to what a user would consider the "pact" resource ie. `/pacts/provider/PROVIDER/consumer/CONSUMER/version/VERSION`. Previous revisions are not currently exposed via the API.
87
87
 
88
- The `AllPactPublications` Sequel model in the code is what is used when querying data for displaying in a response, rather than the normalised separate PactPublication and PactVersion models.
89
-
90
88
  * `latest_pact_publications` - This view has the same columns as `all_pact_publications`, but it only contains the latest revision of the pact for the latest consumer version for each consumer/provider pair. It is what a user would consider the "latest pact", and maps to the resource at `/pacts/provider/PROVIDER/consumer/CONSUMER/latest`
91
89
 
92
90
  * `latest_tagged_pact_publications` - This view has the same columns as `all_pact_publications`, plus a `tag_name` column. It is used to return the pact for the latest tagged version of a consumer.
@@ -0,0 +1,7 @@
1
+ Sequel.migration do
2
+ change do
3
+ alter_table(:verifications) do
4
+ add_column(:pact_pending, TrueClass)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,14 @@
1
+ Sequel.migration do
2
+ change do
3
+ alter_table(:webhooks) do
4
+ add_column(:consumer_label, String)
5
+ add_column(:provider_label, String)
6
+ end
7
+
8
+ # SQLite workaround - with one `alter_table` block it adds only last constraint.
9
+ alter_table(:webhooks) do
10
+ add_constraint(:consumer_label_exclusion, "consumer_id IS NULL OR (consumer_id IS NOT NULL AND consumer_label IS NULL)")
11
+ add_constraint(:provider_label_exclusion, "provider_id IS NULL OR (provider_id IS NOT NULL AND provider_label IS NULL)")
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ Sequel.migration do
2
+ change do
3
+ add_column(:verifications, :verified_by_implementation, String)
4
+ add_column(:verifications, :verified_by_version, String)
5
+ end
6
+ end
@@ -0,0 +1,14 @@
1
+ require_relative "migration_helper"
2
+ include PactBroker::MigrationHelper
3
+
4
+ Sequel.migration do
5
+ up do
6
+ if mysql?
7
+ run("ALTER TABLE triggered_webhooks CHANGE event_context event_context mediumtext")
8
+ end
9
+ end
10
+
11
+ down do
12
+
13
+ end
14
+ end
@@ -33,5 +33,6 @@ services:
33
33
  - ./.gitignore:/home/.gitignore
34
34
  - ./public:/home/public
35
35
  - ./script/docker-container/test.sh:/usr/local/bin/test
36
+ - ./docs:/home/docs
36
37
  entrypoint: dockerize
37
38
  command: --wait tcp://mysql:3306 -timeout 60s test
@@ -49,6 +49,7 @@ services:
49
49
  - ./.rubocop:/home/.rubocop
50
50
  - ./.gitignore:/home/.gitignore
51
51
  - ./public:/home/public
52
+ - ./docs:/home/docs
52
53
 
53
54
  mysql:
54
55
  image: mysql:5.7.28
@@ -97,4 +98,5 @@ services:
97
98
  - ./.rubocop:/home/.rubocop
98
99
  - ./.gitignore:/home/.gitignore
99
100
  - ./public:/home/public
101
+ - ./docs:/home/docs
100
102