pact_broker 2.12.0 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -5
  3. data/README.md +13 -8
  4. data/bethtest.rb +21 -94
  5. data/db/migrations/20171112_add_test_results.rb +7 -0
  6. data/db/migrations/20171117_create_webhook_events.rb +14 -0
  7. data/db/migrations/20171118_create_webhook_events.rb +18 -0
  8. data/db/migrations/20180108_create_certificates_table.rb +14 -0
  9. data/db/migrations/20180109_migrate_trigger_type.rb +9 -0
  10. data/db/pact_broker_database.sqlite3 +0 -0
  11. data/db/test/backwards_compatibility/gemfiles/1.18.0.gemfile.lock +5 -5
  12. data/db/test/backwards_compatibility/gemfiles/2.0.0.gemfile.lock +5 -5
  13. data/db/test/backwards_compatibility/gemfiles/2.1.0.gemfile.lock +5 -5
  14. data/db/test/backwards_compatibility/gemfiles/2.2.0.gemfile.lock +12 -14
  15. data/db/test/backwards_compatibility/gemfiles/2.3.0.gemfile.lock +12 -14
  16. data/db/test/backwards_compatibility/gemfiles/2.4.2.gemfile.lock +12 -14
  17. data/db/test/backwards_compatibility/gemfiles/2.5.1.gemfile.lock +12 -14
  18. data/db/test/backwards_compatibility/gemfiles/2.6.0.gemfile.lock +12 -14
  19. data/db/test/backwards_compatibility/gemfiles/head.gemfile.lock +16 -15
  20. data/db/test/change_migration_strategy/before/Gemfile +1 -0
  21. data/example/README.md +65 -0
  22. data/example/config.ru +1 -0
  23. data/example/example_data.sql +17 -0
  24. data/lib/pact_broker/api.rb +1 -1
  25. data/lib/pact_broker/api/contracts/webhook_contract.rb +9 -1
  26. data/lib/pact_broker/api/decorators/verification_decorator.rb +1 -0
  27. data/lib/pact_broker/api/decorators/webhook_decorator.rb +35 -5
  28. data/lib/pact_broker/api/resources/matrix_badge.rb +21 -0
  29. data/lib/pact_broker/certificates/certificate.rb +8 -0
  30. data/lib/pact_broker/certificates/service.rb +41 -0
  31. data/lib/pact_broker/doc/controllers/app.rb +12 -2
  32. data/lib/pact_broker/doc/views/webhooks.markdown +37 -2
  33. data/lib/pact_broker/domain/verification.rb +2 -0
  34. data/lib/pact_broker/domain/webhook.rb +2 -1
  35. data/lib/pact_broker/domain/webhook_request.rb +22 -4
  36. data/lib/pact_broker/error.rb +5 -0
  37. data/lib/pact_broker/matrix/parse_query.rb +7 -10
  38. data/lib/pact_broker/matrix/repository.rb +5 -32
  39. data/lib/pact_broker/matrix/service.rb +21 -3
  40. data/lib/pact_broker/pacts/repository.rb +9 -2
  41. data/lib/pact_broker/pacts/service.rb +2 -2
  42. data/lib/pact_broker/services.rb +5 -0
  43. data/lib/pact_broker/ui/app.rb +15 -0
  44. data/lib/pact_broker/ui/controllers/matrix.rb +58 -3
  45. data/lib/pact_broker/ui/views/matrix/show.haml +65 -10
  46. data/lib/pact_broker/verifications/service.rb +6 -1
  47. data/lib/pact_broker/version.rb +1 -1
  48. data/lib/pact_broker/webhooks/job.rb +1 -1
  49. data/lib/pact_broker/webhooks/repository.rb +17 -0
  50. data/lib/pact_broker/webhooks/service.rb +8 -7
  51. data/lib/pact_broker/webhooks/triggered_webhook.rb +1 -1
  52. data/lib/pact_broker/webhooks/webhook.rb +3 -0
  53. data/lib/pact_broker/webhooks/webhook_event.rb +24 -0
  54. data/pact_broker.gemspec +2 -1
  55. data/public/javascripts/matrix.js +60 -0
  56. data/public/stylesheets/matrix.css +12 -0
  57. data/script/db-spec.sh +1 -0
  58. data/script/foo-bar-verification.json +57 -0
  59. data/script/insert-self-signed-certificate-from-url.rb +32 -0
  60. data/script/publish-verification.sh +5 -0
  61. data/script/seed-matrix.rb +6 -5
  62. data/script/seed.rb +67 -59
  63. data/spec/features/create_webhook_spec.rb +4 -1
  64. data/spec/features/get_matrix_badge_spec.rb +40 -0
  65. data/spec/features/publish_verification_spec.rb +28 -4
  66. data/spec/fixtures/certificate-invalid.pem +29 -0
  67. data/spec/fixtures/certificate.pem +53 -0
  68. data/spec/fixtures/certificates/cacert.pem +21 -0
  69. data/spec/fixtures/certificates/cert.pem +20 -0
  70. data/spec/fixtures/certificates/key.pem +27 -0
  71. data/spec/fixtures/certificates/self-signed.badssl.com.pem +21 -0
  72. data/spec/fixtures/verification.json +4 -1
  73. data/spec/fixtures/webhook_valid.json +3 -0
  74. data/spec/integration/webhooks/certificate_spec.rb +80 -0
  75. data/spec/lib/pact_broker/api/contracts/webhook_contract_spec.rb +20 -0
  76. data/spec/lib/pact_broker/api/decorators/pact_webhooks_status_decorator_spec.rb +2 -2
  77. data/spec/lib/pact_broker/api/decorators/verification_decorator_spec.rb +5 -0
  78. data/spec/lib/pact_broker/api/decorators/verification_summary_decorator_spec.rb +1 -0
  79. data/spec/lib/pact_broker/api/decorators/webhook_decorator_spec.rb +29 -19
  80. data/spec/lib/pact_broker/api/resources/badge_spec.rb +61 -0
  81. data/spec/lib/pact_broker/api/resources/matrix_badge_spec.rb +11 -0
  82. data/spec/lib/pact_broker/api/resources/pact_webhooks_spec.rb +8 -9
  83. data/spec/lib/pact_broker/certificates/service_spec.rb +60 -0
  84. data/spec/lib/pact_broker/domain/verification_spec.rb +13 -0
  85. data/spec/lib/pact_broker/domain/webhook_request_spec.rb +0 -4
  86. data/spec/lib/pact_broker/matrix/service_spec.rb +40 -8
  87. data/spec/lib/pact_broker/pacts/repository_spec.rb +18 -1
  88. data/spec/lib/pact_broker/webhooks/job_spec.rb +1 -1
  89. data/spec/lib/pact_broker/webhooks/repository_spec.rb +53 -13
  90. data/spec/lib/pact_broker/webhooks/service_spec.rb +9 -6
  91. data/spec/migrations/change_migration_strategy_spec.rb +13 -14
  92. data/spec/spec_helper.rb +4 -0
  93. data/spec/support/ssl_webhook_server.rb +37 -0
  94. data/spec/support/test_data_builder.rb +12 -4
  95. data/tasks/database.rb +9 -7
  96. data/tasks/database/table_dependency_calculator.rb +44 -0
  97. metadata +57 -6
  98. data/lib/pact_broker/doc/views/pact-webhooks.markdown +0 -50
  99. data/lib/pact_broker/doc/views/webhooks-create.markdown +0 -38
  100. data/lib/pact_broker/doc/views/webhooks-webhooks.markdown +0 -15
