pact_broker 2.74.1 → 2.75.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/.optic/.gitignore +2 -0
  3. data/.optic/api/specification.json +1 -0
  4. data/.optic/ignore +14 -0
  5. data/CHANGELOG.md +19 -0
  6. data/DEVELOPER_SETUP.md +9 -0
  7. data/Dockerfile +1 -0
  8. data/config/database.yml +1 -1
  9. data/db/migrations/20210115_add_webhook_foreign_key_indexes.rb +49 -0
  10. data/db/migrations/20210116_add_context_to_triggered_webhook.rb +11 -0
  11. data/db/migrations/migration_helper.rb +8 -0
  12. data/docker-compose-test.yml +4 -4
  13. data/lib/pact_broker/api.rb +13 -2
  14. data/lib/pact_broker/api/decorators.rb +3 -7
  15. data/lib/pact_broker/api/decorators/configuration.rb +33 -0
  16. data/lib/pact_broker/api/decorators/decorator_context_creator.rb +13 -0
  17. data/lib/pact_broker/api/decorators/pact_collection_decorator.rb +1 -0
  18. data/lib/pact_broker/api/decorators/pacticipant_collection_decorator.rb +2 -3
  19. data/lib/pact_broker/api/decorators/reason_decorator.rb +2 -0
  20. data/lib/pact_broker/api/renderers/html_pact_renderer.rb +2 -2
  21. data/lib/pact_broker/api/resources/all_webhooks.rb +3 -3
  22. data/lib/pact_broker/api/resources/can_i_deploy_badge.rb +1 -1
  23. data/lib/pact_broker/api/resources/dashboard.rb +2 -2
  24. data/lib/pact_broker/api/resources/default_base_resource.rb +37 -12
  25. data/lib/pact_broker/api/resources/error_response_body_generator.rb +41 -0
  26. data/lib/pact_broker/api/resources/group.rb +1 -1
  27. data/lib/pact_broker/api/resources/integrations.rb +1 -1
  28. data/lib/pact_broker/api/resources/label.rb +1 -1
  29. data/lib/pact_broker/api/resources/latest_pact.rb +2 -2
  30. data/lib/pact_broker/api/resources/latest_pacts.rb +1 -1
  31. data/lib/pact_broker/api/resources/latest_verifications_for_consumer_version.rb +2 -2
  32. data/lib/pact_broker/api/resources/matrix.rb +2 -2
  33. data/lib/pact_broker/api/resources/matrix_for_consumer_and_provider.rb +1 -1
  34. data/lib/pact_broker/api/resources/pact.rb +2 -2
  35. data/lib/pact_broker/api/resources/pact_triggered_webhooks.rb +1 -1
  36. data/lib/pact_broker/api/resources/pact_versions.rb +1 -1
  37. data/lib/pact_broker/api/resources/pact_webhooks.rb +3 -3
  38. data/lib/pact_broker/api/resources/pact_webhooks_status.rb +2 -2
  39. data/lib/pact_broker/api/resources/pacticipant.rb +1 -1
  40. data/lib/pact_broker/api/resources/pacticipants.rb +3 -3
  41. data/lib/pact_broker/api/resources/pacticipants_for_label.rb +1 -1
  42. data/lib/pact_broker/api/resources/previous_distinct_pact_version.rb +1 -1
  43. data/lib/pact_broker/api/resources/provider_pacts.rb +1 -7
  44. data/lib/pact_broker/api/resources/provider_pacts_for_verification.rb +2 -2
  45. data/lib/pact_broker/api/resources/relationships.rb +1 -1
  46. data/lib/pact_broker/api/resources/tag.rb +1 -1
  47. data/lib/pact_broker/api/resources/tagged_pact_versions.rb +1 -1
  48. data/lib/pact_broker/api/resources/verification.rb +2 -2
  49. data/lib/pact_broker/api/resources/verification_triggered_webhooks.rb +1 -1
  50. data/lib/pact_broker/api/resources/verifications.rb +1 -1
  51. data/lib/pact_broker/api/resources/version.rb +1 -1
  52. data/lib/pact_broker/api/resources/versions.rb +1 -1
  53. data/lib/pact_broker/api/resources/webhook.rb +2 -2
  54. data/lib/pact_broker/api/resources/webhook_execution.rb +4 -4
  55. data/lib/pact_broker/api/resources/webhook_execution_methods.rb +1 -3
  56. data/lib/pact_broker/api/resources/webhooks.rb +3 -3
  57. data/lib/pact_broker/app.rb +8 -3
  58. data/lib/pact_broker/application_context.rb +41 -0
  59. data/lib/pact_broker/doc/controllers/app.rb +3 -2
  60. data/lib/pact_broker/domain/webhook_request.rb +1 -1
  61. data/lib/pact_broker/error.rb +0 -2
  62. data/lib/pact_broker/errors.rb +28 -0
  63. data/lib/pact_broker/errors/error_logger.rb +25 -0
  64. data/lib/pact_broker/services.rb +106 -31
  65. data/lib/pact_broker/test/http_test_data_builder.rb +35 -0
  66. data/lib/pact_broker/test/test_data_builder.rb +3 -2
  67. data/lib/pact_broker/ui/views/index/_getting-started.haml +1 -1
  68. data/lib/pact_broker/ui/views/index/show-with-tags.haml +16 -16
  69. data/lib/pact_broker/ui/views/index/show.haml +6 -6
  70. data/lib/pact_broker/ui/views/layouts/main.haml +2 -2
  71. data/lib/pact_broker/ui/views/matrix/show.haml +32 -33
  72. data/lib/pact_broker/version.rb +1 -1
  73. data/lib/pact_broker/webhooks/execution_configuration.rb +4 -0
  74. data/lib/pact_broker/webhooks/execution_configuration_creator.rb +14 -0
  75. data/lib/pact_broker/webhooks/repository.rb +3 -2
  76. data/lib/pact_broker/webhooks/service.rb +2 -1
  77. data/lib/pact_broker/webhooks/triggered_webhook.rb +1 -0
  78. data/optic.yml +5 -0
  79. data/pact_broker.gemspec +1 -1
  80. data/public/css/bootstrap-grid.css +3719 -0
  81. data/public/css/bootstrap-grid.css.map +1 -0
  82. data/public/css/bootstrap-grid.min.css +7 -0
  83. data/public/css/bootstrap-grid.min.css.map +1 -0
  84. data/public/css/bootstrap-reboot.css +331 -0
  85. data/public/css/bootstrap-reboot.css.map +1 -0
  86. data/public/css/bootstrap-reboot.min.css +8 -0
  87. data/public/css/bootstrap-reboot.min.css.map +1 -0
  88. data/public/css/bootstrap.css +8885 -5604
  89. data/public/css/bootstrap.css.map +1 -1
  90. data/public/css/bootstrap.min.css +4 -3
  91. data/public/css/bootstrap.min.css.map +1 -1
  92. data/public/images/alert.svg +1 -0
  93. data/public/images/arrow-switch.svg +1 -0
  94. data/public/images/check.svg +1 -0
  95. data/public/images/clock.svg +1 -0
  96. data/public/images/copy.svg +1 -0
  97. data/public/images/kebab-horizontal.svg +1 -0
  98. data/public/javascripts/clipboard.js +3 -3
  99. data/public/javascripts/{jquery-3.3.1.js → jquery-3.5.1.js} +1150 -642
  100. data/public/javascripts/jquery-3.5.1.min.js +2 -0
  101. data/public/javascripts/jquery-3.5.1.min.map +1 -0
  102. data/public/javascripts/matrix.js +2 -2
  103. data/public/js/bootstrap.bundle.js +7013 -0
  104. data/public/js/bootstrap.bundle.js.map +1 -0
  105. data/public/js/bootstrap.bundle.min.js +7 -0
  106. data/public/js/bootstrap.bundle.min.js.map +1 -0
  107. data/public/js/bootstrap.js +3862 -1804
  108. data/public/js/bootstrap.js.map +1 -0
  109. data/public/js/bootstrap.min.js +6 -6
  110. data/public/js/bootstrap.min.js.map +1 -0
  111. data/public/stylesheets/index.css +56 -3
  112. data/public/stylesheets/matrix.css +55 -5
  113. data/public/stylesheets/pact.css +14 -0
  114. data/regression/.gitignore +1 -0
  115. data/regression/can_i_deploy_spec.rb +42 -0
  116. data/regression/regression_helper.rb +37 -0
  117. data/regression/script/approval-all.sh +6 -0
  118. data/script/exercise-api-for-optic.sh +3 -0
  119. data/spec/lib/pact_broker/api/resources/can_i_deploy_badge_spec.rb +1 -1
  120. data/spec/lib/pact_broker/api/resources/default_base_resource_spec.rb +65 -5
  121. data/spec/lib/pact_broker/api/resources/error_response_body_generator_spec.rb +69 -0
  122. data/spec/lib/pact_broker/db/log_quietener_spec.rb +1 -1
  123. data/spec/lib/pact_broker/errors/error_logger_spec.rb +62 -0
  124. data/spec/lib/pact_broker/errors_spec.rb +55 -0
  125. data/spec/lib/pact_broker/webhooks/repository_spec.rb +5 -2
  126. data/spec/lib/pact_broker/webhooks/service_spec.rb +2 -1
  127. data/tasks/rspec.rake +6 -0
  128. metadata +54 -17
  129. data/public/css/bootstrap-theme.css +0 -587
  130. data/public/css/bootstrap-theme.css.map +0 -1
  131. data/public/css/bootstrap-theme.min.css +0 -6
  132. data/public/css/bootstrap-theme.min.css.map +0 -1
  133. data/public/fonts/glyphicons-halflings-regular.svg +0 -288
  134. data/public/javascripts/jquery-3.3.1.min.js +0 -2
  135. data/public/javascripts/jquery-3.3.1.min.map +0 -1
  136. data/spec/lib/pact_broker/api/resources/error_handler_spec.rb +0 -211
