pact_broker-client 1.43.0 → 1.44.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +21 -0
  3. data/CHANGELOG.md +13 -0
  4. data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +0 -281
  5. data/lib/pact_broker/client/cli/broker.rb +3 -55
  6. data/lib/pact_broker/client/cli/deployment_commands.rb +74 -0
  7. data/lib/pact_broker/client/cli/pacticipant_commands.rb +9 -0
  8. data/lib/pact_broker/client/deployments.rb +4 -0
  9. data/lib/pact_broker/client/deployments/record_deployment.rb +38 -0
  10. data/lib/pact_broker/client/deployments/record_release.rb +99 -0
  11. data/lib/pact_broker/client/deployments/record_undeployment.rb +120 -0
  12. data/lib/pact_broker/client/describe_text_formatter.rb +23 -0
  13. data/lib/pact_broker/client/environments.rb +6 -3
  14. data/lib/pact_broker/client/environments/describe_environment.rb +3 -13
  15. data/lib/pact_broker/client/hal/entity.rb +5 -2
  16. data/lib/pact_broker/client/hal/http_client.rb +3 -2
  17. data/lib/pact_broker/client/pacticipants.rb +3 -3
  18. data/lib/pact_broker/client/pacticipants/create.rb +1 -1
  19. data/lib/pact_broker/client/pacticipants/describe.rb +33 -0
  20. data/lib/pact_broker/client/version.rb +1 -1
  21. data/lib/pact_broker/client/versions.rb +4 -1
  22. data/lib/pact_broker/client/versions/describe.rb +3 -1
  23. data/lib/pact_broker/client/versions/formatter.rb +3 -1
  24. data/lib/pact_broker/client/versions/json_formatter.rb +5 -3
  25. data/lib/pact_broker/client/versions/text_formatter.rb +3 -1
  26. data/script/record-deployments-and-releases.sh +10 -0
  27. data/spec/fixtures/approvals/describe_pacticipant.approved.txt +2 -0
  28. data/spec/integration/describe_environment_spec.rb +31 -0
  29. data/spec/lib/pact_broker/client/deployments/record_deployment_spec.rb +204 -0
  30. data/spec/pacts/pact_broker_client-pact_broker.json +0 -288
  31. data/spec/service_providers/publish_pacts_spec.rb +3 -1
  32. data/spec/service_providers/record_deployment_spec.rb +7 -29
  33. data/spec/service_providers/record_release_spec.rb +135 -0
  34. data/spec/spec_helper.rb +13 -2
  35. data/tasks/pact.rake +19 -1
  36. metadata +18 -6
  37. data/lib/pact_broker/client/versions/record_deployment.rb +0 -85
  38. data/lib/pact_broker/client/versions/record_undeployment.rb +0 -102
  39. data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +0 -75
@@ -1,7 +1,9 @@
1
1
  require 'pact_broker/client/publish_pacts'
2
2
  require 'service_providers/pact_helper'
3
3
 
4
- RSpec.describe "publishing contracts", pact: true do
4
+ publish_contracts_feature_on = ENV.fetch('PACT_BROKER_FEATURES', '').include?("publish_contracts")
5
+
6
+ RSpec.describe "publishing contracts", pact: true, skip: !publish_contracts_feature_on do
5
7
  before do
6
8
  allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:sleep)
7
9
  allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:default_max_tries).and_return(1)
@@ -1,7 +1,9 @@
1
1
  require 'service_providers/pact_helper'
2
- require 'pact_broker/client/versions/record_deployment'
2
+ require 'pact_broker/client/deployments/record_deployment'
3
3
 
4
- RSpec.describe "recording a deployment", pact: true do
4
+ deployment_feature_on = ENV.fetch('PACT_BROKER_FEATURES', '').include?("deployments")
5
+
6
+ RSpec.describe "recording a deployment", pact: true, skip: !deployment_feature_on do
5
7
  include_context "pact broker"
6
8
  include PactBrokerPactHelperMethods
7
9
 
@@ -25,7 +27,7 @@ RSpec.describe "recording a deployment", pact: true do
25
27
  end
