pact_broker 2.85.1 → 2.86.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release_gem.yml +1 -1
  3. data/.github/workflows/trigger_pact_docs_update.yml +22 -0
  4. data/CHANGELOG.md +10 -0
  5. data/DEVELOPER_DOCUMENTATION.md +0 -2
  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/docker-compose-ci-mysql.yml +1 -0
  9. data/docs/CONFIGURATION.md +255 -66
  10. data/docs/configuration.yml +166 -101
  11. data/lib/db.rb +0 -1
  12. data/lib/pact_broker/api/contracts/webhook_contract.rb +24 -2
  13. data/lib/pact_broker/api/decorators/verification_decorator.rb +4 -0
  14. data/lib/pact_broker/api/decorators/webhook_decorator.rb +27 -4
  15. data/lib/pact_broker/api/pact_broker_urls.rb +4 -0
  16. data/lib/pact_broker/api/resources/all_webhooks.rb +2 -2
  17. data/lib/pact_broker/config/runtime_configuration.rb +4 -0
  18. data/lib/pact_broker/config/runtime_configuration_database_methods.rb +1 -1
  19. data/lib/pact_broker/db/clean.rb +1 -2
  20. data/lib/pact_broker/doc/views/pacticipant/label.markdown +12 -0
  21. data/lib/pact_broker/doc/views/webhooks.markdown +17 -0
  22. data/lib/pact_broker/domain/pacticipant.rb +4 -0
  23. data/lib/pact_broker/domain/verification.rb +16 -4
  24. data/lib/pact_broker/domain/webhook.rb +5 -5
  25. data/lib/pact_broker/domain/webhook_pacticipant.rb +6 -0
  26. data/lib/pact_broker/locale/en.yml +1 -0
  27. data/lib/pact_broker/matrix/head_row.rb +1 -1
  28. data/lib/pact_broker/matrix/quick_row.rb +0 -1
  29. data/lib/pact_broker/matrix/repository.rb +0 -1
  30. data/lib/pact_broker/matrix/row.rb +2 -2
  31. data/lib/pact_broker/pacts/latest_pact_publication_id_for_consumer_version.rb +0 -1
  32. data/lib/pact_broker/pacts/pact_publication.rb +7 -0
  33. data/lib/pact_broker/pacts/pact_publication_clean_selector_dataset_module.rb +19 -0
  34. data/lib/pact_broker/pacts/pact_publication_dataset_module.rb +30 -2
  35. data/lib/pact_broker/pacts/pact_version.rb +24 -1
  36. data/lib/pact_broker/pacts/pacts_for_verification_repository.rb +2 -2
  37. data/lib/pact_broker/pacts/repository.rb +50 -47
  38. data/lib/pact_broker/test/http_test_data_builder.rb +37 -10
  39. data/lib/pact_broker/test/test_data_builder.rb +22 -5
  40. data/lib/pact_broker/verifications/repository.rb +5 -2
  41. data/lib/pact_broker/verifications/service.rb +4 -1
  42. data/lib/pact_broker/version.rb +1 -1
  43. data/lib/pact_broker/webhooks/event_listener.rb +4 -2
  44. data/lib/pact_broker/webhooks/pact_and_verification_parameters.rb +1 -0
  45. data/lib/pact_broker/webhooks/repository.rb +10 -4
  46. data/lib/pact_broker/webhooks/webhook.rb +66 -8
  47. data/script/data/verify-pact-for-multiple-selectors.rb +30 -0
  48. data/script/docs/generate-configuration-docs.rb +24 -3
  49. data/script/generate-erd +55 -0
  50. data/spec/features/create_webhook_spec.rb +55 -10
  51. data/spec/features/get_pact_spec.rb +2 -3
  52. data/spec/fixtures/verification.json +4 -0
  53. data/spec/integration/webhooks/pact_publication_spec.rb +51 -0
  54. data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +50 -0
  55. data/spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb +8 -1
  56. data/spec/lib/pact_broker/api/decorators/verification_summary_decorator_spec.rb +3 -1
  57. data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +4 -4
  58. data/spec/lib/pact_broker/config/runtime_configuration_documentation_spec.rb +30 -0
  59. data/spec/lib/pact_broker/deployments/environment_service_spec.rb +1 -1
  60. data/spec/lib/pact_broker/matrix/head_row_spec.rb +9 -5
  61. data/spec/lib/pact_broker/pacts/{latest_tagged_pact_publications_spec.rb → pact_publication_clean_selector_dataset_module_spec.rb} +7 -9
  62. data/spec/lib/pact_broker/pacts/pact_version_spec.rb +32 -0
  63. data/spec/lib/pact_broker/pacts/repository_spec.rb +33 -0
  64. data/spec/lib/pact_broker/verifications/service_spec.rb +16 -2
  65. data/spec/lib/pact_broker/webhooks/repository_spec.rb +158 -15
  66. data/spec/lib/pact_broker/webhooks/webhook_spec.rb +8 -5
  67. metadata +16 -11
  68. data/lib/pact_broker/pacts/all_pact_publications.rb +0 -158
  69. data/lib/pact_broker/pacts/latest_pact_publications.rb +0 -48
  70. data/lib/pact_broker/pacts/latest_pact_publications_by_consumer_version.rb +0 -26
  71. data/lib/pact_broker/pacts/latest_tagged_pact_publications.rb +0 -45
  72. data/lib/pact_broker/verifications/latest_verification_for_pact_version.rb +0 -39
  73. data/spec/lib/pact_broker/verifications/latest_verification_for_pact_version_spec.rb +0 -18
