pact_broker-client 1.38.2 → 1.42.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +47 -0
  4. data/Gemfile +4 -0
  5. data/README.md +18 -0
  6. data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +61 -140
  7. data/example/scripts/publish-pact.sh +1 -1
  8. data/lib/pact_broker/client/backports.rb +9 -0
  9. data/lib/pact_broker/client/base_client.rb +1 -1
  10. data/lib/pact_broker/client/base_command.rb +95 -0
  11. data/lib/pact_broker/client/can_i_deploy.rb +20 -3
  12. data/lib/pact_broker/client/cli/broker.rb +44 -28
  13. data/lib/pact_broker/client/cli/custom_thor.rb +12 -0
  14. data/lib/pact_broker/client/cli/environment_commands.rb +70 -0
  15. data/lib/pact_broker/client/cli/pacticipant_commands.rb +44 -0
  16. data/lib/pact_broker/client/cli/record_deployment_long_desc.txt +0 -0
  17. data/lib/pact_broker/client/cli/version_selector_options_parser.rb +4 -0
  18. data/lib/pact_broker/client/colorize_notices.rb +31 -0
  19. data/lib/pact_broker/client/environments.rb +3 -0
  20. data/lib/pact_broker/client/environments/create_environment.rb +31 -0
  21. data/lib/pact_broker/client/environments/delete_environment.rb +27 -0
  22. data/lib/pact_broker/client/environments/describe_environment.rb +36 -0
  23. data/lib/pact_broker/client/environments/environment_command.rb +66 -0
  24. data/lib/pact_broker/client/environments/list_environments.rb +30 -0
  25. data/lib/pact_broker/client/environments/text_formatter.rb +30 -0
  26. data/lib/pact_broker/client/environments/update_environment.rb +31 -0
  27. data/lib/pact_broker/client/generate_display_name.rb +27 -0
  28. data/lib/pact_broker/client/hal/entity.rb +26 -3
  29. data/lib/pact_broker/client/hal/http_client.rb +11 -2
  30. data/lib/pact_broker/client/hal/link.rb +20 -0
  31. data/lib/pact_broker/client/hal/links.rb +15 -0
  32. data/lib/pact_broker/client/hal_client_methods.rb +9 -3
  33. data/lib/pact_broker/client/matrix.rb +4 -0
  34. data/lib/pact_broker/client/matrix/abbreviate_version_number.rb +15 -0
  35. data/lib/pact_broker/client/matrix/resource.rb +26 -1
  36. data/lib/pact_broker/client/matrix/text_formatter.rb +28 -17
  37. data/lib/pact_broker/client/pacticipants.rb +6 -0
  38. data/lib/pact_broker/client/pacticipants/create.rb +24 -34
  39. data/lib/pact_broker/client/pacticipants/list.rb +34 -0
  40. data/lib/pact_broker/client/pacticipants/text_formatter.rb +41 -0
  41. data/lib/pact_broker/client/pacts.rb +0 -1
  42. data/lib/pact_broker/client/publish_pacts.rb +94 -128
  43. data/lib/pact_broker/client/publish_pacts_the_old_way.rb +194 -0
  44. data/lib/pact_broker/client/string_refinements.rb +56 -0
  45. data/lib/pact_broker/client/tasks/publication_task.rb +3 -3
  46. data/lib/pact_broker/client/version.rb +1 -1
  47. data/lib/pact_broker/client/versions/record_deployment.rb +6 -6
  48. data/lib/pact_broker/client/versions/record_undeployment.rb +45 -68
  49. data/pact-broker-client.gemspec +2 -0
  50. data/script/approve-all.sh +6 -0
  51. data/script/publish-pact.sh +36 -5
  52. data/script/record-deployment.sh +1 -3
  53. data/script/record-undeployment.sh +4 -0
  54. data/spec/fixtures/approvals/can_i_deploy_ignore.approved.txt +13 -0
  55. data/spec/fixtures/approvals/describe_environment.approved.txt +7 -0
  56. data/spec/fixtures/approvals/list_environments.approved.txt +3 -0
  57. data/spec/fixtures/foo-bar.json +31 -0
  58. data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +47 -5
  59. data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +5 -5
  60. data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +36 -7
  61. data/spec/lib/pact_broker/client/cli/broker_run_webhook_commands_spec.rb +3 -3
  62. data/spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb +21 -0
  63. data/spec/lib/pact_broker/client/environments/delete_environment_spec.rb +120 -0
  64. data/spec/lib/pact_broker/client/environments/describe_environment_spec.rb +89 -0
  65. data/spec/lib/pact_broker/client/environments/update_environment_spec.rb +167 -0
  66. data/spec/lib/pact_broker/client/generate_display_name_spec.rb +39 -0
  67. data/spec/lib/pact_broker/client/hal/entity_spec.rb +2 -2
  68. data/spec/lib/pact_broker/client/pacticipants/create_spec.rb +5 -2
  69. data/spec/lib/pact_broker/client/{publish_pacts_spec.rb → publish_pacts_the_old_way_spec.rb} +10 -9
  70. data/spec/lib/pact_broker/client/tasks/publication_task_spec.rb +18 -12
  71. data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +5 -5
  72. data/spec/pacts/pact_broker_client-pact_broker.json +50 -124
  73. data/spec/service_providers/create_environment_spec.rb +78 -0
  74. data/spec/service_providers/list_environments_spec.rb +77 -0
  75. data/spec/service_providers/pact_broker_client_create_version_spec.rb +4 -4
  76. data/spec/service_providers/pact_broker_client_matrix_ignore_spec.rb +98 -0
  77. data/spec/service_providers/pacticipants_create_spec.rb +5 -4
  78. data/spec/service_providers/publish_pacts_spec.rb +116 -0
  79. data/spec/service_providers/record_deployment_spec.rb +6 -7
  80. data/spec/spec_helper.rb +3 -1
  81. data/spec/support/approvals.rb +26 -0
  82. data/spec/support/shared_context.rb +6 -2
  83. metadata +86 -5