@@ -43,11 +43,11 @@ module PactBroker
43
43
 
44
44
  def from_json
45
45
  saved_webhook = webhook_service.create next_uuid, webhook, consumer, provider
46
- response.body = Decorators::WebhookDecorator.new(saved_webhook).to_json(decorator_options)
46
+ response.body = decorator_class(:webhook_decorator).new(saved_webhook).to_json(decorator_options)
47
47
  end
48
48
 
49
49
  def to_json
50
- Decorators::WebhooksDecorator.new(webhooks).to_json(decorator_options(resource_title: 'Pact webhooks'))
50
+ decorator_class(:webhooks_decorator).new(webhooks).to_json(decorator_options(resource_title: 'Pact webhooks'))
51
51
  end
52
52
 
53
53
  def policy_name
@@ -61,7 +61,7 @@ module PactBroker
61
61
  end
62
62
 
63
63
  def webhook
64
- @webhook ||= Decorators::WebhookDecorator.new(PactBroker::Domain::Webhook.new).from_json(request_body)
64
+ @webhook ||= decorator_class(:webhook_decorator).new(PactBroker::Domain::Webhook.new).from_json(request_body)
65
65
  end
66
66
 
67
67
  def next_uuid
@@ -32,6 +32,8 @@ module PactBroker
32
32
  @cascade_apps = []
33
33
  @make_it_later_api_auth = ::Rack::PactBroker::ConfigurableMakeItLater.new(Rack::PactBroker::NoAuth)
34
34
  @make_it_later_ui_auth = ::Rack::PactBroker::ConfigurableMakeItLater.new(Rack::PactBroker::NoAuth)
35
+ # Can only be required after database connection has been made because the decorators rely on the Sequel models
36
+ @create_pact_broker_api_block = ->() { require 'pact_broker/api'; PactBroker::API }
35
37
  @configuration = PactBroker.configuration
36
38
  yield configuration
37
39
  post_configure
@@ -68,13 +70,17 @@ module PactBroker
68
70
  @custom_api = custom_api
69
71
  end
70
72
 
73
+ def use_to_create_pact_broker_api &block
74
+ @create_pact_broker_api_block = block
75
+ end
76
+
71
77
  def call env
72
78
  running_app.call env
73
79
  end
74
80
 
75
81
  private
76
82
 
77
- attr_reader :custom_ui
83
+ attr_reader :custom_ui, :create_pact_broker_api_block
78
84
 
79
85
  def post_configure
80
86
  configure_logger
@@ -207,8 +213,7 @@ module PactBroker
207
213
 
208
214
  def build_api
209
215
  logger.info "Mounting PactBroker::API"
210
- require 'pact_broker/api'
211
- api_apps = [PactBroker::API]
216
+ api_apps = [create_pact_broker_api_block.call]
212
217
  api_apps.unshift(@custom_api) if @custom_api
213
218
  builder = ::Rack::Builder.new
214
219
  builder.use @make_it_later_api_auth
@@ -0,0 +1,41 @@
1
+ require 'pact_broker/api/decorators/configuration'
2
+ require 'pact_broker/api/decorators/decorator_context_creator'
3
+ require 'pact_broker/webhooks/execution_configuration_creator'
4
+ require 'pact_broker/errors/error_logger'
5
+ require 'pact_broker/api/resources/error_response_body_generator'
6
+
7
+ module PactBroker
8
+ class ApplicationContext
9
+ attr_reader :decorator_configuration,
10
+ :decorator_context_creator,
11
+ :webhook_execution_configuration_creator,
12
+ :resource_authorizer,
13
+ :before_resource,
14
+ :after_resource,
15
+ :error_logger,
16
+ :error_response_body_generator
17
+
18
+ def initialize(params = {})
19
+ params_with_defaults = {
20
+ decorator_configuration: PactBroker::Api::Decorators::Configuration.default_configuration,
21
+ decorator_context_creator: PactBroker::Api::Decorators::DecoratorContextCreator,
22
+ webhook_execution_configuration_creator: PactBroker::Webhooks::ExecutionConfigurationCreator,
23
+ error_logger: PactBroker::Errors::ErrorLogger,
24
+ error_response_body_generator: PactBroker::Api::Resources::ErrorResponseBodyGenerator
25
+ }.merge(params)
26
+
27
+ @decorator_configuration = params_with_defaults[:decorator_configuration]
28
+ @decorator_context_creator = params_with_defaults[:decorator_context_creator]
29
+ @webhook_execution_configuration_creator = params_with_defaults[:webhook_execution_configuration_creator]
30
+ @resource_authorizer = params_with_defaults[:resource_authorizer]
31
+ @before_resource = params_with_defaults[:before_resource]
32
+ @after_resource = params_with_defaults[:after_resource]
33
+ @error_logger = params_with_defaults[:error_logger]
34
+ @error_response_body_generator = params_with_defaults[:error_response_body_generator]
35
+ end
36
+
37
+ def self.default_application_context(overrides = {})
38
+ ApplicationContext.new(overrides)
39
+ end
40
+ end
41
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'padrino-core'
2
3
  require 'redcarpet'
3
4
 
@@ -50,9 +51,9 @@ module PactBroker
50
51
  # https://www.acunetix.com/blog/articles/automated-detection-of-host-header-attacks/
51
52
  # Either use the explicitly configured base url or an empty string,
52
53
  # rather than request.base_url, which uses the X-Forwarded headers.
53
- PactBroker.configuration.base_url || ''
54
+ env["pactbroker.base_url"] || PactBroker.configuration.base_url || ''
54
55
  end
55
56
  end
56
57
  end
57
58
  end
58
- end
59
+ end
@@ -51,7 +51,7 @@ module PactBroker
51
51
  end
52
52
 
53
53
  def execute
54
- options = PactBroker::BuildHttpOptions.call(uri)
54
+ options = PactBroker::BuildHttpOptions.call(uri).merge(read_timeout: 15, open_timeout: 15)
55
55
  req = http_request
56
56
  Net::HTTP.start(uri.hostname, uri.port, :ENV, options) do |http|
57
57
  http.request req
@@ -1,6 +1,4 @@
1
1
  module PactBroker
2
-
3
2
  class Error < StandardError; end
4
3
  class TestError < StandardError; end
5
-
6
4
  end
@@ -0,0 +1,28 @@
1
+ require 'pact_broker/configuration'
2
+ require 'pact_broker/error'
3
+ require 'pact_broker/logging'
4
+ require 'securerandom'
5
+
6
+ module PactBroker
7
+ module Errors
8
+ include PactBroker::Logging
9
+
10
+ def self.generate_error_reference
11
+ SecureRandom.urlsafe_base64.gsub(/[^a-z]/i, '')[0,10]
12
+ end
13
+
14
+ def self.reportable_error?(error)
15
+ !error.is_a?(PactBroker::Error) && !error.is_a?(JSON::JSONError)
16
+ end
17
+
18
+ def self.report error, error_reference, request
19
+ PactBroker.configuration.api_error_reporters.each do | error_notifier |
20
+ begin
21
+ error_notifier.call(error, env: request.env, error_reference: error_reference)
22
+ rescue StandardError => e
23
+ log_error(e, "Error executing api_error_reporter")
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ require 'pact_broker/configuration'
2
+ require 'pact_broker/logging'
3
+
4
+ module PactBroker
5
+ module Errors
6
+ class ErrorLogger
7
+ include PactBroker::Logging
8
+
9
+ # don't need the env, just in case PF needs it
10
+ def self.call(error, error_reference, env = {})
11
+ if log_as_warning?(error)
12
+ logger.warn("Error reference #{error_reference}", error)
13
+ elsif PactBroker::Errors.reportable_error?(error)
14
+ log_error(error, "Error reference #{error_reference}")
15
+ else
16
+ logger.info("Error reference #{error_reference}", error)
17
+ end
18
+ end
19
+
20
+ def self.log_as_warning?(error)
21
+ PactBroker.configuration.warning_error_classes.any? { |clazz| error.is_a?(clazz) || error.cause&.is_a?(clazz) }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,80 +1,155 @@
1
1
  module PactBroker
