pact-provider-verifier 1.27.1 → 1.28.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6aa619044ae521e7f472fcb86c62389dd908d4799a509bb3a1b7b688947960b2
4
- data.tar.gz: beedd9e10ca307512db6306c6888c15075caa3878c6db7cb998d377421aef5e1
3
+ metadata.gz: 4d1650e2874f85a92584bd114367df7d3df6c86030249c7d754ea05553e336cb
4
+ data.tar.gz: 4ae568f9c7c34942ea6a5245d93d47edbc67d13631535beb35ab8d43c06e55be
5
5
  SHA512:
6
- metadata.gz: 549f619ce02b6367a97a4e18534861ee13f3a3f9e3e3dea527d3f4e035d253061fe46e637ec6355ce19fae14e18389e70f51c90bb21d13253ffc926199a13429
7
- data.tar.gz: fdd5bb10143752116f9a5446d2c96e258aacf30fc19684e90bbf431d68104c3c2d428ce9e9a21ac4ba5cb92a5720d721e4f7a39f47e282a1a6dbfd2a98837706
6
+ metadata.gz: 1fbeab699e77f4c6ef85a5b4dfd5ff83165e091dbc3a0f455b363e30cf45f90a25489e65e1d6e7616fd6b698d9022cd97df05a35873a5f248cc8eff934d87fe8
7
+ data.tar.gz: 331ebcaaa81632a537b94af9582b38ab2b0fbec4c937db0835bf8390ed92d08a12ab03888e8f9f8f81a1e3899edc9bfe0f5560118ebc8c619e3832f7ff8ee55e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ <a name="v1.28.0-1"></a>
2
+ ### v1.28.0-1 (2020-01-22)
3
+
4
+
5
+ #### Features
6
+
7
+ * allow Pact Broker URL and credentials to be set via environment variables ([c257abf](/../../commit/c257abf))
8
+ * ensure output stream is configured to point to the error stream before fetching the pacts so the JSON and XML parsing don't get corrupted ([d816980](/../../commit/d816980))
9
+ * use `lib/pact/provider_verifier/git.rb` to get git sha ([2dd3591](/../../commit/2dd3591))
10
+
11
+
1
12
  <a name="v1.27.1-1"></a>
2
13
  ### v1.27.1-1 (2020-01-16)
3
14
 
data/README.md CHANGED
@@ -45,13 +45,13 @@ Options:
45
45
  -c, [--provider-states-setup-url=PROVIDER_STATES_SETUP_URL]
46
46
  # Base URL to setup the provider states at
47
47
  [--pact-broker-base-url=PACT_BROKER_BASE_URL]
48
- # Base URL of the Pact Broker from which to retrieve the pacts.
48
+ # Base URL of the Pact Broker from which to retrieve the pacts. Can also be set using the environment variable PACT_BROKER_BASE_URL.
49
49
  -n, [--broker-username=BROKER_USERNAME]
50
- # Pact Broker basic auth username
50
+ # Pact Broker basic auth username. Can also be set using the environment variable PACT_BROKER_USERNAME.
51
51
  -p, [--broker-password=BROKER_PASSWORD]
52
- # Pact Broker basic auth password
52
+ # Pact Broker basic auth password. Can also be set using the environment variable PACT_BROKER_PASSWORD.
53
53
  -k, [--broker-token=BROKER_TOKEN]
54
- # Pact Broker bearer token
54
+ # Pact Broker bearer token. Can also be set using the environment variable PACT_BROKER_TOKEN.
55
55
  [--provider=PROVIDER]
56
56
  [--consumer-version-tag=TAG]
57
57
  # Retrieve the latest pacts with this consumer version tag. Used in conjunction with --provider. May be specified multiple times.
@@ -81,15 +81,15 @@ Options:
81
81
  # Default: 0
82
82
 
83
83
  Description:
84
- To verify a pact from a known URL, specify one or more PACT_URL arguments. If the pact is
85
- hosted in a Pact Broker that uses authentication, specify the relevant
86
- --broker-username/--broker-password or --broker-token fields. To dynamically fetch pacts
87
- from a Pact Broker based on the provider name, specify the --pact-broker-base-url,
88
- --provider and relevant authentication fields.
84
+ To verify a pact from a known URL, specify one or more PACT_URL arguments. If the pact
85
+ is hosted in a Pact Broker that uses authentication, specify the relevant
86
+ --broker-username/--broker-password or --broker-token fields. To dynamically fetch
87
+ pacts from a Pact Broker based on the provider name, specify the
88
+ --pact-broker-base-url, --provider and relevant authentication fields.
89
89
 
