From 4d4bc4b41fe3f0c2f2787beb83b3353df114e7c0 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Mon, 16 Aug 2021 10:20:02 +1000 Subject: [PATCH] feat: add support for creating webhooks with event contract_requiring_verification_published (feature toggled off) --- lib/pact_broker/client/cli/webhook_commands.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/pact_broker/client/cli/webhook_commands.rb b/lib/pact_broker/client/cli/webhook_commands.rb index 9a152260..86017cbd 100644 --- a/lib/pact_broker/client/cli/webhook_commands.rb +++ b/lib/pact_broker/client/cli/webhook_commands.rb @@ -22,6 +22,9 @@ def self.shared_options_for_webhook_commands method_option :provider_verification_published, type: :boolean, desc: "Trigger this webhook when a provider verification result is published" method_option :provider_verification_failed, type: :boolean, desc: "Trigger this webhook when a failed provider verification result is published" method_option :provider_verification_succeeded, type: :boolean, desc: "Trigger this webhook when a successful provider verification result is published" + if ENV.fetch("PACT_BROKER_FEATURES", "").include?("contract_requiring_verification_published") + method_option :contract_requiring_verification_published, type: :boolean, desc: "Trigger this webhook when a contract is published that requires verification" + end method_option :team_uuid, banner: "UUID", desc: "UUID of the Pactflow team to which the webhook should be assigned (Pactflow only)" shared_authentication_options end @@ -62,12 +65,14 @@ def parse_webhook_events events << 'provider_verification_published' if options.provider_verification_published events << 'provider_verification_succeeded' if options.provider_verification_succeeded events << 'provider_verification_failed' if options.provider_verification_failed + events << 'contract_requiring_verification_published' if options.contract_requiring_verification_published events end def parse_webhook_options(webhook_url) events = parse_webhook_events + # TODO update for contract_requiring_verification_published when released if events.size == 0 raise WebhookCreationError.new("You must specify at least one of --contract-content-changed, --contract-published, --provider-verification-published, --provider-verification-succeeded or --provider-verification-failed") end