2
2
  module Services
3
3
 
4
+ FACTORIES = {}
5
+
6
+ extend self
7
+
8
+ def register_service(name, &block)
9
+ FACTORIES[name] = block
10
+ end
11
+
12
+ def get(name)
13
+ FACTORIES[name].call
14
+ end
15
+
4
16
  def index_service
5
- require 'pact_broker/index/service'
6
- Index::Service
17
+ get(:index_service)
7
18
  end
8
19
 
9
20
  def pact_service
10
- # TODO work out how to fix circular dependency
11
- require 'pact_broker/pacts/service'
12
- Pacts::Service
21
+ get(:pact_service)
13
22
  end
14
23
 
15
24
  def pacticipant_service
16
- require 'pact_broker/pacticipants/service'
17
- Pacticipants::Service
25
+ get(:pacticipant_service)
18
26
  end
19
27
 
20
28
  def tag_service
21
- require 'pact_broker/tags/service'
22
- Tags::Service
29
+ get(:tag_service)
23
30
  end
24
31
 
25
32
  def label_service
26
- require 'pact_broker/labels/service'
27
- Labels::Service
33
+ get(:label_service)
28
34
  end
29
35
 
30
36
  def group_service
31
- require 'pact_broker/groups/service'
32
- Groups::Service
37
+ get(:group_service)
33
38
  end
34
39
 
35
40
  def webhook_service
36
- require 'pact_broker/webhooks/service'
37
- Webhooks::Service
41
+ get(:webhook_service)
38
42
  end
39
43
 
40
44
  def version_service
41
- require 'pact_broker/versions/service'
42
- Versions::Service
45
+ get(:version_service)
43
46
  end
44
47
 
45
48
  def verification_service
46
- require 'pact_broker/verifications/service'
47
- Verifications::Service
49
+ get(:verification_service)
48
50
  end
49
51
 
50
52
  def badge_service
51
- require 'pact_broker/badges/service'
52
- Badges::Service
53
+ get(:badge_service)
53
54
  end
54
55
 
55
56
  def matrix_service
56
- require 'pact_broker/matrix/service'
57
- Matrix::Service
57
+ get(:matrix_service)
58
58
  end
59
59
 
60
60
  def certificate_service
61
- require 'pact_broker/certificates/service'
62
- Certificates::Service
61
+ get(:certificate_service)
63
62
  end
64
63
 
65
64
  def integration_service
66
- require 'pact_broker/integrations/service'
67
- Integrations::Service
65
+ get(:integration_service)
68
66
  end
69
67
 
70
68
  def webhook_trigger_service
71
- require 'pact_broker/webhooks/trigger_service'
72
- Webhooks::TriggerService
69
+ get(:webhook_trigger_service)
73
70
  end
74
71
 
75
72
  def metrics_service
76
- require 'pact_broker/metrics/service'
77
- Metrics::Service
73
+ get(:metrics_service)
74
+ end
75
+
76
+ def register_default_services
77
+ register_service(:index_service) do
78
+ require 'pact_broker/index/service'
79
+ Index::Service
80
+ end
81
+
82
+ register_service(:metrics_service) do
83
+ require 'pact_broker/metrics/service'
84
+ Metrics::Service
85
+ end
86
+
87
+ register_service(:matrix_service) do
88
+ require 'pact_broker/matrix/service'
89
+ Matrix::Service
90
+ end
91
+
92
+ register_service(:pact_service) do
93
+ require 'pact_broker/pacts/service'
94
+ Pacts::Service
95
+ end
96
+
97
+ register_service(:pacticipant_service) do
98
+ require 'pact_broker/pacticipants/service'
99
+ Pacticipants::Service
100
+ end
101
+
102
+ register_service(:tag_service) do
103
+ require 'pact_broker/tags/service'
104
+ Tags::Service
105
+ end
106
+
107
+ register_service(:label_service) do
108
+ require 'pact_broker/labels/service'
109
+ Labels::Service
110
+ end
111
+
112
+ register_service(:group_service) do
113
+ require 'pact_broker/groups/service'
114
+ Groups::Service
115
+ end
116
+
117
+ register_service(:webhook_service) do
118
+ require 'pact_broker/webhooks/service'
119
+ Webhooks::Service
120
+ end
121
+
122
+ register_service(:version_service) do
123
+ require 'pact_broker/versions/service'
124
+ Versions::Service
125
+ end
126
+
127
+ register_service(:verification_service) do
128
+ require 'pact_broker/verifications/service'
129
+ Verifications::Service
130
+ end
131
+
132
+ register_service(:badge_service) do
133
+ require 'pact_broker/badges/service'
134
+ Badges::Service
135
+ end
136
+
137
+ register_service(:certificate_service) do
138
+ require 'pact_broker/certificates/service'
139
+ Certificates::Service
140
+ end
141
+
142
+ register_service(:integration_service) do
143
+ require 'pact_broker/integrations/service'
144
+ Integrations::Service
145
+ end
146
+
147
+ register_service(:webhook_trigger_service) do
148
+ require 'pact_broker/webhooks/trigger_service'
149
+ Webhooks::TriggerService
150
+ end
78
151
  end