90
90
  Selectors: These are specified using JSON strings. The keys are 'tag' (the name of the consumer
91
- version tag) and 'latest' (true|false). For example '{"tag": "master", "latest": true}'.
92
- For a detailed explanation of selectors, see https://pact.io/selectors
91
+ version tag) and 'latest' (true|false). For example '{"tag": "master", "latest":
92
+ true}'. For a detailed explanation of selectors, see https://pact.io/selectors
93
93
  ```
94
94
 
95
95
  ## Examples
@@ -50,6 +50,7 @@ module Pact
50
50
 
51
51
 
52
52
  def setup
53
+ configure_output
53
54
  print_deprecation_note
54
55
  set_environment_variables
55
56
  require_rspec_monkeypatch_for_jsonl
@@ -90,6 +91,14 @@ module Pact
90
91
  end
91
92
  end
92
93
 
94
+ def configure_output
95
+ if options[:format] && !options[:out]
96
+ # Don't want to mess up the JSON parsing with messages to stdout, so send it to stderr
97
+ require 'pact/configuration'
98
+ Pact.configuration.output_stream = Pact.configuration.error_stream
99
+ end
100
+ end
101
+
93
102
  def configure_reverse_proxy
94
103
  provider_base_url = options.provider_base_url
95
104
  Rack::ReverseProxy.new do
@@ -173,18 +182,24 @@ module Pact
173
182
  Pact.clear_configuration
174
183
  Pact.clear_consumer_world
175
184
  Pact.clear_provider_world
185
+ configure_output
176
186
  configure_service_provider
177
187
  end
178
188
 
179
189
  def all_pact_urls
180
- http_client_options = { username: options.broker_username, password: options.broker_password, token: options.broker_token, verbose: options.verbose }
190
+ http_client_options = {
191
+ username: options.broker_username || ENV['PACT_BROKER_USERNAME'],
192
+ password: options.broker_password || ENV['PACT_BROKER_PASSWORD'],
193
+ token: options.broker_token || ENV['PACT_BROKER_TOKEN'],
194
+ verbose: options.verbose
195
+ }
181
196
  AggregatePactConfigs.call(
182
197
  pact_urls,
183
198
  options.provider,
184
199
  consumer_version_tags,
185
200
  consumer_version_selectors,
186
201
  provider_version_tags,
187
- options.pact_broker_base_url,
202
+ options.pact_broker_base_url || ENV['PACT_BROKER_BASE_URL'],
188
203
  http_client_options,
189
204
  { enable_pending: options.enable_pending }
190
205
  )
@@ -25,10 +25,10 @@ module Pact
25
25
  "\n\n" + SELECTOR_DOCS
26
26
  method_option :provider_base_url, aliases: "-h", desc: "Provider host URL", :required => true
27
27
  method_option :provider_states_setup_url, aliases: "-c", desc: "Base URL to setup the provider states at", :required => false
28
- method_option :pact_broker_base_url, desc: "Base URL of the Pact Broker from which to retrieve the pacts.", :required => false
29
- method_option :broker_username, aliases: "-n", desc: "Pact Broker basic auth username", :required => false
30
- method_option :broker_password, aliases: "-p", desc: "Pact Broker basic auth password", :required => false
31
- method_option :broker_token, aliases: "-k", desc: "Pact Broker bearer token", :required => false
28
+ method_option :pact_broker_base_url, desc: "Base URL of the Pact Broker from which to retrieve the pacts. Can also be set using the environment variable PACT_BROKER_BASE_URL.", :required => false
29
+ method_option :broker_username, aliases: "-n", desc: "Pact Broker basic auth username. Can also be set using the environment variable PACT_BROKER_USERNAME.", :required => false
30
+ method_option :broker_password, aliases: "-p", desc: "Pact Broker basic auth password. Can also be set using the environment variable PACT_BROKER_PASSWORD.", :required => false
31
+ method_option :broker_token, aliases: "-k", desc: "Pact Broker bearer token. Can also be set using the environment variable PACT_BROKER_TOKEN.", :required => false
32
32
  method_option :provider, required: false
33
33
  method_option :consumer_version_tag, type: :array, banner: "TAG", desc: "Retrieve the latest pacts with this consumer version tag. Used in conjunction with --provider. May be specified multiple times.", :required => false
34
34
  method_option :consumer_version_selector, type: :array, banner: "SELECTOR", desc: "JSON string specifying a selector that identifies which pacts to verify. May be specified multiple times. See below for further documentation.", :required => false
@@ -5,7 +5,7 @@ require 'pact/provider_verifier/error'
5
5
  module Pact
6
6
  module ProviderVerifier
7
7
  module Git
8
- COMMAND = 'git name-rev --name-only HEAD'.freeze
8
+ COMMAND = 'git rev-parse --abbrev-ref HEAD'.freeze
9
9
  BRANCH_ENV_VAR_NAMES = %w{BUILDKITE_BRANCH CIRCLE_BRANCH TRAVIS_BRANCH GIT_BRANCH GIT_LOCAL_BRANCH APPVEYOR_REPO_BRANCH CI_COMMIT_REF_NAME}.freeze
10
10
 
11
11
  def self.branch
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module ProviderVerifier
3
- VERSION = "1.27.1"
3
+ VERSION = "1.28.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-provider-verifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.27.1
4
+ version: 1.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Fellows
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-17 00:00:00.000000000 Z
12
+ date: 2020-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -31,14 +31,20 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.43'
34
+ version: '1.46'
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 1.46.1
35
38
  type: :runtime
36
39
  prerelease: false
37
40
  version_requirements: !ruby/object:Gem::Requirement
38
41
  requirements:
39
42
  - - "~>"
40
43
  - !ruby/object:Gem::Version
41
- version: '1.43'
44
+ version: '1.46'
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.46.1
42
48
  - !ruby/object:Gem::Dependency
43
49
  name: pact-message
44
50
  requirement: !ruby/object:Gem::Requirement