@@ -5,11 +5,14 @@ module PactBroker
5
5
  module Pacticipants2
6
6
  describe Create do
7
7
  describe ".call" do
8
- let(:pact_broker_client_options) { {} }
8
+ before do
9
+ allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:sleep)
10
+ end
11
+ let(:pact_broker_client_options) { { pact_broker_base_url: broker_base_url} }
9
12
  let(:broker_base_url) { "http://url" }
10
13
  let(:params) { { name: 'Foo' } }
11
14
 
12
- subject { Create.call(params, broker_base_url, pact_broker_client_options)}
15
+ subject { Create.call(params, {}, pact_broker_client_options)}
13
16
 
14
17
  context "when there is an http error" do
15
18
  let!(:index_request) do
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
  require 'fakefs/safe'
3
- require 'pact_broker/client/publish_pacts'
3
+ require 'pact_broker/client/publish_pacts_the_old_way'
4
4
  require 'json'
5
5
 
6
6
  module PactBroker
7
7
  module Client
8
- describe PublishPacts do
8
+ describe PublishPactsTheOldWay do
9
9
 
10
10
  # The amount of stubbing that we have to do here indicates this class is doing
11
11
  # TOO MUCH and needs to be split up!
@@ -23,7 +23,7 @@ module PactBroker
23
23
  File.open("spec/pacts/consumer-provider.json", "w") { |file| file << pact_hash.to_json }
24
24
  File.open("spec/pacts/consumer-provider-2.json", "w") { |file| file << pact_hash.to_json }
25
25
  File.open("spec/pacts/foo-bar.json", "w") { |file| file << pact_hash_2.to_json }
26
- allow_any_instance_of(PublishPacts).to receive(:create_index_entry_point).and_return(index_entry_point)
26
+ allow_any_instance_of(PublishPactsTheOldWay).to receive(:create_index_entry_point).and_return(index_entry_point)
27
27
  end
28
28
 
29
29
  after do
@@ -63,8 +63,9 @@ module PactBroker
63
63
  let(:index_entry_point) { instance_double("PactBroker::Client::Hal::EntryPoint", :get! => index_resource )}
64
64
  let(:index_resource) { instance_double("PactBroker::Client::Hal::Entity", can?: can_create_version ) }
65
65
  let(:can_create_version) { false }
66
+ let(:options) { {} }
66
67
 
67
- subject { PublishPacts.new(pact_broker_base_url, pact_file_paths, consumer_version_params, pact_broker_client_options) }
68
+ subject { PublishPactsTheOldWay.new(pact_broker_base_url, pact_file_paths, consumer_version_params, options, pact_broker_client_options) }
68
69
 
69
70
  describe "call" do
70
71
  it "creates a PactBroker Client" do
@@ -85,7 +86,7 @@ module PactBroker
85
86
  end
86
87
 
87
88
  it "returns true" do
88
- expect(subject.call).to be true
89
+ expect(subject.call.success).to eq true
89
90
  end
90
91
  end
91
92
 
@@ -140,7 +141,7 @@ module PactBroker
140
141
  end
141
142
 
142
143
  it "returns false" do
143
- expect(subject.call).to be false
144
+ expect(subject.call.success).to be false
144
145
  end
145
146
  end
146
147
 
@@ -212,7 +213,7 @@ module PactBroker
212
213
  end
213
214
 
214
215
  it "returns false" do
215
- expect(subject.call).to eq false
216
+ expect(subject.call.success).to eq false
216
217
  end
217
218
  end
218
219
  end
@@ -230,7 +231,7 @@ module PactBroker
230
231
  end
231
232
 
232
233
  it "returns false" do
233
- expect(subject.call).to eq false
234
+ expect(subject.call.success).to eq false
234
235
  end
235
236
  end
236
237
 
@@ -255,7 +256,7 @@ module PactBroker
255
256
  end
256
257
 
257
258
  it "returns true" do
258
- expect(subject.call).to eq true
259
+ expect(subject.call.success).to eq true
259
260
  end
260
261
  end
261
262
 
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'pact_broker/client/tasks/publication_task'
3
3
  require 'pact_broker/client/publish_pacts'
4
+ require 'pact_broker/client/command_result'
4
5
 
5
6
  module PactBroker::Client
6
7
  describe PublicationTask do
@@ -9,13 +10,16 @@ module PactBroker::Client
9
10
  @consumer_version = "1.2.3"
10
11
  end
11
12
 
12
- let(:publish_pacts) { instance_double("PactBroker::ClientSupport::PublishPacts", call: true)}
13
+ let(:publish_pacts) { instance_double("PactBroker::ClientSupport::PublishPacts", call: result)}
13
14
  let(:pact_file_list) { ['spec/pact/consumer-provider.json'] }
15
+ let(:success) { true }
16
+ let(:result) { instance_double(PactBroker::Client::CommandResult, success: success, message: "message")}
14
17
 
15
18
  before do
16
19
  allow(PactBroker::Client::PublishPacts).to receive(:new).and_return(publish_pacts)
17
20
  allow(FileList).to receive(:[]).with(pattern).and_return(pact_file_list)
18
21
  allow(PactBroker::Client::Git).to receive(:branch).and_return('foo')
22
+ allow($stdout).to receive(:puts)
19
23
  end
20
24
 
21
25
  let(:pattern) { "spec/pacts/*.json" }
@@ -29,15 +33,16 @@ module PactBroker::Client
29
33
 
30
34
  context "when pacts are succesfully published" do
31
35
  it "invokes PublishPacts with the default values" do
32
- expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: '1.2.3', branch: "foo", tags: [], version_required: false}, {}).and_return(publish_pacts)
33
- expect(publish_pacts).to receive(:call).and_return(true)
36
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: '1.2.3', branch: "foo", tags: [], version_required: false}, {}, {}).and_return(publish_pacts)
37
+ expect(publish_pacts).to receive(:call).and_return(result)
34
38
  Rake::Task['pact:publish'].execute
35
39
  end
36
40
  end
37
41
 
38
42
  context "when a pact fails to be published" do
43
+ let(:success) { false }
44
+
39
45
  it "raises an error" do
40
- expect(publish_pacts).to receive(:call).and_return(false)
41
46
  expect { Rake::Task['pact:publish'].execute }.to raise_error("One or more pacts failed to be published")
42
47
  end
43
48
  end
@@ -52,8 +57,8 @@ module PactBroker::Client
52
57
  end
53
58
 
54
59
  it "invokes PublishPacts with the write method set" do
55
- expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: "1.2.3", branch: "foo", tags: [], version_required: false }, {write: :merge}).and_return(publish_pacts)
56
- expect(publish_pacts).to receive(:call).and_return(true)
60
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with('http://pact-broker', pact_file_list, { number: "1.2.3", branch: "foo", tags: [], version_required: false }, {}, {write: :merge}).and_return(publish_pacts)
61
+ expect(publish_pacts).to receive(:call).and_return(result)
57
62
  Rake::Task['pact:publish:merge'].execute
58
63
  end
59
64
  end
@@ -74,7 +79,7 @@ module PactBroker::Client
74
79
  end
75
80
 
76
81
  it "invokes PublishPacts with the git branch name as a tag" do
77
- expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(tags: ['bar', 'foo']), anything).and_return(publish_pacts)
82
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(tags: ['bar', 'foo']), anything, anything).and_return(publish_pacts)
78
83
  Rake::Task['pact:publish:git_branch'].execute
79
84
  end
80
85
  end
@@ -93,7 +98,7 @@ module PactBroker::Client
93
98
  end
94
99
 
95
100
  it "invokes PublishPacts with the branch name" do
96
- expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything).and_return(publish_pacts)
101
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything, anything).and_return(publish_pacts)
97
102
  Rake::Task['pact:publish:git_branch_auto_detect_true'].execute
98
103
  end
99
104
  end
@@ -113,7 +118,7 @@ module PactBroker::Client
113
118
  end
114
119
 
115
120
  it "invokes PublishPacts with the specified branch name" do
116
- expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "main"), anything).and_return(publish_pacts)
121
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "main"), anything, anything).and_return(publish_pacts)
117
122
  Rake::Task['pact:publish:git_branch_auto_detect_true_with_branch'].execute
118
123
  end
119
124
  end
@@ -132,7 +137,7 @@ module PactBroker::Client
132
137
  end
133
138
 
134
139
  it "invokes PublishPacts without the branch name" do
135
- expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_not_including(branch: "foo"), anything).and_return(publish_pacts)
140
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_not_including(branch: "foo"), anything, anything).and_return(publish_pacts)
136
141
  Rake::Task['pact:publish:git_branch_auto_detect_false'].execute
137
142
  end
138
143
  end
@@ -150,7 +155,7 @@ module PactBroker::Client
150
155
  end
151
156
 
152
157
  it "invokes PublishPacts with the branch name" do
153
- expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"), anything).and_return(publish_pacts)
158
+ expect(PactBroker::Client::PublishPacts).to receive(:new).with(anything, anything, hash_including(branch: "foo"),anything, anything).and_return(publish_pacts)
154
159
  Rake::Task['pact:publish:git_branch_auto_detect_default'].execute
155
160
  end
156
161
  end
@@ -180,9 +185,10 @@ module PactBroker::Client
180
185
  @pact_broker_base_url,
181
186
  pact_file_list,
182
187
  { number: "1.2.3", tags: [@tag], branch: "foo", version_required: false},
188
+ {},
183
189
  { basic_auth: @pact_broker_basic_auth, token: @pact_broker_token }
184
190
  )
185
- expect(publish_pacts).to receive(:call).and_return(true)
191
+ expect(publish_pacts).to receive(:call).and_return(result)
186
192
  Rake::Task['pact:publish:custom'].execute
187
193
  end
188
194
  end
@@ -15,14 +15,14 @@ module PactBroker
15
15
  stub_request(:get, broker_base_url).to_return(status: 200, body: index_body_hash.to_json, headers: { "Content-Type" => "application/hal+json" } )
16
16
  end
17
17
 
18
- let(:replaced_previous_deployed_version) { true }
18
+ let(:target) { "blue" }
19
19
 
20
20
  let(:params) do
21
21
  {
22
22
  pacticipant_name: "Foo",
23
23
  version_number: "1",
24
24
  environment_name: "test",
25
- replaced_previous_deployed_version: replaced_previous_deployed_version,
25
+ target: target,
26
26
  output: "text"
27
27
  }
28
28
  end
@@ -53,11 +53,11 @@ module PactBroker
53
53
  end
54
54
 
55
55
  it "indicates the API was Pactflow" do
56
- expect(subject.message).to include "Recorded deployment of Foo version 1 to test in Pactflow"
56
+ expect(subject.message).to include "Recorded deployment of Foo version 1 to test (target blue) in Pactflow"
57
57
  end
58
58
  end
59
59
 
60
- context "when replaced_previous_deployed_version is false" do
60
+ context "when target is false" do
61
61
  before do
