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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b538507a19176ca7164ac025f35358738e9d49ab61a41a20d560fee5478cd2f
4
- data.tar.gz: 7e562c453ead13f3bceba18f99ff2ed1fd556e9b07de3088038759514ed95a35
3
+ metadata.gz: 1c364b3a4f6acc4007f18baf2812262423988555e78e03617641e557ebbb3402
4
+ data.tar.gz: f741a0a0ad6ad08e4b0ef9f80cc02b07f409b6eaf84fcf609419644d7f9c6255
5
5
  SHA512:
6
- metadata.gz: 18e472c85e88525ef6c3b7714953db64c14bdc55ba6a80f1eb985b50f5c16dcc3f3d743d900b4ed06d7125581e382e10ddf4b8c6df760582b41f5d5b84b28dd7
7
- data.tar.gz: 58bac0fbb0772d36cfe57e085ab465a3ff191f0bfb383428d30476a86b44e9ec0514dc77ee6d9f90cf9d4672c0377a8e46e0c324f825375a0aa63674ce0da613
6
+ metadata.gz: 14252b9713e0f0ab18a5f4418f697757acdd8cccb572658b5655a073105abd00996ba37d2b7c467135a906df1f9c10b8ebb25a2ecdafde2901e219bc521e5b16
7
+ data.tar.gz: fc6eb7836d4ba0f1016538fa03134e44b00679458f8d5a17a091779de8698e04de64497468ea335ca0fc5e74ed3080baf06ae766a8080381eaf492b01de0a78a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ <a name="v1.63.0"></a>
2
+ ### v1.63.0 (2022-05-10)
3
+
4
+ #### Features
5
+
6
+ * add --verification-exit-code to publish-provider-contract command ([d35d908](/../../commit/d35d908))
7
+
1
8
  <a name="v1.62.1"></a>
2
9
  ### v1.62.1 (2022-05-10)
3
10
 
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
2
  module Client
3
- VERSION = '1.62.1'
3
+ VERSION = '1.63.0'
4
4
  end
5
5
  end
@@ -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
- params = params = {
38
- provider_name: options.provider.strip,
39
- provider_version_number: options.provider_app_version.strip,
40
- branch_name: options.branch && options.branch.strip,
41
- tags: (options.tag && options.tag.collect(&:strip)) || [],
42
- contract: {
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="http://localhost:9292"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.62.1
4
+ version: 1.63.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Beth Skurrie