79
152
  end
80
153
  end
154
+
155
+ PactBroker::Services.register_default_services
@@ -137,6 +137,33 @@ module PactBroker
137
137
  self
138
138
  end
139
139
 
140
+ def create_global_webhook_for_contract_changed(uuid: nil, url: "https://postman-echo.com/post")
141
+ puts "Creating global webhook for contract changed event with uuid #{uuid}"
142
+ uuid ||= SecureRandom.uuid
143
+ request_body = {
144
+ "description" => "A webhook for all consumers and providers",
145
+ "events" => [{
146
+ "name" => "contract_content_changed"
147
+ }],
148
+ "request" => {
149
+ "method" => "POST",
150
+ "url" => url
151
+ }
152
+ }
153
+ path = "/webhooks/#{uuid}"
154
+ response = client.put(path, request_body.to_json).tap { |response| check_for_error(response) }
155
+ separate
156
+ self
157
+ end
158
+
159
+ def delete_webhook(uuid:)
160
+ puts "Deleting webhook with uuid #{uuid}"
161
+ path = "/webhooks/#{uuid}"
162
+ response = client.delete(path).tap { |response| check_for_error(response) }
163
+ separate
164
+ self
165
+ end
166
+
140
167
  def print_pacts_for_verification_response
141
168
  puts @pacts_for_verification_response.body
142
169
  self
@@ -158,6 +185,13 @@ module PactBroker
158
185
  self
159
186
  end
160
187
 
188
+ def delete_pacticipant(name)
189
+ puts "Deleting pacticipant #{name}"
190
+ @publish_pact_response = client.delete("/pacticipants/#{encode(name)}").tap { |response| check_for_error(response) }
191
+ separate
192
+ self
193
+ end
194
+
161
195
  def generate_content(consumer_name, provider_name, content_id)
162
196
  {
163
197
  consumer: {
@@ -168,6 +202,7 @@ module PactBroker
168
202
  },
169
203
  interactions: [
170
204
  {
205
+ description: "a request",
171
206
  request: {
172
207
  method: "GET",
173
208
  path: "/things/#{content_id}"
@@ -319,9 +319,10 @@ module PactBroker
319
319
  trigger_uuid = params[:trigger_uuid] || webhook_service.next_uuid
320
320
  event_name = params.key?(:event_name) ? params[:event_name] : @webhook.events.first.name # could be nil, for backwards compatibility
321
321
  verification = @webhook.trigger_on_provider_verification_published? ? @verification : nil
322
- @triggered_webhook = webhook_repository.create_triggered_webhook trigger_uuid, @webhook, @pact, verification, PactBroker::Webhooks::Service::RESOURCE_CREATION, event_name
322
+ event_context = params[:event_context]
323
+ @triggered_webhook = webhook_repository.create_triggered_webhook(trigger_uuid, @webhook, @pact, verification, PactBroker::Webhooks::Service::RESOURCE_CREATION, event_name, event_context)
323
324
  @triggered_webhook.update(status: params[:status]) if params[:status]
324
- set_created_at_if_set params[:created_at], :triggered_webhooks, {id: @triggered_webhook.id}
325
+ set_created_at_if_set params[:created_at], :triggered_webhooks, { id: @triggered_webhook.id }
325
326
  self
326
327
  end
327
328