pact_broker-client 1.26.0 → 1.27.0
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 +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/pact_broker/client/cli/broker.rb +11 -0
- data/lib/pact_broker/client/git.rb +2 -1
- data/lib/pact_broker/client/pacts/list_latest_versions.rb +65 -0
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pact_broker/client/webhooks/test.rb +0 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37bbfcf2b388a56addd52da5c94f8c6e5a9f21386cdf79c8cc637aaa4e627635
|
4
|
+
data.tar.gz: 354f9fa0e2bbb27b8bf4b497758ff6fc61e1ebadb86349fe6cb6debe6510b7e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30089a2e166c13d2252e01be2556a676f05a54c4338efc7e66c65356f14123a816105d955a2078c77eb5d60f8294f2c4eb543062f8b0384226003283da482bd9
|
7
|
+
data.tar.gz: 9fe6f9e8dc432bc48e474fc4d37f07d13a9aac67860b2ba9b20cba5b73b1675274a59d88c96c7665d706978a8dfc1d3373a915ecbefd5c2fc14764c8688c13f2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
<a name="v1.27.0"></a>
|
2
|
+
### v1.27.0 (2020-05-09)
|
3
|
+
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* add BITBUCKET_BRANCH to list of known branch variables (#69) ([d1dc088](/../../commit/d1dc088))
|
8
|
+
* add list-latest-pact-versions command ([ed45d58](/../../commit/ed45d58))
|
9
|
+
|
10
|
+
|
1
11
|
<a name="v1.26.0"></a>
|
2
12
|
### v1.26.0 (2020-04-17)
|
3
13
|
|
@@ -157,6 +157,17 @@ module PactBroker
|
|
157
157
|
require 'pact_broker/client/pacticipants/create'
|
158
158
|
result = PactBroker::Client::Pacticipants2::Create.call({ name: options.name, repository_url: options.repository_url }, options.broker_base_url, pact_broker_client_options)
|
159
159
|
$stdout.puts result.message
|
160
|
+
exit(1) unless result.success
|
161
|
+
end
|
162
|
+
|
163
|
+
desc 'list-latest-pact-versions', 'List the latest pact for each integration'
|
164
|
+
shared_authentication_options_for_pact_broker
|
165
|
+
method_option :output, aliases: "-o", desc: "json or table", default: 'table'
|
166
|
+
def list_latest_pact_versions(*required_but_ignored)
|
167
|
+
require 'pact_broker/client/pacts/list_latest_versions'
|
168
|
+
result = PactBroker::Client::Pacts::ListLatestVersions.call(options.broker_base_url, options.output, pact_broker_client_options)
|
169
|
+
$stdout.puts result.message
|
170
|
+
exit(1) unless result.success
|
160
171
|
end
|
161
172
|
|
162
173
|
ignored_and_hidden_potential_options_from_environment_variables
|
@@ -11,6 +11,7 @@ APPVEYOR_REPO_COMMIT APPVEYOR_REPO_BRANCH https://www.appveyor.com/docs/en
|
|
11
11
|
CI_COMMIT_REF_NAME https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
|
12
12
|
CI_BRANCH CI_COMMIT_ID https://documentation.codeship.com/pro/builds-and-configuration/environment-variables/
|
13
13
|
bamboo.repository.git.branch https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html
|
14
|
+
BITBUCKET_BRANCH https://confluence.atlassian.com/bitbucket/variables-in-pipelines-794502608.html
|
14
15
|
|
15
16
|
=end
|
16
17
|
|
@@ -19,7 +20,7 @@ module PactBroker
|
|
19
20
|
module Client
|
20
21
|
module Git
|
21
22
|
COMMAND = 'git name-rev --name-only HEAD'.freeze
|
22
|
-
BRANCH_ENV_VAR_NAMES = %w{BUILDKITE_BRANCH CIRCLE_BRANCH TRAVIS_BRANCH GIT_BRANCH GIT_LOCAL_BRANCH APPVEYOR_REPO_BRANCH CI_COMMIT_REF_NAME}.freeze
|
23
|
+
BRANCH_ENV_VAR_NAMES = %w{BUILDKITE_BRANCH CIRCLE_BRANCH TRAVIS_BRANCH GIT_BRANCH GIT_LOCAL_BRANCH APPVEYOR_REPO_BRANCH CI_COMMIT_REF_NAME BITBUCKET_BRANCH}.freeze
|
23
24
|
|
24
25
|
def self.branch
|
25
26
|
find_branch_from_env_vars || branch_from_git_command
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'pact_broker/client/hal'
|
2
|
+
require 'pact_broker/client/command_result'
|
3
|
+
require 'pact_broker/client/hal_client_methods'
|
4
|
+
|
5
|
+
module PactBroker
|
6
|
+
module Client
|
7
|
+
module Pacts
|
8
|
+
class ListLatestVersions
|
9
|
+
|
10
|
+
include HalClientMethods
|
11
|
+
|
12
|
+
def self.call(pact_broker_base_url, output, pact_broker_client_options)
|
13
|
+
new(pact_broker_base_url, output, pact_broker_client_options).call
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(pact_broker_base_url, output, pact_broker_client_options)
|
17
|
+
@index_entry_point = create_index_entry_point(pact_broker_base_url, pact_broker_client_options)
|
18
|
+
@output = output
|
19
|
+
end
|
20
|
+
|
21
|
+
def call
|
22
|
+
message = if output == 'json'
|
23
|
+
versions_resource.response.body
|
24
|
+
else
|
25
|
+
to_text(versions)
|
26
|
+
end
|
27
|
+
PactBroker::Client::CommandResult.new(true, message)
|
28
|
+
|
29
|
+
rescue StandardError => e
|
30
|
+
PactBroker::Client::CommandResult.new(false, e.message)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
attr_reader :index_entry_point, :output
|
36
|
+
|
37
|
+
def versions
|
38
|
+
versions_resource.pacts.collect do | pact |
|
39
|
+
OpenStruct.new(
|
40
|
+
consumer_name: pact['_embedded']['consumer']['name'],
|
41
|
+
provider_name: pact['_embedded']['provider']['name'],
|
42
|
+
consumer_version_number: pact['_embedded']['consumer']['_embedded']['version']['number'],
|
43
|
+
created_at: pact['createdAt']
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def versions_resource
|
49
|
+
index_entry_point.get!._link('pb:latest-pact-versions').get!
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_text(pacts)
|
53
|
+
require 'table_print'
|
54
|
+
options = [
|
55
|
+
{ consumer_name: {display_name: 'consumer'} },
|
56
|
+
{ consumer_version_number: {display_name: 'consumer_version'} },
|
57
|
+
{ provider_name: {display_name: 'provider'} },
|
58
|
+
{ created_at: {} }
|
59
|
+
]
|
60
|
+
TablePrint::Printer.new(pacts, options).table_print
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
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.
|
4
|
+
version: 1.27.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-
|
11
|
+
date: 2020-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -226,6 +226,7 @@ files:
|
|
226
226
|
- lib/pact_broker/client/pacticipants.rb
|
227
227
|
- lib/pact_broker/client/pacticipants/create.rb
|
228
228
|
- lib/pact_broker/client/pacts.rb
|
229
|
+
- lib/pact_broker/client/pacts/list_latest_versions.rb
|
229
230
|
- lib/pact_broker/client/publish_pacts.rb
|
230
231
|
- lib/pact_broker/client/retry.rb
|
231
232
|
- lib/pact_broker/client/tasks.rb
|
@@ -316,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
317
|
- !ruby/object:Gem::Version
|
317
318
|
version: '0'
|
318
319
|
requirements: []
|
319
|
-
rubygems_version: 3.
|
320
|
+
rubygems_version: 3.0.6
|
320
321
|
signing_key:
|
321
322
|
specification_version: 4
|
322
323
|
summary: See description
|