pact_broker-client 1.53.0 → 1.54.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: d6662ad835f144252e2a6fd78f98e52b381794629dcbfb8085fa1acb0b28ece0
4
- data.tar.gz: b0ec70c258bb01ae05801070596dbb02fe23a8f674d2bab53117c40b75a6d59f
3
+ metadata.gz: 9478634ba01370a4d9cfff8a54ae4165a95b5525258795e57d3da002b6ca510f
4
+ data.tar.gz: 3ca1944dacbff6fcf88c718d5ec7c4a85e3d2b764492024aca504c4dd5b02235
5
5
  SHA512:
6
- metadata.gz: 0f20176d5773873c3cd9a41711a7d4405721f95017132702e6be84430a63baef7101aefcb2b43e05546536d974306c7677b529bd8c2d6e32701432de67e0fe44
7
- data.tar.gz: b4fc4fa3bd5096b5281d98478cc59d8732a31c29ec7f959922c064193135fd613740220230449e2c5ea3b98611f555b372545549fd22fb52050cc7710a582023
6
+ metadata.gz: fddb34d2ce7a559323ab51b90dabb2c003f731e8dc8b5666b9531fb7fc689452f54fc9d273d1c894cc398a36168817b8ab46ceba112975075660f935d6700292
7
+ data.tar.gz: b2e377f2f4e823699847f1be5e366b0c95a5ad9cbff7e37b6e149e6eb510b1c1826b0bd0cdd8ed186adaaac7c0001dd4b982222cfeb38b2f38a3bd15b4f0c1c6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ <a name="v1.54.0"></a>
2
+ ### v1.54.0 (2021-10-01)
3
+
4
+ #### Features
5
+
6
+ * disable SSL verification for HAL client and HTTParty client when environment variable PACT_DISABLE_SSL_VERIFICATION=true ([470aafa](/../../commit/470aafa))
7
+ * support setting the --main-branch for a pacticipant ([1f18e70](/../../commit/1f18e70))
8
+
1
9
  <a name="v1.53.0"></a>
2
10
  ### v1.53.0 (2021-09-29)
3
11
 
data/README.md CHANGED
@@ -517,6 +517,8 @@ Options:
517
517
  # Pacticipant name
518
518
  [--display-name=DISPLAY_NAME]
519
519
  # Display name
520
+ [--main-branch=MAIN_BRANCH]
521
+ # The main development branch of the pacticipant repository
520
522
  [--repository-url=REPOSITORY_URL]
521
523
  # The repository URL of the pacticipant
522
524
  -o, [--output=OUTPUT]
@@ -54,6 +54,8 @@ module PactBroker
54
54
  self.class.headers('Authorization' => "Bearer #{client_options[:token]}") if client_options[:token]
55
55
  self.class.ssl_ca_file(ENV['SSL_CERT_FILE']) if ENV['SSL_CERT_FILE'] && ENV['SSL_CERT_FILE'] != ''
56
56
  self.class.ssl_ca_path(ENV['SSL_CERT_DIR']) if ENV['SSL_CERT_DIR'] && ENV['SSL_CERT_DIR'] != ''
57
+ @default_options = {}
58
+ @default_options[:verify] = false if (ENV['PACT_DISABLE_SSL_VERIFICATION'] == 'true' || ENV['PACT_BROKER_DISABLE_SSL_VERIFICATION'] == 'true')
57
59
  end
58
60
 
59
61
  def default_request_headers
@@ -102,15 +104,15 @@ module PactBroker
102
104
  end
103
105
 
104
106
  def patch url, options
105
- self.class.patch(url, options.merge(body: options[:body].to_json))
107
+ self.class.patch(url, @default_options.merge(options.merge(body: options[:body].to_json)))
106
108
  end
107
109
 
108
- def put url, *args
109
- self.class.put(url, *args)
110
+ def put url, options = {}, &block
111
+ self.class.put(url, @default_options.merge(options), &block)
110
112
  end
111
113
 
