pact_broker-client 1.31.0 → 1.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +23 -0
  3. data/CHANGELOG.md +49 -0
  4. data/README.md +15 -3
  5. data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +151 -8
  6. data/lib/pact_broker/client/base_client.rb +11 -9
  7. data/lib/pact_broker/client/cli/broker.rb +31 -5
  8. data/lib/pact_broker/client/cli/can_i_deploy_long_desc.txt +18 -9
  9. data/lib/pact_broker/client/git.rb +40 -22
  10. data/lib/pact_broker/client/matrix.rb +5 -2
  11. data/lib/pact_broker/client/matrix/text_formatter.rb +44 -11
  12. data/lib/pact_broker/client/pacts/list_latest_versions.rb +1 -1
  13. data/lib/pact_broker/client/publish_pacts.rb +92 -14
  14. data/lib/pact_broker/client/tasks/publication_task.rb +35 -6
  15. data/lib/pact_broker/client/version.rb +1 -1
  16. data/pact-broker-client.gemspec +2 -0
  17. data/script/publish-pact.sh +7 -1
  18. data/spec/lib/pact_broker/client/base_client_spec.rb +62 -4
  19. data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +13 -2
  20. data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +108 -12
  21. data/spec/lib/pact_broker/client/git_spec.rb +39 -2
  22. data/spec/lib/pact_broker/client/matrix/text_formatter_spec.rb +29 -4
  23. data/spec/lib/pact_broker/client/publish_pacts_spec.rb +119 -7
  24. data/spec/lib/pact_broker/client/tasks/publication_task_spec.rb +88 -10
  25. data/spec/pacts/pact_broker_client-pact_broker.json +154 -8
  26. data/spec/service_providers/pact_broker_client_create_version_spec.rb +89 -0
  27. data/spec/service_providers/pact_broker_client_matrix_spec.rb +4 -0
  28. data/spec/service_providers/pact_broker_client_versions_spec.rb +1 -2
  29. data/spec/support/matrix.json +6 -1
  30. data/spec/support/matrix.txt +3 -3
  31. data/spec/support/matrix_error.txt +3 -3
  32. data/spec/support/matrix_with_results.txt +10 -0
  33. data/tasks/pact.rake +2 -0
  34. metadata +36 -4
  35. data/.travis.yml +0 -11
@@ -19,17 +19,27 @@ Using a specific version is the easiest way to ensure you get an accurate respon
19
19
 
20
20
  #### Recommended usage - allowing the Pact Broker to automatically determine the dependencies
21
21
 
22
- Prerequisite: if you would like the Pact Broker to calculate the dependencies for you when you want to deploy an application into a given environment, you will need to let the Broker know which version of each application is in that environment. To do this, the relevant application version resource in the Broker will need to be "tagged" with the name of the environment during the deployment process:
22
+ Prerequisite: if you would like the Pact Broker to calculate the dependencies for you when you want to deploy an application into a given environment, you will need to let the Broker know which version of each application is in that environment.
23
+
24
+ How you do this depends on the version of the Pact Broker you are running.
25
+
26
+ If you are using a Broker version where deployment versions are supported, then you would notify the Broker of the deployment of this application version like so:
27
+
28
+ $ pact-broker record-deployment --pacticipant Foo --version 173153ae0 --environment test
29
+
30
+ This assumes that you have already set up an environment named "test" in the Broker.
31
+
32
+ If you are using a Broker version that does not support deployment environments, then you will need to use tags to notify the broker of the deployment of this application version, like so:
23
33
 
24
34
  $ pact-broker create-version-tag --pacticipant Foo --version 173153ae0 --tag test
25
35
 
26
- This allows you to use the following simple command to find out if you are safe to deploy:
36
+ Once you have configured your build to notify the Pact Broker of the successful deployment using either method describe above, you can use the following simple command to find out if you are safe to deploy (use either `--to` or `--to-environment` as supported):
27
37
 
28
- $ pact-broker can-i-deploy --pacticipant PACTICIPANT --version VERSION \
29
- --to ENVIRONMENT \
38
+ $ pact-broker can-i-deploy --pacticipant PACTICIPANT --version VERSION
39
+ [--to-environment ENVIRONMENT | --to ENVIRONMENT_TAG ]
30
40
  --broker-base-url BROKER_BASE_URL
31
41
 