62
62
  allow_any_instance_of(RecordDeployment).to receive(:check_if_command_supported)
63
63
  allow_any_instance_of(RecordDeployment).to receive(:check_environment_exists)
@@ -65,7 +65,7 @@ module PactBroker
65
65
  allow_any_instance_of(RecordDeployment).to receive(:pact_broker_name).and_return("")
66
66
  end
67
67
 
68
- let(:replaced_previous_deployed_version) { false }
68
+ let(:target) { false }
69
69
 
70
70
  let(:deployed_version_resource) do
71
71
  double('PactBroker::Client::Hal::Entity', response: double('response', headers: response_headers) )
@@ -1552,7 +1552,7 @@
1552
1552
  },
1553
1553
  {
1554
1554
  "description": "a request for the index resource",
1555
- "providerState": "the pb:pacticipant-version and pb:environments relations exist in the index resource",
1555
+ "providerState": "the pb:publish-contracts relations exists in the index resource",
1556
1556
  "request": {
1557
1557
  "method": "GET",
1558
1558
  "path": "/",
@@ -1567,20 +1567,13 @@
1567
1567
  },
1568
1568
  "body": {
1569
1569
  "_links": {
1570
- "pb:pacticipant-version": {
1571
- "href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-{pacticipant}-{version}"
1572
- },
1573
- "pb:environments": {
1574
- "href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS"
1570
+ "pb:publish-contracts": {
1571
+ "href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS"
1575
1572
  }
1576
1573
  }
1577
1574
  },
1578
1575
  "matchingRules": {
1579
- "$.body._links.pb:pacticipant-version.href": {
1580
- "match": "regex",
1581
- "regex": "http:\\/\\/.*{pacticipant}.*{version}"
1582
- },
1583
- "$.body._links.pb:environments.href": {
1576
+ "$.body._links.pb:publish-contracts.href": {
1584
1577
  "match": "regex",
1585
1578
  "regex": "http:\\/\\/.*"
1586
1579
  }
@@ -1588,86 +1581,33 @@
1588
1581
  }
1589
1582
  },
1590
1583
  {
1591
- "description": "a request for a pacticipant version",
1592
- "providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment",
1593
- "request": {
1594
- "method": "GET",
1595
- "path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1596
- "headers": {
1597
- "Accept": "application/hal+json"
1598
- }
1599
- },
1600
- "response": {
1601
- "status": 200,
1602
- "headers": {
1603
- "Content-Type": "application/hal+json;charset=utf-8"
1604
- },
1605
- "body": {
1606
- "_links": {
1607
- "pb:record-deployment": [
1608
- {
1609
- "name": "test",
1610
- "href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST"
1611
- }
1612
- ]
1613
- }
1614
- },
1615
- "matchingRules": {
1616
- "$.body._links.pb:record-deployment[0].href": {
1617
- "match": "regex",
1618
- "regex": "http:\\/\\/.*"
1619
- }
1620
- }
1621
- }
1622
- },
1623
- {
1624
- "description": "a request to record a deployment",
1625
- "providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment",
1584
+ "description": "a request to publish contracts",
1626
1585
  "request": {
1627
1586
  "method": "POST",
1628
- "path": "/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST",
1587
+ "path": "/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS",
1629
1588
  "headers": {
1630
1589
  "Content-Type": "application/json",
1631
1590
  "Accept": "application/hal+json"
1632
1591
  },
1633
1592
  "body": {
1634
- "replacedPreviousDeployedVersion": true
1635
- }
1636
- },
1637
- "response": {
1638
- "status": 201,
1639
- "headers": {
1640
- "Content-Type": "application/hal+json;charset=utf-8"
1641
- },
1642
- "body": {
1643
- "replacedPreviousDeployedVersion": true
1644
- }
1645
- }
1646
- },
1647
- {
1648
- "description": "a request for a pacticipant version",
1649
- "providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo does not exist",
1650
- "request": {
1651
- "method": "GET",
1652
- "path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1653
- "headers": {
1654
- "Accept": "application/hal+json"
1655
- }
1656
- },
1657
- "response": {
1658
- "status": 404,
1659
- "headers": {
1660
- }
1661
- }
1662
- },
1663
- {
1664
- "description": "a request for a pacticipant version",
1665
- "providerState": "version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with 2 environments that aren't test available for deployment",
1666
- "request": {
1667
- "method": "GET",
1668
- "path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1669
- "headers": {
1670
- "Accept": "application/hal+json"
1593
+ "pacticipantName": "Foo",
1594
+ "pacticipantVersionNumber": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1595
+ "branch": "main",
1596
+ "tags": [
1597
+ "dev"
1598
+ ],
1599
+ "buildUrl": "http://build",
1600
+ "contracts": [
1601
+ {
1602
+ "consumerName": "Foo",
1603
+ "providerName": "Bar",
1604
+ "specification": "pact",
1605
+ "contentType": "application/json",
1606
+ "content": "eyJjb25zdW1lciI6eyJuYW1lIjoiRm9vIn0sInByb3ZpZGVyIjp7Im5hbWUiOiJCYXIifSwiaW50ZXJhY3Rpb25zIjpbeyJkZXNjcmlwdGlvbiI6ImFuIGV4YW1wbGUgcmVxdWVzdCIsInByb3ZpZGVyU3RhdGUiOiJhIHByb3ZpZGVyIHN0YXRlIiwicmVxdWVzdCI6eyJtZXRob2QiOiJHRVQiLCJwYXRoIjoiLyIsImhlYWRlcnMiOnt9fSwicmVzcG9uc2UiOnsic3RhdHVzIjoyMDAsImhlYWRlcnMiOnsiQ29udGVudC1UeXBlIjoiYXBwbGljYXRpb24vaGFsK2pzb24ifX19XSwibWV0YWRhdGEiOnsicGFjdFNwZWNpZmljYXRpb24iOnsidmVyc2lvbiI6IjIuMC4wIn19fQ==",
1607
+ "writeMode": "overwrite",
1608
+ "onConflict": "overwrite"
1609
+ }
1610
+ ]
1671
1611
  }
1672
1612
  },
1673
1613
  "response": {
@@ -1676,56 +1616,42 @@
1676
1616
  "Content-Type": "application/hal+json;charset=utf-8"
1677
1617
  },
1678
1618
  "body": {
1619
+ "_embedded": {
1620
+ "pacticipant": {
1621
+ "name": "Foo"
1622
+ },
1623
+ "version": {
1624
+ "number": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
1625
+ "buildUrl": "http://build"
1626
+ }
1627
+ },
1628
+ "logs": [
1629
+ {
1630
+ "level": "info",
1631
+ "message": "some message"
1632
+ }
1633
+ ],
1679
1634
  "_links": {
1680
- "pb:record-deployment": [
1635
+ "pb:pacticipant-version-tags": [
1681
1636
  {
1682
- "name": "prod",
1683
- "href": "href"
1684
- },
1637
+ "name": "dev"
1638
+ }
1639
+ ],
1640
+ "pb:contracts": [
1685
1641
  {
1686
- "name": "dev",
1687
- "href": "href"
1642
+ "href": "http://some-pact"
1688
1643
  }
1689
1644
  ]
1690
1645
  }
1691
1646
  },
1692
1647
  "matchingRules": {
1693
- "$.body._links.pb:record-deployment[0]": {
1694
- "match": "type"
1648
+ "$.body.logs": {
1649
+ "min": 1
1695
1650
  },
1696
- "$.body._links.pb:record-deployment[1]": {
1651
+ "$.body.logs[*].*": {
1697
1652
  "match": "type"
1698
- }
1699
- }
1700
- }
1701
- },
1702
- {
1703
- "description": "a request for the environments",
1704
- "providerState": "an environment with name test exists",
1705
- "request": {
1706
- "method": "GET",
1707
- "path": "/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS",
1708
- "headers": {
1709
- "Accept": "application/hal+json"
1710
- }
1711
- },
1712
- "response": {
1713
- "status": 200,
1714
- "headers": {
1715
- "Content-Type": "application/hal+json;charset=utf-8"
1716
- },
1717
- "body": {
1718
- "_links": {
1719
- "pb:environments": [
1720
- {
1721
- "name": "test",
1722
- "href": "href"
1723
- }
1724
- ]
1725
- }
1726
- },
1727
- "matchingRules": {
1728
- "$.body._links.pb:environments[0].href": {
1653
+ },
1654
+ "$.body._links.pb:contracts[0].href": {
1729
1655
  "match": "type"
1730
1656
  }
1731
1657
  }