@@ -1,39 +0,0 @@
1
- require "pact_broker/domain/verification"
2
-
3
- # TODO delete this when AllPactPublications is deleted
4
-
5
- module PactBroker
6
- module Verifications
7
- class LatestVerificationForPactVersion < PactBroker::Domain::Verification
8
- set_dataset(:latest_verifications_for_pact_versions)
9
-
10
- # this view doesn't have a consumer_id
11
- def consumer
12
- PactBroker::Domain::Pacticipant.find(id: PactBroker::Pacts::AllPactPublications
13
- .where(pact_version_id: pact_version_id)
14
- .limit(1).select(:consumer_id))
15
- end
16
-
17
- # this view doesn't have a provider_id
18
- def provider
19
- PactBroker::Domain::Pacticipant.find(id: PactBroker::Pacts::AllPactPublications
20
- .where(pact_version_id: pact_version_id)
21
- .limit(1).select(:provider_id))
22
- end
23
- end
24
- end
25
- end
26
-
27
- # Table: latest_verifications_for_pact_versions
28
- # Columns:
29
- # id | integer |
30
- # number | integer |
31
- # success | boolean |
32
- # build_url | text |
33
- # pact_version_id | integer |
34
- # execution_date | timestamp without time zone |
35
- # created_at | timestamp without time zone |
36
- # provider_version_id | integer |
37
- # provider_version_number | text |
38
- # provider_version_order | integer |
39
- # test_results | text |
@@ -1,18 +0,0 @@
1
- require "pact_broker/verifications/latest_verification_for_pact_version"
2
-
3
- module PactBroker
4
- module Verifications
5
- describe LatestVerificationForPactVersion do
6
- before do
7
- td.create_pact_with_hierarchy("Foo", "1", "Bar")
8
- .create_verification(provider_version: "2")
9
- end
10
-
11
- subject { LatestVerificationForPactVersion.first }
12
-
13
- its(:"consumer.name") { is_expected.to eq "Foo" }
14
- its(:"provider.name") { is_expected.to eq "Bar" }
15
- its(:"provider_version.number") { is_expected.to eq "2" }
16
- end
17
- end
18
- end