32
- If the `--to` tag is omitted, then the query will return the compatiblity with the overall latest version of each of the other applications.
42
+ If the `--to` or `--to-environment` options are omitted, then the query will return the compatiblity with the overall latest version of each of the other applications.
33
43
 
34
44
  Examples:
35
45
 
@@ -38,7 +48,7 @@ Can I deploy version 173153ae0 of application Foo to the test environment?
38
48
 
39
49
 
40
50
  $ pact-broker can-i-deploy --pacticipant Foo --version 173153ae0 \
41
- --to test \
51
+ --to-environment test \
42
52
  --broker-base-url https://my-pact-broker
43
53
 
44
54
 
@@ -56,21 +66,20 @@ Can I deploy the latest version of the application Foo that has the tag "test" t
56
66
  --broker-base-url https://my-pact-broker
57
67
 
58
68
 
59
-
60
69
  #### Alternate usage - specifying dependencies explicitly
61
70
 
62
71
  If you are unable to use tags, or there is some other limitation that stops you from using the recommended approach, you can specify one or more of the dependencies explictly. You must also do this if you want to use the `--all TAG` option for any of the pacticipants.
63
72
 
64
73
  You can specify as many application versions as you like, and you can even specify multiple versions of the same application (repeat the `--pacticipant` name and supply a different version.)
65
74
 
66
- You can use explictly declared dependencies with or without the `--to ENVIRONMENT`. For example, if you declare two (or more) application versions with no `--to ENVIRONMENT`, then only the applications you specify will be taken into account when determining if it is safe to deploy. If you declare two (or more) application versions _as well as_ a `--to ENVIRONMENT`, then the Pact Broker will work out what integrations your declared applications will have in that environment when determining if it safe to deploy. When using this script for a production release, and you are using tags, it is always the most future-proof option to use the `--to` if possible, as it will catch any newly added consumers or providers.
75
+ You can use explictly declared dependencies with or without the `--to ENVIRONMENT_TAG`. For example, if you declare two (or more) application versions with no `--to ENVIRONMENT_TAG`, then only the applications you specify will be taken into account when determining if it is safe to deploy. If you declare two (or more) application versions _as well as_ a `--to ENVIRONMENT`, then the Pact Broker will work out what integrations your declared applications will have in that environment when determining if it safe to deploy. When using this script for a production release, and you are using tags, it is always the most future-proof option to use the `--to` if possible, as it will catch any newly added consumers or providers.
67
76
 
68
77
  If you are finding that your dependencies are not being automatically included when you supply multiple pacticipant versions, please upgrade to the latest version of the Pact Broker, as this is a more recently added feature.
69
78
 
70
79
 
71
80
  $ pact-broker can-i-deploy --pacticipant PACTICIPANT_1 [--version VERSION_1 | --latest [TAG_1] | --all TAG_1] \
72
81
  --pacticipant PACTICIPANT_2 [--version VERSION_2 | --latest [TAG_2] | --all TAG_2] \
73
- [--to ENVIRONMENT] \
82
+ [--to-environment ENVIRONMENT | --to ENVIRONMENT_TAG] \
74
83
  --broker-base-url BROKER_BASE_URL
75
84
 
76
85
  Examples:
@@ -16,19 +16,23 @@ BITBUCKET_BRANCH BITBUCKET_COMMIT https://confluence.atlassian.com/bitbucket/var
16
16
  =end
17
17
 
18
18
  # Keep in sync with pact-provider-verifier/lib/pact/provider_verifier/git.rb
19
+
20
+ # `git name-rev --name-only HEAD` provides "tags/v1.35.0^0"
19
21
  module PactBroker
20
22
  module Client
21
23
  module Git
22
- COMMAND = 'git name-rev --name-only HEAD'.freeze
24
+ COMMAND = 'git rev-parse --abbrev-ref HEAD'.freeze
23
25
  BRANCH_ENV_VAR_NAMES = %w{BUILDKITE_BRANCH CIRCLE_BRANCH TRAVIS_BRANCH GIT_BRANCH GIT_LOCAL_BRANCH APPVEYOR_REPO_BRANCH CI_COMMIT_REF_NAME BITBUCKET_BRANCH}.freeze
