pact_broker-client 1.22.3 → 1.23.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
  SHA1:
3
- metadata.gz: f11962b86d8bb10ac4cba0dd5dee6c7054dfbb7b
4
- data.tar.gz: 145fbe4eea4cdaa5a52e53ff39390e3dc56f5012
3
+ metadata.gz: 9e8813a4d39e8b78da74469fc98a5e427caea46a
4
+ data.tar.gz: e7eb1c03559919eac98651baad166706f0957ebf
5
5
  SHA512:
6
- metadata.gz: 5d4a0987ef3f98dac660ef283f451358410cd647135965974d33b87a828c04df659a975e2964fe7394cad1075d2064a22d8055f449ce0f43b3c7bdbb4c0df01f
7
- data.tar.gz: 13355657783a999487465fcf326a4ec9ef271b6ec7dd04cb97c94cab744a34b89236c36a8b9c9adba132d23229fc0f7a7eb25d16751b4b1630a64a84dae627a4
6
+ metadata.gz: 63224f9f64b81b5da4a00ed9f47d390a4c963da6446eba142a8701b7bcf3cf9c1eff878e6b985b65d9d3d45c01a687437019b3e2762900abbb2c8216b3feff3d
7
+ data.tar.gz: 8c21608bf7f40b17419efda154bcf47c1f2810428556c8d4ccb6a544f98c64e5327b16a3c47a57d2cf4b9f6c96b412fa5d45db3f9435d1d406e735470ad129ca
@@ -1,3 +1,15 @@
1
+ <a name="v1.23.0"></a>
2
+ ### v1.23.0 (2020-01-21)
3
+
4
+
5
+ #### Features
6
+
7
+ * suppport equals sign in can-i-deploy pacticipant selector parameters ([90f6457](/../../commit/90f6457))
8
+
9
+ * **cli**
10
+ * allow all versions for a particular tag to be specified when determining if it safe to deploy (mobile provider use case) ([3690944](/../../commit/3690944))
11
+
12
+
1
13
  <a name="v1.22.1"></a>
2
14
  ### v1.22.1 (2020-01-16)
3
15
 
