From 35434a31f10cc88f145df4b2d16a9b6c46f9ef3c Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Wed, 2 Aug 2023 10:29:43 +1000 Subject: [PATCH] chore: log details of contract publication --- lib/pact_broker/contracts/contracts_to_publish.rb | 8 ++++++++ lib/pact_broker/contracts/service.rb | 1 + 2 files changed, 9 insertions(+) diff --git a/lib/pact_broker/contracts/contracts_to_publish.rb b/lib/pact_broker/contracts/contracts_to_publish.rb index 3440832f2..4746ed1e4 100644 --- a/lib/pact_broker/contracts/contracts_to_publish.rb +++ b/lib/pact_broker/contracts/contracts_to_publish.rb @@ -10,6 +10,14 @@ def self.from_hash(pacticipant_name: nil, pacticipant_version_number: nil, tags: def pacticipant_names contracts.flat_map(&:pacticipant_names).uniq end + + def provider_names + contracts.flat_map(&:provider_name).uniq + end + + def logging_info + to_h.slice(:pacticipant_name, :pacticipant_version_number, :tags, :branch, :build_url).merge(provider_names: provider_names) + end end end end diff --git a/lib/pact_broker/contracts/service.rb b/lib/pact_broker/contracts/service.rb index 461b6fd9d..e13bff71c 100644 --- a/lib/pact_broker/contracts/service.rb +++ b/lib/pact_broker/contracts/service.rb @@ -31,6 +31,7 @@ def triggered_webhooks_created_for_event(params) end def publish(parsed_contracts, base_url: ) + logger.info("Publishing contracts", parsed_contracts.logging_info) version, version_notices = create_version(parsed_contracts) tags = create_tags(parsed_contracts, version) pacts, pact_notices = create_pacts(parsed_contracts, base_url)