24
26
  COMMIT_ENV_VAR_NAMES = %w{BUILDKITE_COMMIT CIRCLE_SHA1 TRAVIS_COMMIT GIT_COMMIT APPVEYOR_REPO_COMMIT CI_COMMIT_ID BITBUCKET_COMMIT}
25
27
 
28
+ BUILD_URL_ENV_VAR_NAMES = %w{BUILDKITE_BUILD_URL CIRCLE_BUILD_URL TRAVIS_BUILD_WEB_URL BUILD_URL }
29
+
26
30
  def self.commit
27
31
  find_commit_from_env_vars
28
32
  end
29
33
 
30
- def self.branch
31
- find_branch_from_env_vars || branch_from_git_command
34
+ def self.branch(options)
35
+ find_branch_from_known_env_vars || find_branch_from_env_var_ending_with_branch || branch_from_git_command(options[:raise_error])
32
36
  end
33
37
 
34
38
  # private
@@ -37,10 +41,21 @@ module PactBroker
37
41
  COMMIT_ENV_VAR_NAMES.collect { |env_var_name| value_from_env_var(env_var_name) }.compact.first
38
42
  end
39
43
 
40
- def self.find_branch_from_env_vars
44
+ def self.find_branch_from_known_env_vars
41
45
  BRANCH_ENV_VAR_NAMES.collect { |env_var_name| value_from_env_var(env_var_name) }.compact.first
42
46
  end
43
47
 
48
+ def self.find_branch_from_env_var_ending_with_branch
49
+ values = ENV.keys
50
+ .select{ |env_var_name| env_var_name.end_with?("_BRANCH") }
51
+ .collect{ |env_var_name| value_from_env_var(env_var_name) }.compact
52
+ if values.size == 1
53
+ values.first
54
+ else
55
+ nil
56
+ end
57
+ end
58
+
44
59
  def self.value_from_env_var(env_var_name)
45
60
  val = ENV[env_var_name]
46
61
  if val && val.strip.size > 0
@@ -50,24 +65,10 @@ module PactBroker
50
65
  end
51
66
  end
52
67
 
