lib/pact_broker/webhooks/service.rb in pact_broker-2.30.0 vs lib/pact_broker/webhooks/service.rb in pact_broker-2.31.0
- old
+ new
@@ -62,11 +62,11 @@
def self.find_all
webhook_repository.find_all
end
def self.test_execution webhook
- options = { failure_log_message: "Webhook execution failed", show_response: PactBroker.configuration.show_webhook_response?}
+ options = { failure_log_message: "Webhook execution failed", show_response: PactBroker.configuration.show_webhook_response?, base_url: base_url}
verification = nil
if webhook.trigger_on_provider_verification_published?
verification = verification_service.search_for_latest(webhook.consumer_name, webhook.provider_name) || PactBroker::Verifications::PlaceholderVerification.new
end
@@ -124,11 +124,12 @@
begin
triggered_webhook = webhook_repository.create_triggered_webhook(trigger_uuid, webhook, pact, verification, RESOURCE_CREATION)
logger.info "Scheduling job for #{webhook.description} with uuid #{webhook.uuid}"
job_data = {
triggered_webhook: triggered_webhook,
- database_connector: job_database_connector
+ database_connector: job_database_connector,
+ base_url: base_url
}
# Delay slightly to make sure the request transaction has finished before we execute the webhook
Job.perform_in(5, job_data)
rescue StandardError => e
log_error e
@@ -136,9 +137,13 @@
end
end
def self.job_database_connector
Thread.current[:pact_broker_thread_data].database_connector
+ end
+
+ def self.base_url
+ Thread.current[:pact_broker_thread_data].base_url
end
def self.find_latest_triggered_webhooks_for_pact pact
webhook_repository.find_latest_triggered_webhooks_for_pact pact
end