@@ -1,50 +0,0 @@
1
- # Webhooks
2
-
3
- Allowed methods: GET, POST, DELETE
4
-
5
- ### Creating
6
-
7
- 1. To create a webhook, in the HAL Browser, navigate to the pact you want to create the webhook for
8
- (Click "Go to Entry Point", then select "latest-pacts", then select the pact you want to create the webhook for.)
9
- 2. Click the "NON-GET" button for the "pact-webhooks" relation.
10
- 3. Paste in the webhook JSON (example shown below) in the body section and click "Make Request".
11
-
12
- An example webhook to trigger a Bamboo job.
13
-
14
- {
15
- "request": {
16
- "method": "POST",
17
- "url": "http://master.ci.my.domain:8085/rest/api/latest/queue/SOME-PROJECT?os_authType=basic",
18
- "username": "username",
19
- "password": "password",
20
- "headers": {
21
- "Accept": "application/json"
22
- }
23
- }
24
- }
25
-
26
- A request body can be specified as well.
27
-
28
- {
29
- "request": {
30
- "method": "POST",
31
- "url": "http://example.org/something",
32
- "body": {
33
- "some" : "json"
34
- }
35
- }
36
- }
37
-
38
- **BEWARE** The password can be reverse engineered from the database, so make a separate account for the Pact Broker to use, don't use your personal account!
39
-
40
- ### Testing
41
-
42
- To test a webhook, navigate to the webhook in the HAL browser, then make a POST request to the "execute" relation. The response or error will be shown in the window.
43
-
44
- ### Deleting
45
-
46
- Send a DELETE request to the webhook URL.
47
-
48
- ### Updating
49
-
50
- Send a PUT request to the webhook URL with all fields required for the new webhook.
@@ -1,38 +0,0 @@
1
- # Create a webhook
2
-
3
- Allowed methods: POST
4
-
5
- 1. Click the "NON-GET" button for the "pb:create" relation.
6
- 3. Paste in the webhook JSON (example shown below) in the body section and click "Make Request".
7
-
8
- An example webhook to trigger a Bamboo job.
9
-
10
- {
11
- "request": {
12
- "method": "POST",
13
- "url": "http://master.ci.my.domain:8085/rest/api/latest/queue/SOME-PROJECT?os_authType=basic",
14
- "username": "username",
15
- "password": "password",
16
- "headers": {
17
- "Accept": "application/json"
18
- }
19
- }
20
- }
21
-
22
- A request body can be specified as well.
23
-
24
- {
25
- "request": {
26
- "method": "POST",
27
- "url": "http://example.org/something",
28
- "body": {
29
- "some" : "json"
30
- }
31
- }
32
- }
33
-
34
- **BEWARE** The password can be reverse engineered from the database, so make a separate account for the Pact Broker to use, don't use your personal account!
35
-
36
- ### Testing
37
-
38
- To test a webhook, navigate to the webhook in the HAL browser, then make a POST request to the "execute" relation. The response or error will be shown in the window.
@@ -1,15 +0,0 @@
1
- # Webhooks
2
-
3
- Allowed methods: GET, DELETE
4
-
5
- ### Testing
6
-
7
- To test a webhook, navigate to the webhook in the HAL browser, then make a POST request to the "execute" relation. The response or error will be shown in the window.
8
-
9
- ### Deleting
10
-
11
- Send a DELETE request to the webhook URL.
12
-
13
- ### Updating
14
-
15
- Send a PUT request to the webhook URL with all fields required for the new webhook.