26
28
  let(:pact_broker_client_options) { { pact_broker_base_url: broker_base_url } }
27
29
 
28
- subject { PactBroker::Client::Versions::RecordDeployment.call(params, options, pact_broker_client_options) }
30
+ subject { PactBroker::Client::Deployments::RecordDeployment.call(params, options, pact_broker_client_options) }
29
31
 
30
32
  def mock_index
31
33
  pact_broker
@@ -105,18 +107,6 @@ RSpec.describe "recording a deployment", pact: true do
105
107
  )
106
108
  end
107
109
 
108
- def mock_pacticipant_version_not_found
109
- pact_broker
110
- .given("version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo does not exist")
111
- .upon_receiving("a request for a pacticipant version")
112
- .with(
113
- method: "GET",
114
- path: "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
115
- headers: get_request_headers
116
- )
117
- .will_respond_with(status: 404)
118
- end
119
-
120
110
  def mock_environments
121
111
  pact_broker
122
112
  .given("an environment with name test exists")
@@ -184,18 +174,6 @@ RSpec.describe "recording a deployment", pact: true do
184
174
  end
185
175
  end
186
176
 
187
- context "when the specified version does not exist" do
188
- before do
189
- mock_index
190
- mock_pacticipant_version_not_found
191
- end
192
-
193
- it "returns an error response" do
194
- expect(subject.success).to be false
195
- expect(subject.message).to include "Foo version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 not found"
196
- end
197
- end
198
-
199
177
  context "when the specified environment is not available for recording a deployment" do
200
178
  before do
201
179
  mock_index
@@ -208,14 +186,14 @@ RSpec.describe "recording a deployment", pact: true do
208
186
 
209
187
  it "returns an error response" do
210
188
  expect(subject.success).to be false
211
- expect(subject.message).to include "No environment found with name 'foo'. Available options: test"
189
+ expect(subject.message).to include "No environment found"
212
190
  end
213
191
  end
214
192
 
215
193
  context "when the specified environment does exist" do
216
194
  it "returns an error response" do
217
195
  expect(subject.success).to be false
218
- expect(subject.message).to include "Environment 'test' is not an available option for recording a deployment of Foo. Available options: prod, dev"
196
+ expect(subject.message).to include "not an available option"
219
197
  end
220
198
  end
221
199
  end