53
- def self.branch_from_git_command
54
- branch_names = nil
55
- begin
56
- branch_names = execute_git_command
57
- .split("\n")
58
- .collect(&:strip)
59
- .reject(&:empty?)
60
- .collect(&:split)
61
- .collect(&:first)
62
- .collect{ |line| line.gsub(/^origin\//, '') }
63
- .reject{ |line| line == "HEAD" }
64
-
65
- rescue StandardError => e
66
- raise PactBroker::Client::Error, "Could not determine current git branch using command `#{COMMAND}`. #{e.class} #{e.message}"
67
- end
68
-
69
- validate_branch_names(branch_names)
70
- branch_names[0]
68
+ def self.branch_from_git_command(raise_error)
69
+ branch_names = execute_and_parse_command(raise_error)
70
+ validate_branch_names(branch_names) if raise_error
71
+ branch_names.size == 1 ? branch_names[0] : nil
71
72
  end
72
73
 
73
74
  def self.validate_branch_names(branch_names)
@@ -83,6 +84,23 @@ module PactBroker
83
84
  def self.execute_git_command
84
85
  `#{COMMAND}`
85
86
  end
87
+
88
+ def self.execute_and_parse_command(raise_error)
89
+ execute_git_command
90
+ .split("\n")
91
+ .collect(&:strip)
92
+ .reject(&:empty?)
93
+ .collect(&:split)
94
+ .collect(&:first)
95
+ .collect{ |line| line.gsub(/^origin\//, '') }
96
+ .reject{ |line| line == "HEAD" }
97
+ rescue StandardError => e
98
+ if raise_error
99
+ raise PactBroker::Client::Error, "Could not determine current git branch using command `#{COMMAND}`. #{e.class} #{e.message}"
100
+ else
101
+ return []
102
+ end
103
+ end
86
104
  end
87
105
  end
88
106
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'base_client'
2
4
  require 'pact_broker/client/matrix/resource'
3
5
 
@@ -39,7 +41,7 @@ module PactBroker
39
41
  response.body
40
42
  end
41
43
  rescue
42
- raise Error.new(response.body)
44
+ raise Error.new("status=#{response.code} #{response.body}")
43
45
  end
44
46
  raise Error.new(error_message)
45
47
  end
@@ -51,10 +53,11 @@ module PactBroker
51
53
  opts[:success] = [*options[:success]]
52
54
  end
53
55
  opts[:limit] = options[:limit] if options[:limit]
56
+ opts[:environment] = options[:to_environment] if options[:to_environment]
54
57
  if options[:to_tag]
55
58
  opts[:latest] = 'true'
56
59
  opts[:tag] = options[:to_tag]
57
- elsif selectors.size == 1
60
+ elsif selectors.size == 1 && !options[:to_environment]
58
61
  opts[:latest] = 'true'
59
62
  end
60
63
  opts
@@ -1,41 +1,74 @@
1
1
  require 'table_print'
2
+ require 'dig_rb'
2
3
 
3
4
  module PactBroker
4
5
  module Client
5
6
  class Matrix
6
7
  class TextFormatter
7
8
 
8
- Line = Struct.new(:consumer, :consumer_version, :provider, :provider_version, :success)
9
+ Line = Struct.new(:consumer, :consumer_version, :provider, :provider_version, :success, :ref)
9
10
 
10
11
  OPTIONS = [
11
12
  { consumer: {} },
12
13
  { consumer_version: {display_name: 'C.VERSION'} },
13
14
  { provider: {} },
14
15
  { provider_version: {display_name: 'P.VERSION'} },
15
- { success: {display_name: 'SUCCESS?'} }
16
+ { success: {display_name: 'SUCCESS?'} },
17
+ { ref: { display_name: 'RESULT#' }}
16
18
  ]
17
19
 
18
20
  def self.call(matrix)
19
21
  matrix_rows = matrix[:matrix]
20
22
  return "" if matrix_rows.size == 0
21
- data = matrix_rows.collect do | line |
23
+ verification_result_number = 0
24
+ data = matrix_rows.each_with_index.collect do | line |
25
+ has_verification_result_url = lookup(line, nil, :verificationResult, :_links, :self, :href)
26
+ if has_verification_result_url
27
+ verification_result_number += 1
28
+ end
22
29
  Line.new(
23
- lookup(line, :consumer, :name),
24
- lookup(line, :consumer, :version, :number),
25
- lookup(line, :provider, :name),
26
- lookup(line, :provider, :version, :number),
27
- lookup(line, :verificationResult, :success).to_s
30
+ lookup(line, "???", :consumer, :name),
31
+ lookup(line, "???", :consumer, :version, :number),
32
+ lookup(line, "???", :provider, :name) ,
33
+ lookup(line, "???", :provider, :version, :number),
34
+ (lookup(line, "???", :verificationResult, :success)).to_s,
35
+ has_verification_result_url ? verification_result_number : ""
28
36
  )
29
37
  end
30
38
 
31
39
  printer = TablePrint::Printer.new(data, OPTIONS)
32
- printer.table_print
40
+ printer.table_print + verification_result_urls_text(matrix)
33
41
  end
34
42
 
35
- def self.lookup line, *keys
43
+ def self.lookup line, default, *keys
36
44
  keys.reduce(line) { | line, key | line[key] }
37
45
  rescue NoMethodError
38
- "???"
46
+ default
47
+ end
48
+
49
+ def self.verification_results_urls_and_successes(matrix)
50
+ (matrix[:matrix] || []).collect do | row |
51
+ url = row.dig(:verificationResult, :_links, :self, :href)
52
+ if url
53
+ success = row.dig(:verificationResult, :success)
54
+ [url, success]
55
+ else
56
+ nil
57
+ end
58
+ end.compact
59
+ end
60
+
61
+ def self.verification_result_urls_text(matrix)
62
+ text = self.verification_results_urls_and_successes(matrix).each_with_index.collect do |(url, success), i|
63
+ status = success ? 'success' : 'failure'
64
+ "#{i+1}. #{url} (#{status})"
65
+ end.join("\n")
66
+
67
+ if text.size > 0
68
+ "\n\nVERIFICATION RESULTS\n--------------------\n#{text}"
69
+ else
70
+ text
71
+ end
39
72
  end
40
73
  end
41
74
  end
@@ -20,7 +20,7 @@ module PactBroker
20
20
 
21
21
  def call
22
22
  message = if output == 'json'
23
- versions_resource.response.body
23
+ versions_resource.response.raw_body
24
24
  else
25
25
  to_text(versions)
26
26
  end
@@ -4,39 +4,63 @@ require 'pact_broker/client/retry'
4
4
  require 'pact_broker/client/pact_file'
5
5
  require 'pact_broker/client/pact_hash'
6
6
  require 'pact_broker/client/merge_pacts'
7
+ require 'pact_broker/client/hal_client_methods'
7
8
 
8
9
  module PactBroker
9
10
  module Client
10
11
  class PublishPacts
11
12
 
12
- def self.call(pact_broker_base_url, pact_file_paths, consumer_version, tags, pact_broker_client_options={})
13
- new(pact_broker_base_url, pact_file_paths, consumer_version, tags, pact_broker_client_options).call
13
+ include HalClientMethods
14
+
15
+ def self.call(pact_broker_base_url, pact_file_paths, consumer_version_params, pact_broker_client_options={})
16
+ new(pact_broker_base_url, pact_file_paths, consumer_version_params, pact_broker_client_options).call
14
17
  end
15
18
 
16
- def initialize pact_broker_base_url, pact_file_paths, consumer_version, tags, pact_broker_client_options={}
19
+ def initialize pact_broker_base_url, pact_file_paths, consumer_version_params, pact_broker_client_options={}
17
20
  @pact_broker_base_url = pact_broker_base_url
18
21
  @pact_file_paths = pact_file_paths
19
- @consumer_version = consumer_version
20
- @tags = tags
22
+ @consumer_version_number = consumer_version_params[:number].respond_to?(:strip) ? consumer_version_params[:number].strip : consumer_version_params[:number]
23
+ @branch = consumer_version_params[:branch]
24
+ @build_url = consumer_version_params[:build_url]
25
+ @tags = consumer_version_params[:tags] ? consumer_version_params[:tags].collect{ |tag| tag.respond_to?(:strip) ? tag.strip : tag } : []
26
+ @version_required = consumer_version_params[:version_required]
21
27
  @pact_broker_client_options = pact_broker_client_options
22
28
  end
23
29
 
24
30
  def call
25
31
  validate
26
32
  $stdout.puts("")
27
- result = apply_tags && publish_pacts
33
+ result = create_consumer_versions && apply_tags && publish_pacts
28
34
  $stdout.puts("")
29
35
  result
30
36
  end
31
37
 
32
38
  private
33
39
 
34
- attr_reader :pact_broker_base_url, :pact_file_paths, :consumer_version, :tags, :pact_broker_client_options
40
+ attr_reader :pact_broker_base_url, :pact_file_paths, :consumer_version_number, :branch, :tags, :build_url, :pact_broker_client_options, :version_required
35
41
 
36
42
  def pact_broker_client
37
43
  @pact_broker_client ||= PactBroker::Client::PactBrokerClient.new(base_url: pact_broker_base_url, client_options: pact_broker_client_options)
38
44
  end
39
45
 
46
+ def index_entry_point
47
+ @index_entry_point ||= create_index_entry_point(pact_broker_base_url, pact_broker_client_options)
48
+ end
49
+
50
+ def index_resource
51
+ @index_resource ||= Retry.while_error do
52
+ index_entry_point.get!
53
+ end
54
+ end
55
+
56
+ def can_create_version_with_branch?
57
+ @can_create_version_with_branch ||= index_resource.can?('pb:pacticipant-version')
58
+ end
59
+
60
+ def merge_on_server?
61
+ pact_broker_client_options[:write] == :merge
62
+ end
63
+
40
64
  def publish_pacts
41
65
  pact_files.group_by(&:pact_name).collect do | pact_name, pact_files |
42
66
  $stdout.puts "Merging #{pact_files.collect(&:path).join(", ")}" if pact_files.size > 1
@@ -66,8 +90,58 @@ module PactBroker
66
90
  end
67
91
  end
68
92
 
93
+ def create_consumer_versions
94
+ if create_versions?
95
+ consumer_names.collect do | consumer_name |
96
+ create_version(index_resource, consumer_name)
97
+ end
98
+ true
99
+ else
100
+ true
101
+ end
102
+ end
103
+
104
+ def create_versions?
105
+ if version_required
106
+ if can_create_version_with_branch?
107
+ true
108
+ else
109
+ raise PactBroker::Client::Error.new("This version of the Pact Broker does not support versions with branches or build URLs. Please upgrade your broker to 2.76.2 or later.")
110
+ end
111
+ elsif (branch || build_url) && can_create_version_with_branch?
112
+ true
113
+ else
114
+ false
115
+ end
116
+ end
117
+
118
+ def create_version(index_resource, consumer_name)
119
+ Retry.while_error do
120
+ version_resource = index_resource._link('pb:pacticipant-version').expand(version: consumer_version_number, pacticipant: consumer_name).put(version_body).assert_success!
121
+ message = if version_resource.response.status == 200
122
+ "Replaced version #{consumer_version_number} of #{consumer_name}"
123
+ else
124
+ "Created version #{consumer_version_number} of #{consumer_name}"
125
+ end
126
+
127
+ message = message + " (branch #{branch})" if branch
128
+ $stdout.puts message
129
+ if version_resource.response.status == 200
130
+ $stdout.puts ::Term::ANSIColor.yellow("Replacing the version resource is not recommended under normal circumstances and may indicate that you have not configured your Pact pipeline correctly (unless you are just re-running a build for a particular commit). For more information see https://docs.pact.io/versioning")
131
+ end
132
+ true
133
+ end
134
+ end
135
+
136
+ def version_body
137
+ {
138
+ branch: branch,
139
+ buildUrl: build_url
140
+ }.compact
141
+ end
142
+
69
143
  def apply_tags
70
- return true if tags.nil? || tags.empty?
144
+ return true if tags.empty?
71
145
  tags.all? do | tag |
72
146
  tag_consumer_version tag
73
147
  end
@@ -77,8 +151,8 @@ module PactBroker
77
151
  versions = pact_broker_client.pacticipants.versions
78
152
  Retry.while_error do
79
153
  consumer_names.collect do | consumer_name |
80
- versions.tag(pacticipant: consumer_name, version: consumer_version, tag: tag)
81
- $stdout.puts "Tagged version #{consumer_version} of #{consumer_name} as #{tag.inspect}"
154
+ versions.tag(pacticipant: consumer_name, version: consumer_version_number, tag: tag)
155
+ $stdout.puts "Tagged version #{consumer_version_number} of #{consumer_name} as #{tag.inspect}"
82
156
  true
83
157
  end
84
158
  end
@@ -90,18 +164,22 @@ module PactBroker
90
164
  def publish_pact_contents(pact)
91
165
  Retry.while_error do
92
166
  pacts = pact_broker_client.pacticipants.versions.pacts
93
- if pacts.version_published?(consumer: pact.consumer_name, provider: pact.provider_name, consumer_version: consumer_version)
94
- $stdout.puts ::Term::ANSIColor.yellow("A pact for this consumer version is already published. Overwriting. (Note: Overwriting pacts is not recommended as it can lead to race conditions. Best practice is to provide a unique consumer version number for each publication.)")
167
+ if pacts.version_published?(consumer: pact.consumer_name, provider: pact.provider_name, consumer_version: consumer_version_number)
168
+ if merge_on_server?
169
+ $stdout.puts "A pact for this consumer version is already published. Merging contents."
170
+ else
171
+ $stdout.puts ::Term::ANSIColor.yellow("A pact for this consumer version is already published. Overwriting. (Note: Overwriting pacts is not recommended as it can lead to race conditions. Best practice is to provide a unique consumer version number for each publication. For more information, see https://docs.pact.io/versioning)")
172
+ end
95
173
  end
96
174
 
97
- latest_pact_url = pacts.publish(pact_hash: pact, consumer_version: consumer_version)
175
+ latest_pact_url = pacts.publish(pact_hash: pact, consumer_version: consumer_version_number)
98
176
  $stdout.puts "The latest version of this pact can be accessed at the following URL:\n#{latest_pact_url}"
99
177
  true
100
178
  end
101
179
  end
102
180
 
103
181
  def validate
104
- raise PactBroker::Client::Error.new("Please specify the consumer_version") unless (consumer_version && consumer_version.to_s.strip.size > 0)
182
+ raise PactBroker::Client::Error.new("Please specify the consumer_version_number") unless (consumer_version_number && consumer_version_number.to_s.strip.size > 0)
105
183
  raise PactBroker::Client::Error.new("Please specify the pact_broker_base_url") unless (pact_broker_base_url && pact_broker_base_url.to_s.strip.size > 0)
106
184
  raise PactBroker::Client::Error.new("No pact files found") unless (pact_file_paths && pact_file_paths.any?)
107
185
  end