data/README.md CHANGED
@@ -94,7 +94,7 @@ Returns exit code 0 or 1, indicating whether or not the specified application (p
94
94
 
95
95
  The environment variables PACT_BROKER_BASE_URL, PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD may be used instead of their respective command line options.
96
96
 
97
- There are two ways to use `can-i-deploy`. The first (recommended and most common) approach is to specify just the application version you want to deploy and let the Pact Broker work out the dependencies for you. The second approach is to specify each application version explicitly. This would generally only be used if there were limitations that stopped you being able to use the first approach.
97
+ There are two ways to use `can-i-deploy`. The first (recommended and most commonly used) approach is to specify just the application version you want to deploy and let the Pact Broker work out the dependencies for you. The second approach is to specify each application version explicitly. This would generally only be used if there were limitations that stopped you being able to use the first approach.
98
98
 
99
99
  #### Specifying an application version
100
100
 
@@ -105,6 +105,7 @@ To specify an application (pacticipant) version you need to provide:
105
105
  * `--version VERSION` to specify a known application version (recommended)
106
106
  * `--latest` to specify the latest version
107
107
  * `--latest TAG` to specify the latest version that has a particular tag
108
+ * `--all TAG` to specify all the versions that have a particular tag (eg. "all prod" versions). This would be used when ensuring you have backwards compatiblity with all production mobile clients for a provider. Note, when using this option, you need to specify dependency explicitly (see the second usage option).
108
109
 
109
110
  Using a specific version is the easiest way to ensure you get an accurate response that won't be affected by race conditions.
110
111
 
@@ -148,13 +149,20 @@ Can I deploy the latest version of the application Foo that has the tag "test" t
148
149
 
149
150
 
150
151
 
151
- #### Alternate usage - specifying all dependencies explicitly
152
+ #### Alternate usage - specifying dependencies explicitly
152
153
 
153
- If you are unable to use tags, or there is some other limitation that stops you from using the recommended approach, you can specify each of the application versions explictly. You can specify as many application versions as you like.
154
+ If you are unable to use tags, or there is some other limitation that stops you from using the recommended approach, you can specify one or more of the dependencies explictly. You must also do this if you want to use the `--all TAG` option for any of the pacticipants.
154
155
 
155
- $ pact-broker can-i-deploy --pacticipant PACTICIPANT_1 [--version VERSION_1 | --latest [TAG]] \
156
- --pacticipant PACTICIPANT_2 [--version VERSION_2 | --latest [TAG_2]] \
157
- --to ENVIRONMENT \
156
+ You can specify as many application versions as you like, and you can even specify multiple versions of the same application (repeat the `--pacticipant` name and supply a different version.)
157
+
158
+ You can use explictly declared dependencies with or without the `--to ENVIRONMENT`. For example, if you declare two (or more) application versions with no `--to ENVIRONMENT`, then only the applications you specify will be taken into account when determining if it is safe to deploy. If you declare two (or more) application versions _as well as_ a `--to ENVIRONMENT`, then the Pact Broker will work out what integrations your declared applications will have in that environment when determining if it safe to deploy. When using this script for a production release, and you are using tags, it is always the most future-proof option to use the `--to` if possible, as it will catch any newly added consumers or providers.
159
+
160
+ If you are finding that your dependencies are not being automatically included when you supply multiple pacticipant versions, please upgrade to the latest version of the Pact Broker, as this is a more recently added feature.
161
+
162
+
163
+ $ pact-broker can-i-deploy --pacticipant PACTICIPANT_1 [--version VERSION_1 | --latest [TAG_1] | --all TAG_1] \
164
+ --pacticipant PACTICIPANT_2 [--version VERSION_2 | --latest [TAG_2] | --all TAG_2] \
165
+ [--to ENVIRONMENT] \
158
166
  --broker-base-url BROKER_BASE_URL
159
167
 
160
168
  Examples:
@@ -175,6 +183,14 @@ Can I deploy the latest version of Foo with tag "master" and the latest version
175
183
  --broker-base-url BROKER_BASE_URL
176
184
 
177
185
 
186
+ Mobile provider use case - can I deploy version b80e7b1b of Bar, all versions of Foo with tag "prod", and the latest version tagged "prod" of any other automatically calculated dependencies together? (Eg. where Bar is a provider and Foo is a mobile consumer with multiple versions in production, and Bar also has its own providers it needs to be compatible with.)
187
+
188
+
189
+ $ pact-broker can-i-deploy --pacticipant Bar --version b80e7b1b \
190
+ --pacticipant Foo --all prod \
191
+ --to prod \
192
+ --broker-base-url BROKER_BASE_URL
193
+
178
194
  ### create-webhook
179
195
 
180
196
  ```
@@ -190,8 +190,8 @@ module PactBroker
190
190
  end
191
191
 
192
192
  def validate_can_i_deploy_selectors selectors
193
- pacticipants_without_versions = selectors.select{ |s| s[:version].nil? && s[:latest].nil? }.collect{ |s| s[:pacticipant] }
194
- raise ::Thor::RequiredArgumentMissingError, "The version must be specified using --version or --latest [TAG] for pacticipant #{pacticipants_without_versions.join(", ")}" if pacticipants_without_versions.any?
193
+ pacticipants_without_versions = selectors.select{ |s| s[:version].nil? && s[:latest].nil? && s[:tag].nil? }.collect{ |s| s[:pacticipant] }
194
+ raise ::Thor::RequiredArgumentMissingError, "The version must be specified using `--version VERSION`, `--latest`, `--latest TAG`, or `--all TAG` for pacticipant #{pacticipants_without_versions.join(", ")}" if pacticipants_without_versions.any?
195
195
  end
196
196
 
197
197
  def publish_pacts pact_files
@@ -1,34 +1,50 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PactBroker
2
4
  module Client
3
5
  module CLI
4
6
  class VersionSelectorOptionsParser
5
- def self.call options
6
- versions = []
7
- last_flag = nil
8
- options.each do | option |
9
- case option
7
+
8
+ def self.call words
9
+ selectors = []
10
+ previous_option = nil
11
+ split_equals(words).each do | word |
12
+ case word
10
13
  when "--pacticipant", "-a"
11
- versions << {}
14
+ selectors << {}
12
15
  when "--latest", "-l"
13
- versions << {pacticipant: nil} unless versions.last
14
- versions.last[:latest] = true
16
+ selectors << { pacticipant: nil } if selectors.empty?
17
+ selectors.last[:latest] = true
15
18
  when /^\-/
16
19
  nil
17
20
  else
18
- case last_flag
21
+ case previous_option
19
22
  when "--pacticipant", "-a"
20
- versions.last[:pacticipant] = option
23
+ selectors.last[:pacticipant] = word
21
24
  when "--version", "-e"
22
- versions << {pacticipant: nil} unless versions.last
23
- versions.last[:version] = option
25
+ selectors << { pacticipant: nil } if selectors.empty?
26
+ selectors.last[:version] = word
24
27
  when "--latest", "-l"
25
- versions << {pacticipant: nil} unless versions.last
26
- versions.last[:tag] = option
28
+ selectors << { pacticipant: nil } if selectors.empty?
29
+ selectors.last[:tag] = word
30
+ when "--all"
31
+ selectors << { pacticipant: nil } if selectors.empty?
32
+ selectors.last[:tag] = word
27
33
  end
28
34
  end
29
- last_flag = option if option.start_with?("-")
35
+ previous_option = word if word.start_with?("-")
36
+ end
37
+ selectors
38
+ end
39
+
40
+ def self.split_equals(words)
41
+ words.flat_map do |word|
42
+ if word.start_with?("-") && word.include?("=")
43
+ word.split('=', 2)
44
+ else
45
+ word
46
+ end
30
47
  end
31
- versions
32
48
  end
33
49
  end
34
50
  end
@@ -1,5 +1,5 @@
1
1
  module PactBroker
2
2
  module Client
3
- VERSION = '1.22.3'
3
+ VERSION = '1.23.0'
4
4
  end
5
5
  end
@@ -36,6 +36,18 @@ module PactBroker
36
36
  ],[
37
37
  ["--pacticipant", "Foo", "--latest", "prod", "--pacticipant", "Bar"],
38
38
  [{ pacticipant: "Foo", latest: true, tag: "prod"}, { pacticipant: "Bar" } ]
39
+ ],[
40
+ ["--pacticipant", "Foo", "--all", "prod", "--pacticipant", "Bar"],
41
+ [{ pacticipant: "Foo", tag: "prod"}, { pacticipant: "Bar" } ]
42
+ ],[
43
+ ["--pacticipant=Foo", "--version=1.2.3"],
44
+ [{ pacticipant: "Foo", version: "1.2.3" } ]
45
+ ],[
46
+ ["--pacticipant=Foo=Bar", "--version", "1.2.3"],
47
+ [{ pacticipant: "Foo=Bar", version: "1.2.3" } ]
48
+ ],[
49
+ ["--pacticipant", "Foo=Bar", "--version", "1.2.3"],
50
+ [{ pacticipant: "Foo=Bar", version: "1.2.3" } ]
39
51
  ]
40
52
  ]
41
53
 
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.22.3
4
+ version: 1.23.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: 2020-01-16 00:00:00.000000000 Z
11
+ date: 2020-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -309,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
309
  version: '0'
310
310
  requirements: []
311
311
  rubyforge_project:
312
- rubygems_version: 2.6.11
312
+ rubygems_version: 2.6.14.3
313
313
  signing_key:
314
314
  specification_version: 4
315
315
  summary: See description