@@ -0,0 +1,135 @@
1
+ require 'service_providers/pact_helper'
2
+ require 'pact_broker/client/deployments/record_deployment'
3
+
4
+ deployment_feature_on = ENV.fetch('PACT_BROKER_FEATURES', '').include?("deployments")
5
+
6
+ RSpec.describe "recording a release", pact: true, skip: !deployment_feature_on do
7
+ include_context "pact broker"
8
+ include PactBrokerPactHelperMethods
9
+
10
+ let(:pacticipant_name) { "Foo" }
11
+ let(:version_number) { "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30" }
12
+ let(:environment_name) { "test" }
13
+ let(:output) { "text" }
14
+ let(:target) { "blue" }
15
+ let(:params) do
16
+ {
17
+ pacticipant_name: pacticipant_name,
18
+ version_number: version_number,
19
+ environment_name: environment_name
20
+ }
21
+ end
22
+ let(:options) do
23
+ {
24
+ output: output
25
+ }
26
+ end
27
+ let(:pact_broker_client_options) { { pact_broker_base_url: broker_base_url } }
28
+
29
+ subject { PactBroker::Client::Deployments::RecordRelease.call(params, options, pact_broker_client_options) }
30
+
31
+ def mock_index
32
+ pact_broker
33
+ .given("the pb:pacticipant-version and pb:environments relations exist in the index resource")
34
+ .upon_receiving("a request for the index resource")
35
+ .with(
36
+ method: "GET",
37
+ path: '/',
38
+ headers: get_request_headers).
39
+ will_respond_with(
40
+ status: 200,
41
+ headers: pact_broker_response_headers,
42
+ body: {
43
+ _links: {
44
+ :'pb:pacticipant-version' => {
45
+ href: placeholder_url_term("pb:pacticipant-version", ["pacticipant", "version"])
46
+ },
47
+ :'pb:environments' => {
48
+ href: placeholder_url_term("pb:environments")
49
+ }
50
+ }
51
+ }
52
+ )
53
+ end
54
+
55
+ def mock_pacticipant_version_with_test_environment_available_for_release
56
+ pact_broker
57
+ .given("version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for release")
58
+ .upon_receiving("a request for a pacticipant version")
59
+ .with(
60
+ method: "GET",
61
+ path: "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
62
+ headers: get_request_headers
63
+ )
64
+ .will_respond_with(
65
+ status: 200,
66
+ headers: pact_broker_response_headers,
67
+ body: {
68
+ _links: {
69
+ "pb:record-release" => [
70
+ {
71
+ name: "test",
72
+ href: placeholder_url_term("pb:record-release-#{pacticipant_name}-#{version_number}-#{environment_name}")
73
+ }
74
+ ]
75
+ }
76
+ }
77
+ )
78
+ end
79
+
80
+ def mock_environments
81
+ pact_broker
82
+ .given("an environment with name test exists")
83
+ .upon_receiving("a request for the environments")
84
+ .with(
85
+ method: "GET",
86
+ path: "/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS",
87
+ headers: get_request_headers
88
+ )
89
+ .will_respond_with(
90
+ status: 200,
91
+ headers: pact_broker_response_headers,
92
+ body: {
93
+ _links: {
94
+ "pb:environments" => [
95
+ {
96
+ name: "test",
97
+ href: Pact.like("href")
98
+ }
99
+ ]
100
+ }
101
+ }
102
+ )
103
+ end
104
+
105
+ def mock_record_release
106
+ pact_broker
107
+ .given("version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment")
108
+ .upon_receiving("a request to record a release")
109
+ .with(
110
+ method: "POST",
111
+ path: "/HAL-REL-PLACEHOLDER-PB-RECORD-RELEASE-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST",
112
+ headers: post_request_headers
113
+ )
114
+ .will_respond_with(
115
+ status: 201,
116
+ headers: pact_broker_response_headers,
117
+ body: {
118
+ target: target
119
+ }
120
+ )
121
+ end
122
+
123
+ context "when the deployment is recorded successfully" do
124
+ before do
125
+ mock_index
126
+ mock_pacticipant_version_with_test_environment_available_for_release
127
+ mock_record_release
128
+ end
129
+
130
+ it "returns a success message" do
131
+ expect(subject.success).to be true
132
+ expect(subject.message).to include "Recorded release of Foo version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 to test environment in the Pact Broker."
133
+ end
134
+ end
135
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  require 'webmock/rspec'
2
2
  require 'rspec/its'
3
3
 
4
- ENV['PACT_BROKER_FEATURES'] = 'deployments publish_contracts ignore'
5
-
6
4
  WebMock.disable_net_connect!(allow_localhost: true)
7
5
 
8
6
  require "./spec/support/shared_context.rb"
@@ -25,6 +23,19 @@ RSpec.configure do | config |
25
23
 
26
24
  config.filter_run_excluding skip_windows: is_windows, skip_ci: is_ci
27
25
  config.example_status_persistence_file_path = "./spec/examples.txt"
26
+
27
+ def capture(stream)
28
+ begin
29
+ stream = stream.to_s
30
+ eval "$#{stream} = StringIO.new"
31
+ yield
32
+ result = eval("$#{stream}").string
33
+ ensure
34
+ eval("$#{stream} = #{stream.upcase}")
35
+ end
36
+
37
+ result
38
+ end
28
39
  end
29
40
 
30
41
  module Pact
data/tasks/pact.rake CHANGED
@@ -14,5 +14,23 @@ PactBroker::Client::PublicationTask.new(:remote) do | task |
14
14
  task.tag = `git rev-parse --abbrev-ref HEAD`.strip
15
15
  task.consumer_version = PactBroker::Client::VERSION
16
16
  task.pact_broker_base_url = "https://test.pact.dius.com.au"
17
- task.pact_broker_basic_auth = {username: ENV.fetch('PACT_BROKER_USERNAME'), password: ENV.fetch('PACT_BROKER_PASSWORD')}
17
+ task.pact_broker_basic_auth = { username: ENV.fetch('PACT_BROKER_USERNAME'), password: ENV.fetch('PACT_BROKER_PASSWORD') }
18
+ end
19
+
20
+ PactBroker::Client::PublicationTask.new(:pactflow) do | task |
21
+ version = ENV['GITHUB_SHA']
22
+ tags = ENV['GITHUB_REF'] ? [ENV['GITHUB_REF'].gsub("refs/heads/", "")] : []
23
+
24
+ if ENV.fetch('TEST_FEATURE', '') != ''
25
+ version = "#{version}+#{ENV['TEST_FEATURE']}"
26
+ tags = ENV['TEST_FEATURE']
27
+ end
28
+
29
+ require 'pact_broker/client/version'
30
+ task.auto_detect_version_properties = false
31
+ task.tags = tags
32
+ task.branch = nil
33
+ task.consumer_version = version
34
+ task.pact_broker_base_url = "https://pact-oss.pactflow.io"
35
+ task.pact_broker_token = ENV['PACT_BROKER_TOKEN']
18
36
  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.43.0
4
+ version: 1.44.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-06-03 00:00:00.000000000 Z
11
+ date: 2021-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -247,6 +247,7 @@ files:
247
247
  - lib/pact_broker/client/cli/create_or_update_webhook_long_desc.txt
248
248
  - lib/pact_broker/client/cli/create_webhook_long_desc.txt
249
249
  - lib/pact_broker/client/cli/custom_thor.rb
250
+ - lib/pact_broker/client/cli/deployment_commands.rb
250
251
  - lib/pact_broker/client/cli/environment_commands.rb
251
252
  - lib/pact_broker/client/cli/pacticipant_commands.rb
252
253
  - lib/pact_broker/client/cli/record_deployment_long_desc.txt
@@ -254,6 +255,11 @@ files:
254
255
  - lib/pact_broker/client/colorize_notices.rb
255
256
  - lib/pact_broker/client/command_result.rb
256
257
  - lib/pact_broker/client/create_tag.rb
258
+ - lib/pact_broker/client/deployments.rb
259
+ - lib/pact_broker/client/deployments/record_deployment.rb
260
+ - lib/pact_broker/client/deployments/record_release.rb
261
+ - lib/pact_broker/client/deployments/record_undeployment.rb
262
+ - lib/pact_broker/client/describe_text_formatter.rb
257
263
  - lib/pact_broker/client/environments.rb
258
264
  - lib/pact_broker/client/environments/create_environment.rb
259
265
  - lib/pact_broker/client/environments/delete_environment.rb
@@ -286,6 +292,7 @@ files:
286
292
  - lib/pact_broker/client/pact_hash.rb
287
293
  - lib/pact_broker/client/pacticipants.rb
288
294
  - lib/pact_broker/client/pacticipants/create.rb
295
+ - lib/pact_broker/client/pacticipants/describe.rb
289
296
  - lib/pact_broker/client/pacticipants/list.rb
290
297
  - lib/pact_broker/client/pacticipants/text_formatter.rb
291
298
  - lib/pact_broker/client/pacts.rb
@@ -301,8 +308,6 @@ files:
301
308
  - lib/pact_broker/client/versions/describe.rb
302
309
  - lib/pact_broker/client/versions/formatter.rb
303
310
  - lib/pact_broker/client/versions/json_formatter.rb
304
- - lib/pact_broker/client/versions/record_deployment.rb
305
- - lib/pact_broker/client/versions/record_undeployment.rb
306
311
  - lib/pact_broker/client/versions/text_formatter.rb
307
312
  - lib/pact_broker/client/webhooks/create.rb
308
313
  - lib/pact_broker/client/webhooks/test.rb
@@ -313,15 +318,18 @@ files:
313
318
  - script/generate-cli-usage.sh
314
319
  - script/publish-pact.sh
315
320
  - script/record-deployment.sh
321
+ - script/record-deployments-and-releases.sh
316
322
  - script/record-undeployment.sh
317
323
  - script/release.sh
318
324
  - script/trigger-release.sh
319
325
  - spec/fixtures/approvals/can_i_deploy_ignore.approved.txt
320
326
  - spec/fixtures/approvals/describe_environment.approved.txt
327
+ - spec/fixtures/approvals/describe_pacticipant.approved.txt
321
328
  - spec/fixtures/approvals/list_environments.approved.txt
322
329
  - spec/fixtures/foo-bar.json
323
330
  - spec/integration/can_i_deploy_spec.rb
324
331
  - spec/integration/create_version_tag_spec.rb
332
+ - spec/integration/describe_environment_spec.rb
325
333
  - spec/lib/pact_broker/client/base_client_spec.rb
326
334
  - spec/lib/pact_broker/client/can_i_deploy_spec.rb
327
335
  - spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb
@@ -331,6 +339,7 @@ files:
331
339
  - spec/lib/pact_broker/client/cli/broker_run_webhook_commands_spec.rb
332
340
  - spec/lib/pact_broker/client/cli/custom_thor_spec.rb
333
341
  - spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb
342
+ - spec/lib/pact_broker/client/deployments/record_deployment_spec.rb
334
343
  - spec/lib/pact_broker/client/environments/delete_environment_spec.rb
335
344
  - spec/lib/pact_broker/client/environments/describe_environment_spec.rb
336
345
  - spec/lib/pact_broker/client/environments/update_environment_spec.rb
@@ -351,7 +360,6 @@ files:
351
360
  - spec/lib/pact_broker/client/retry_spec.rb
352
361
  - spec/lib/pact_broker/client/tasks/publication_task_spec.rb
353
362
  - spec/lib/pact_broker/client/versions/describe_spec.rb
354
- - spec/lib/pact_broker/client/versions/record_deployment_spec.rb
355
363
  - spec/lib/pact_broker/client/versions_spec.rb
356
364
  - spec/lib/pact_broker/client/webhooks/create_spec.rb
357
365
  - spec/pacts/pact_broker_client-pact_broker.json
@@ -373,6 +381,7 @@ files:
373
381
  - spec/service_providers/pacticipants_create_spec.rb
374
382
  - spec/service_providers/publish_pacts_spec.rb
375
383
  - spec/service_providers/record_deployment_spec.rb
384
+ - spec/service_providers/record_release_spec.rb
376
385
  - spec/service_providers/webhooks_create_spec.rb
377
386
  - spec/spec_helper.rb
378
387
  - spec/support/approvals.rb
@@ -414,10 +423,12 @@ summary: See description
414
423
  test_files:
415
424
  - spec/fixtures/approvals/can_i_deploy_ignore.approved.txt
416
425
  - spec/fixtures/approvals/describe_environment.approved.txt
426
+ - spec/fixtures/approvals/describe_pacticipant.approved.txt
417
427
  - spec/fixtures/approvals/list_environments.approved.txt
418
428
  - spec/fixtures/foo-bar.json
419
429
  - spec/integration/can_i_deploy_spec.rb
420
430
  - spec/integration/create_version_tag_spec.rb
431
+ - spec/integration/describe_environment_spec.rb
421
432
  - spec/lib/pact_broker/client/base_client_spec.rb
422
433
  - spec/lib/pact_broker/client/can_i_deploy_spec.rb
423
434
  - spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb
@@ -427,6 +438,7 @@ test_files:
427
438
  - spec/lib/pact_broker/client/cli/broker_run_webhook_commands_spec.rb
428
439
  - spec/lib/pact_broker/client/cli/custom_thor_spec.rb
429
440
  - spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb
441
+ - spec/lib/pact_broker/client/deployments/record_deployment_spec.rb
430
442
  - spec/lib/pact_broker/client/environments/delete_environment_spec.rb
431
443
  - spec/lib/pact_broker/client/environments/describe_environment_spec.rb