112
- def get url, *args
113
- self.class.get(url, *args)
114
+ def get url, options = {}, &block
115
+ self.class.get(url, @default_options.merge(options), &block)
114
116
  end
115
117
 
116
118
  def url_for_relation relation_name, params
@@ -2,13 +2,14 @@ module PactBroker
2
2
  module Client
3
3
  module CLI
4
4
  module PacticipantCommands
5
- PACTICIPANT_PARAM_NAMES = [:name, :display_name, :repository_url]
5
+ PACTICIPANT_PARAM_NAMES = [:name, :display_name, :main_branch, :repository_url]
6
6
 
7
7
  def self.included(thor)
8
8
  thor.class_eval do
9
9
  desc 'create-or-update-pacticipant', 'Create or update pacticipant by name'
10
10
  method_option :name, type: :string, required: true, desc: "Pacticipant name"
11
11
  method_option :display_name, type: :string, desc: "Display name"
12
+ method_option :main_branch, type: :string, required: false, desc: "The main development branch of the pacticipant repository"
12
13
  method_option :repository_url, type: :string, required: false, desc: "The repository URL of the pacticipant"
13
14
  output_option_json_or_text
14
15
  shared_authentication_options
@@ -2,6 +2,7 @@ require 'pact_broker/client/retry'
2
2
  require 'pact_broker/client/hal/authorization_header_redactor'
3
3
  require 'net/http'
4
4
  require 'json'
5
+ require 'openssl'
5
6
 
6
7
  module PactBroker
7
8
  module Client
@@ -62,13 +63,19 @@ module PactBroker
62
63
  def perform_request request, uri
63
64
  response = until_truthy_or_max_times(condition: ->(resp) { resp.code.to_i < 500 }) do
64
65
  http = Net::HTTP.new(uri.host, uri.port, :ENV)
65
- http.set_debug_output(output_stream) if verbose
66
+ http.set_debug_output(output_stream) if verbose?
66
67
  http.use_ssl = (uri.scheme == 'https')
67
68
  # Need to manually set the ca_file and ca_path for the pact-ruby-standalone.
68
69
  # The env vars seem to be picked up automatically in later Ruby versions.
69
70
  # See https://github.com/pact-foundation/pact-ruby-standalone/issues/57
70
71
  http.ca_file = ENV['SSL_CERT_FILE'] if ENV['SSL_CERT_FILE'] && ENV['SSL_CERT_FILE'] != ''
71
72
  http.ca_path = ENV['SSL_CERT_DIR'] if ENV['SSL_CERT_DIR'] && ENV['SSL_CERT_DIR'] != ''
73
+ if disable_ssl_verification?
74
+ if verbose?
75
+ $stdout.puts("SSL verification is disabled")
76
+ end
77
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
78
+ end
72
79
  http.start do |http|
73
80
  http.request request
74
81
  end
@@ -115,6 +122,14 @@ module PactBroker
115
122
  AuthorizationHeaderRedactor.new($stdout)
116
123
  end
117
124
 
125
+ def verbose?
126
+ verbose || ENV["VERBOSE"] == "true"
127
+ end
128
+
129
+ def disable_ssl_verification?
130
+ ENV['PACT_DISABLE_SSL_VERIFICATION'] == 'true' || ENV['PACT_BROKER_DISABLE_SSL_VERIFICATION'] == 'true'
131
+ end
132
+
118
133
  class Response < SimpleDelegator
119
134
  def body
120
135
  bod = raw_body
@@ -38,7 +38,8 @@ module PactBroker
38
38
  {
39
39
  name: params[:name],
40
40
  repositoryUrl: params[:repository_url],
41
- displayName: params[:display_name]
41
+ displayName: params[:display_name],
42
+ mainBranch: params[:main_branch]
42
43
  }.compact
43
44
  end
44
45
  end
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
2
  module Client
3
- VERSION = '1.53.0'
3
+ VERSION = '1.54.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact_broker-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.53.0
4
+ version: 1.54.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Beth Skurrie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-29 00:00:00.000000000 Z
11
+ date: 2021-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty