pact-provider-verifier 1.26.0 → 1.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6aa619044ae521e7f472fcb86c62389dd908d4799a509bb3a1b7b688947960b2
|
|
4
|
+
data.tar.gz: beedd9e10ca307512db6306c6888c15075caa3878c6db7cb998d377421aef5e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 549f619ce02b6367a97a4e18534861ee13f3a3f9e3e3dea527d3f4e035d253061fe46e637ec6355ce19fae14e18389e70f51c90bb21d13253ffc926199a13429
|
|
7
|
+
data.tar.gz: fdd5bb10143752116f9a5446d2c96e258aacf30fc19684e90bbf431d68104c3c2d428ce9e9a21ac4ba5cb92a5720d721e4f7a39f47e282a1a6dbfd2a98837706
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
<a name="v1.27.1-1"></a>
|
|
2
|
+
### v1.27.1-1 (2020-01-16)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
#### Features
|
|
6
|
+
|
|
7
|
+
* update git command use to determine branch name ([3dae935](/../../commit/3dae935))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<a name="v1.27.0-1"></a>
|
|
11
|
+
### v1.27.0-1 (2020-01-16)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
#### Features
|
|
15
|
+
|
|
16
|
+
* **cli**
|
|
17
|
+
* add --tag-with-git-branch ([f652dd5](/../../commit/f652dd5))
|
|
18
|
+
|
|
19
|
+
|
|
1
20
|
<a name="v1.26.0-1"></a>
|
|
2
21
|
### v1.26.0-1 (2020-01-11)
|
|
3
22
|
|
|
@@ -7,6 +7,7 @@ require 'pact/provider/rspec'
|
|
|
7
7
|
require 'pact/message'
|
|
8
8
|
require 'pact/cli/run_pact_verification'
|
|
9
9
|
require 'pact/provider_verifier/aggregate_pact_configs'
|
|
10
|
+
require 'pact/provider_verifier/git'
|
|
10
11
|
require 'rack/reverse_proxy'
|
|
11
12
|
require 'faraday_middleware'
|
|
12
13
|
require 'json'
|
|
@@ -17,14 +18,15 @@ module Pact
|
|
|
17
18
|
include Pact::WaitUntilServerAvailable
|
|
18
19
|
|
|
19
20
|
PROXY_PACT_HELPER = File.expand_path(File.join(File.dirname(__FILE__), "pact_helper.rb"))
|
|
21
|
+
EMPTY_ARRAY = [].freeze
|
|
20
22
|
attr_reader :pact_urls, :options, :consumer_version_tags, :provider_version_tags, :consumer_version_selectors, :publish_verification_results
|
|
21
23
|
|
|
22
24
|
def initialize pact_urls, options = {}
|
|
23
25
|
@pact_urls = pact_urls
|
|
24
26
|
@options = options
|
|
25
|
-
@consumer_version_tags = options
|
|
26
|
-
@provider_version_tags = options
|
|
27
|
-
@consumer_version_selectors = parse_consumer_version_selectors(options
|
|
27
|
+
@consumer_version_tags = options.consumer_version_tag || EMPTY_ARRAY
|
|
28
|
+
@provider_version_tags = merge_provider_version_tags(options)
|
|
29
|
+
@consumer_version_selectors = parse_consumer_version_selectors(options.consumer_version_selector || EMPTY_ARRAY)
|
|
28
30
|
@publish_verification_results = options.publish_verification_results || ENV['PACT_BROKER_PUBLISH_VERIFICATION_RESULTS'] == 'true'
|
|
29
31
|
end
|
|
30
32
|
|
|
@@ -215,6 +217,10 @@ module Pact
|
|
|
215
217
|
consumer_version_selectors.collect{ | string | JSON.parse(string) }
|
|
216
218
|
end
|
|
217
219
|
|
|
220
|
+
def merge_provider_version_tags(options)
|
|
221
|
+
(options.provider_version_tag || EMPTY_ARRAY) + (options.tag_with_git_branch ? [Git.branch] : EMPTY_ARRAY)
|
|
222
|
+
end
|
|
223
|
+
|
|
218
224
|
def print_deprecation_note
|
|
219
225
|
if options.provider_states_url
|
|
220
226
|
$stderr.puts "WARN: The --provider-states-url option is deprecated and the URL endpoint can be removed from the application"
|
|
@@ -33,6 +33,7 @@ module Pact
|
|
|
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
|
|
35
35
|
method_option :provider_version_tag, type: :array, banner: "TAG", desc: "Tag to apply to the provider application version. May be specified multiple times.", :required => false
|
|
36
|
+
method_option :tag_with_git_branch, aliases: "-g", type: :boolean, default: false, required: false, desc: "Tag provider version with the name of the current git branch. Default: false"
|
|
36
37
|
method_option :provider_app_version, aliases: "-a", desc: "Provider application version, required when publishing verification results", :required => false
|
|
37
38
|
method_option :publish_verification_results, aliases: "-r", desc: "Publish verification results to the broker. This can also be enabled by setting the environment variable PACT_BROKER_PUBLISH_VERIFICATION_RESULTS=true", required: false, type: :boolean, default: false
|
|
38
39
|
method_option :enable_pending, desc: "Allow pacts which are in pending state to be verified without causing the overall task to fail. For more information, see https://pact.io/pending", required: false, type: :boolean, default: false
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require 'pact/provider_verifier/error'
|
|
2
|
+
|
|
3
|
+
# Keep in sync with pact_broker-client/lib/pact_broker/client/git.rb
|
|
4
|
+
|
|
5
|
+
module Pact
|
|
6
|
+
module ProviderVerifier
|
|
7
|
+
module Git
|
|
8
|
+
COMMAND = 'git name-rev --name-only HEAD'.freeze
|
|
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
|
+
|
|
11
|
+
def self.branch
|
|
12
|
+
find_branch_from_env_vars || branch_from_git_command
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# private
|
|
16
|
+
|
|
17
|
+
def self.find_branch_from_env_vars
|
|
18
|
+
BRANCH_ENV_VAR_NAMES.collect { |env_var_name| branch_from_env_var(env_var_name) }.compact.first
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.branch_from_env_var(env_var_name)
|
|
22
|
+
val = ENV[env_var_name]
|
|
23
|
+
if val && val.strip.size > 0
|
|
24
|
+
val
|
|
25
|
+
else
|
|
26
|
+
nil
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.branch_from_git_command
|
|
31
|
+
branch_names = nil
|
|
32
|
+
begin
|
|
33
|
+
branch_names = execute_git_command
|
|
34
|
+
.split("\n")
|
|
35
|
+
.collect(&:strip)
|
|
36
|
+
.reject(&:empty?)
|
|
37
|
+
.collect(&:split)
|
|
38
|
+
.collect(&:first)
|
|
39
|
+
.collect{ |line| line.gsub(/^origin\//, '') }
|
|
40
|
+
.reject{ |line| line == "HEAD" }
|
|
41
|
+
|
|
42
|
+
rescue StandardError => e
|
|
43
|
+
raise Pact::ProviderVerifier::Error, "Could not determine current git branch using command `#{COMMAND}`. #{e.class} #{e.message}"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
validate_branch_names(branch_names)
|
|
47
|
+
branch_names[0]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.validate_branch_names(branch_names)
|
|
51
|
+
if branch_names.size == 0
|
|
52
|
+
raise Pact::ProviderVerifier::Error, "Command `#{COMMAND}` didn't return anything that could be identified as the current branch."
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
if branch_names.size > 1
|
|
56
|
+
raise Pact::ProviderVerifier::Error, "Command `#{COMMAND}` returned multiple branches: #{branch_names.join(", ")}. You will need to get the branch name another way."
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def self.execute_git_command
|
|
61
|
+
`#{COMMAND}`
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
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.
|
|
4
|
+
version: 1.27.1
|
|
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-
|
|
12
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rspec
|
|
@@ -298,6 +298,8 @@ files:
|
|
|
298
298
|
- lib/pact/provider_verifier/cli/custom_thor.rb
|
|
299
299
|
- lib/pact/provider_verifier/cli/verify.rb
|
|
300
300
|
- lib/pact/provider_verifier/custom_middleware.rb
|
|
301
|
+
- lib/pact/provider_verifier/error.rb
|
|
302
|
+
- lib/pact/provider_verifier/git.rb
|
|
301
303
|
- lib/pact/provider_verifier/pact_helper.rb
|
|
302
304
|
- lib/pact/provider_verifier/provider_states/add_provider_states_header.rb
|
|
303
305
|
- lib/pact/provider_verifier/provider_states/remove_provider_states_header_middleware.rb
|