432
444
  - spec/lib/pact_broker/client/environments/update_environment_spec.rb
@@ -447,7 +459,6 @@ test_files:
447
459
  - spec/lib/pact_broker/client/retry_spec.rb
448
460
  - spec/lib/pact_broker/client/tasks/publication_task_spec.rb
449
461
  - spec/lib/pact_broker/client/versions/describe_spec.rb
450
- - spec/lib/pact_broker/client/versions/record_deployment_spec.rb
451
462
  - spec/lib/pact_broker/client/versions_spec.rb
452
463
  - spec/lib/pact_broker/client/webhooks/create_spec.rb
453
464
  - spec/pacts/pact_broker_client-pact_broker.json
@@ -469,6 +480,7 @@ test_files:
469
480
  - spec/service_providers/pacticipants_create_spec.rb
470
481
  - spec/service_providers/publish_pacts_spec.rb
471
482
  - spec/service_providers/record_deployment_spec.rb
483
+ - spec/service_providers/record_release_spec.rb
472
484
  - spec/service_providers/webhooks_create_spec.rb
473
485
  - spec/spec_helper.rb
474
486
  - spec/support/approvals.rb
@@ -1,85 +0,0 @@
1
- require 'pact_broker/client/base_command'
2
-
3
- module PactBroker
4
- module Client
5
- class Versions
6
- class RecordDeployment < PactBroker::Client::BaseCommand
7
-
8
- NOT_SUPPORTED_MESSAGE = "This version of the Pact Broker does not support recording deployments. Please upgrade to version 2.80.0 or later."
9
-
10
- def initialize(params, options, pact_broker_client_options)
11
- super
12
- @pacticipant_name = params.fetch(:pacticipant_name)
13
- @version_number = params.fetch(:version_number)
14
- @environment_name = params.fetch(:environment_name)
15
- @target = params.fetch(:target)
16
- end
17
-
18
- private
19
-
20
- def do_call
21
- record_deployment
22
- PactBroker::Client::CommandResult.new(true, result_message)
23
- end
24
-
25
- attr_reader :pacticipant_name, :version_number, :environment_name, :target, :output
26
- attr_reader :deployed_version_resource
27
-
28
- def check_environment_exists
29
- index_resource
30
- ._link!("pb:environments")
31
- .get!
32
- ._links("pb:environments")
33
- .find!(environment_name, "No environment found with name '#{environment_name}'")
34
- end
35
-
36
- def record_deployment
37
- @deployed_version_resource =
38
- get_record_deployment_relation
39
- .post(record_deployment_request_body)
40
- .assert_success!
41
- end
42
-
43
- def get_record_deployment_relation
44
- record_deployment_links = get_pacticipant_version._links!("pb:record-deployment")
45
- link_for_environment = record_deployment_links.find(environment_name)
46
- if link_for_environment
47
- link_for_environment
48
- else
49
- check_environment_exists
50
- # Force the exception to be raised
51
- record_deployment_links.find!(environment_name, "Environment '#{environment_name}' is not an available option for recording a deployment of #{pacticipant_name}.")
52
- end
53
- end
54
-
55
- def get_pacticipant_version
56
- index_resource
57
- ._link!("pb:pacticipant-version")
58
- .expand(pacticipant: pacticipant_name, version: version_number)
59
- .get
60
- .assert_success!(404 => "#{pacticipant_name} version #{version_number} not found")
61
- end
62
-
63
- def record_deployment_request_body
64
- { target: target }
65
- end
66
-
67
- def result_message
68
- if json_output?
69
- deployed_version_resource.response.raw_body
70
- else
71
- message = "Recorded deployment of #{pacticipant_name} version #{version_number} to #{environment_name} environment"
72
- message = "#{message} (target #{target})" if target
73
- green("#{message} in #{pact_broker_name}.")
74
- end
75
- end
76
-
77
- def check_if_command_supported
78
- unless index_resource.can?("pb:environments")
79
- raise PactBroker::Client::Error.new(NOT_SUPPORTED_MESSAGE)
80
- end
81
- end
82
- end
83
- end
84
- end
85
- end