Skip to content

Commit

Permalink
feat: allow pacts to be published using the old API by setting the en…
Browse files Browse the repository at this point in the history
…vironment variable PACT_BROKER_FEATURES=publish_pacts_using_old_api
  • Loading branch information
bethesque committed Sep 29, 2021
1 parent 8c732c3 commit 7c34132
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/pact_broker/client/publish_pacts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def initialize pact_broker_base_url, pact_file_paths, consumer_version_params, o

def call
validate
if index_resource.can?("pb:publish-contracts")
if !force_use_old_api? && index_resource.can?("pb:publish-contracts")
publish_pacts
PactBroker::Client::CommandResult.new(success?, message)
else
Expand All @@ -40,6 +40,10 @@ def call

attr_reader :pact_broker_base_url, :pact_file_paths, :consumer_version_params, :consumer_version_number, :branch, :tags, :build_url, :options, :pact_broker_client_options, :response_entities

def force_use_old_api?
ENV.fetch("PACT_BROKER_FEATURES", "").include?("publish_pacts_using_old_api")
end

def request_body_for(consumer_name)
{
pacticipantName: consumer_name,
Expand Down

0 comments on commit 7c34132

Please sign in to comment.