pact_broker-client 1.62.1 → 1.63.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pactflow/client/cli/provider_contract_commands.rb +44 -23
- data/script/publish-provider-contract.sh +19 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c364b3a4f6acc4007f18baf2812262423988555e78e03617641e557ebbb3402
|
4
|
+
data.tar.gz: f741a0a0ad6ad08e4b0ef9f80cc02b07f409b6eaf84fcf609419644d7f9c6255
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14252b9713e0f0ab18a5f4418f697757acdd8cccb572658b5655a073105abd00996ba37d2b7c467135a906df1f9c10b8ebb25a2ecdafde2901e219bc521e5b16
|
7
|
+
data.tar.gz: fc6eb7836d4ba0f1016538fa03134e44b00679458f8d5a17a091779de8698e04de64497468ea335ca0fc5e74ed3080baf06ae766a8080381eaf492b01de0a78a
|
data/CHANGELOG.md
CHANGED
@@ -20,7 +20,8 @@ module Pactflow
|
|
20
20
|
#method_option :tag_with_git_branch, aliases: "-g", type: :boolean, default: false, required: false, desc: "Tag consumer version with the name of the current git branch. Default: false"
|
21
21
|
method_option :specification, default: "oas", desc: "The contract specification"
|
22
22
|
method_option :content_type, desc: "The content type. eg. application/yml"
|
23
|
-
method_option :verification_success, type: :boolean
|
23
|
+
method_option :verification_success, type: :boolean, desc: "Whether or not the self verification passed successfully."
|
24
|
+
method_option :verification_exit_code, type: :numeric, desc: "The exit code of the verification process. Can be used instead of --verificaiton-success|--no-verification-success for a simpler build script."
|
24
25
|
method_option :verification_results, desc: "The path to the file containing the output from the verification process"
|
25
26
|
method_option :verification_results_content_type, desc: "The content type of the verification output eg. text/plain, application/yaml"
|
26
27
|
method_option :verification_results_format, desc: "The format of the verification output eg. junit, text"
|
@@ -34,31 +35,51 @@ module Pactflow
|
|
34
35
|
def publish_provider_contract(provider_contract_path)
|
35
36
|
require "pactflow/client/provider_contracts/publish"
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
content: File.read(provider_contract_path),
|
44
|
-
content_type: options.content_type,
|
45
|
-
specification: options.specification
|
46
|
-
},
|
47
|
-
verification_results: {
|
48
|
-
success: options.verification_success,
|
49
|
-
content: options.verification_results ? File.read(options.verification_results) : nil,
|
50
|
-
content_type: options.verification_results_content_type,
|
51
|
-
format: options.verification_results_format,
|
52
|
-
verifier: options.verifier,
|
53
|
-
verifier_version: options.verifier_version
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
command_options = { verbose: options.verbose, output: options.output }
|
58
|
-
result = ::Pactflow::Client::ProviderContracts::Publish.call(params, command_options, pact_broker_client_options)
|
38
|
+
validate_publish_provider_contract_options(provider_contract_path)
|
39
|
+
result = ::Pactflow::Client::ProviderContracts::Publish.call(
|
40
|
+
publish_provider_contract_command_params(provider_contract_path),
|
41
|
+
command_options,
|
42
|
+
pact_broker_client_options
|
43
|
+
)
|
59
44
|
$stdout.puts result.message
|
60
45
|
exit(1) unless result.success
|
61
46
|
end
|
47
|
+
|
48
|
+
no_commands do
|
49
|
+
def command_options
|
50
|
+
{ verbose: options.verbose, output: options.output }
|
51
|
+
end
|
52
|
+
|
53
|
+
def validate_publish_provider_contract_options(provider_contract_path)
|
54
|
+
if !options.verification_success.nil? && options.verification_exit_code
|
55
|
+
raise Thor::Error, "Cannot use both --verification-success|--no-verification-success and --verification-exit-code"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def publish_provider_contract_command_params(provider_contract_path)
|
60
|
+
success = !options.verification_success.nil? ? options.verification_success : ( options.verification_exit_code && options.verification_exit_code == 0 )
|
61
|
+
|
62
|
+
{
|
63
|
+
provider_name: options.provider.strip,
|
64
|
+
provider_version_number: options.provider_app_version.strip,
|
65
|
+
branch_name: options.branch && options.branch.strip,
|
66
|
+
tags: (options.tag && options.tag.collect(&:strip)) || [],
|
67
|
+
contract: {
|
68
|
+
content: File.read(provider_contract_path),
|
69
|
+
content_type: options.content_type,
|
70
|
+
specification: options.specification
|
71
|
+
},
|
72
|
+
verification_results: {
|
73
|
+
success: success,
|
74
|
+
content: options.verification_results ? File.read(options.verification_results) : nil,
|
75
|
+
content_type: options.verification_results_content_type,
|
76
|
+
format: options.verification_results_format,
|
77
|
+
verifier: options.verifier,
|
78
|
+
verifier_version: options.verifier_version
|
79
|
+
}
|
80
|
+
}
|
81
|
+
end
|
82
|
+
end
|
62
83
|
end
|
63
84
|
end
|
64
85
|
end
|
@@ -1,5 +1,22 @@
|
|
1
|
-
export PACT_BROKER_BASE_URL
|
1
|
+
export PACT_BROKER_BASE_URL=${PACT_BROKER_BASE_URL:-"http://localhost:9292"}
|
2
2
|
export PACTFLOW_FEATURES=publish-provider-contract
|
3
|
+
bundle exec bin/pactflow publish-provider-contract \
|
4
|
+
script/oas.yml \
|
5
|
+
--provider Foo \
|
6
|
+
--provider-app-version 1013b5650d61214e19f10558f97fb5a3bb082d44 \
|
7
|
+
--branch main \
|
8
|
+
--tag dev \
|
9
|
+
--specification oas \
|
10
|
+
--content-type application/yml \
|
11
|
+
--verification-exit-code 0 \
|
12
|
+
--verification-results script/verification-results.txt \
|
13
|
+
--verification-results-content-type text/plain \
|
14
|
+
--verification-results-format text \
|
15
|
+
--verifier my-custom-tool \
|
16
|
+
--verifier-version "1.0" \
|
17
|
+
--verbose
|
18
|
+
|
19
|
+
|
3
20
|
# bundle exec bin/pactflow publish-provider-contract \
|
4
21
|
# script/oas.yml \
|
5
22
|
# --provider Foo \
|
@@ -7,21 +24,5 @@ export PACTFLOW_FEATURES=publish-provider-contract
|
|
7
24
|
# --branch main \
|
8
25
|
# --tag dev \
|
9
26
|
# --specification oas \
|
10
|
-
# --content-type application/yml
|
11
|
-
# --no-verification-success \
|
12
|
-
# --verification-results script/verification-results.txt \
|
13
|
-
# --verification-results-content-type text/plain \
|
14
|
-
# --verification-results-format text \
|
15
|
-
# --verifier my-custom-tool \
|
16
|
-
# --verifier-version "1.0" \
|
17
|
-
# --verbose
|
18
|
-
|
27
|
+
# --content-type application/yml
|
19
28
|
|
20
|
-
bundle exec bin/pactflow publish-provider-contract \
|
21
|
-
script/oas.yml \
|
22
|
-
--provider Foo \
|
23
|
-
--provider-app-version 1013b5650d61214e19f10558f97fb5a3bb082d44 \
|
24
|
-
--branch main \
|
25
|
-
--tag dev \
|
26
|
-
--specification oas \
|
27
|
-
--content-type application/yml
|