pact_broker-client 1.38.1 → 1.41.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +38 -0
- data/Gemfile +4 -0
- data/README.md +18 -0
- data/bin/pact-broker +6 -0
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +61 -140
- data/example/scripts/publish-pact.sh +1 -1
- data/lib/pact_broker/client/base_client.rb +1 -1
- data/lib/pact_broker/client/can_i_deploy.rb +20 -3
- data/lib/pact_broker/client/cli/broker.rb +35 -10
- data/lib/pact_broker/client/cli/record_deployment_long_desc.txt +0 -0
- data/lib/pact_broker/client/cli/version_selector_options_parser.rb +4 -0
- data/lib/pact_broker/client/colorize_notices.rb +31 -0
- data/lib/pact_broker/client/hal/entity.rb +16 -0
- data/lib/pact_broker/client/hal/http_client.rb +37 -1
- data/lib/pact_broker/client/hal/link.rb +12 -0
- data/lib/pact_broker/client/hal/links.rb +15 -0
- data/lib/pact_broker/client/hal_client_methods.rb +8 -0
- data/lib/pact_broker/client/matrix.rb +4 -0
- data/lib/pact_broker/client/matrix/abbreviate_version_number.rb +15 -0
- data/lib/pact_broker/client/matrix/resource.rb +26 -1
- data/lib/pact_broker/client/matrix/text_formatter.rb +11 -8
- data/lib/pact_broker/client/pacts.rb +0 -1
- data/lib/pact_broker/client/publish_pacts.rb +94 -128
- data/lib/pact_broker/client/publish_pacts_the_old_way.rb +194 -0
- data/lib/pact_broker/client/tasks/publication_task.rb +3 -3
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pact_broker/client/versions/record_deployment.rb +6 -6
- data/lib/pact_broker/client/versions/record_undeployment.rb +45 -68
- data/pact-broker-client.gemspec +1 -0
- data/script/approve-all.sh +6 -0
- data/script/publish-pact.sh +36 -5
- data/script/record-deployment.sh +1 -3
- data/script/record-undeployment.sh +4 -0
- data/spec/fixtures/approvals/can_i_deploy_ignore.approved.txt +13 -0
- data/spec/fixtures/foo-bar.json +31 -0
- data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +47 -5
- data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +3 -3
- data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +36 -7
- data/spec/lib/pact_broker/client/cli/version_selector_options_parser_spec.rb +21 -0
- data/spec/lib/pact_broker/client/hal/http_client_spec.rb +64 -7
- data/spec/lib/pact_broker/client/pacticipants/create_spec.rb +3 -0
- data/spec/lib/pact_broker/client/{publish_pacts_spec.rb → publish_pacts_the_old_way_spec.rb} +10 -9
- data/spec/lib/pact_broker/client/tasks/publication_task_spec.rb +18 -12
- data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +5 -5
- data/spec/pacts/pact_broker_client-pact_broker.json +50 -124
- data/spec/service_providers/pact_broker_client_create_version_spec.rb +4 -4
- data/spec/service_providers/pact_broker_client_matrix_ignore_spec.rb +98 -0
- data/spec/service_providers/publish_pacts_spec.rb +116 -0
- data/spec/service_providers/record_deployment_spec.rb +6 -7
- data/spec/spec_helper.rb +2 -1
- data/spec/support/approvals.rb +26 -0
- data/spec/support/shared_context.rb +6 -2
- metadata +41 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b929ba48b8f21f7cafeb339e925fac9ecf7a4a83cd3392f5170c769c725998c3
|
4
|
+
data.tar.gz: 1b50eef690671dfdf9a78f1bb8da0f2f1e58cf380b199a554b5a9e770d40a825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e527702e1d7d9cc3644f3c4db48c7e02060435699b0104f9048ab6142228475405fac9abea025c713bbf8a3a15b71660a56973515b72464814ff8dee62518289
|
7
|
+
data.tar.gz: 0b81d80a4ab02de7f7d71a7e5c991a6e322731c1803c7c85fd0b53379d92f4739e3296c0acd76cf528567b14147fb3743c352322104da46e4064116bc531514b
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,41 @@
|
|
1
|
+
<a name="v1.41.0"></a>
|
2
|
+
### v1.41.0 (2021-05-25)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* update colours of pact publish output ([2a51e37](/../../commit/2a51e37))
|
7
|
+
|
8
|
+
<a name="v1.40.0"></a>
|
9
|
+
### v1.40.0 (2021-04-26)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* use the pb:publish-contracts relation and endpoint to publish pacts ([19f1b0b](/../../commit/19f1b0b))
|
14
|
+
* update publish pacts command to use new 'all in one' contract publishing endpoint ([50dfb11](/../../commit/50dfb11))
|
15
|
+
|
16
|
+
<a name="v1.39.0"></a>
|
17
|
+
### v1.39.0 (2021-04-27)
|
18
|
+
|
19
|
+
#### Features
|
20
|
+
|
21
|
+
* publish pacts using the "all in one" endpoint (#86) ([3a1ea22](/../../commit/3a1ea22))
|
22
|
+
* provide a more helpful error message when the specified pact file does not exist ([29a7962](/../../commit/29a7962))
|
23
|
+
|
24
|
+
<a name="v1.38.3"></a>
|
25
|
+
### v1.38.3 (2021-04-08)
|
26
|
+
|
27
|
+
#### Bug Fixes
|
28
|
+
|
29
|
+
* URL encode parameters for HAL templated URLs ([764a0fa](/../../commit/764a0fa))
|
30
|
+
|
31
|
+
<a name="v1.38.2"></a>
|
32
|
+
### v1.38.2 (2021-04-01)
|
33
|
+
|
34
|
+
#### Features
|
35
|
+
|
36
|
+
* allow SSL verification to be disabled ([eb2125b](/../../commit/eb2125b))
|
37
|
+
* automatically retry at the http client level for 50x responses ([a7343f8](/../../commit/a7343f8))
|
38
|
+
|
1
39
|
<a name="v1.38.1"></a>
|
2
40
|
### v1.38.1 (2021-03-22)
|
3
41
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -309,6 +309,24 @@ Description:
|
|
309
309
|
the `generate-uuid` command.
|
310
310
|
```
|
311
311
|
|
312
|
+
### create-or-update-pacticipant
|
313
|
+
|
314
|
+
```
|
315
|
+
Usage:
|
316
|
+
pact-broker create-or-update-pacticipant --name=NAME -b, --broker-base-url=BROKER_BASE_URL
|
317
|
+
|
318
|
+
Options:
|
319
|
+
--name=NAME # Pacticipant name
|
320
|
+
[--repository-url=REPOSITORY_URL] # The repository URL of the pacticipant
|
321
|
+
-b, --broker-base-url=BROKER_BASE_URL # The base URL of the Pact Broker
|
322
|
+
-u, [--broker-username=BROKER_USERNAME] # Pact Broker basic auth username
|
323
|
+
-p, [--broker-password=BROKER_PASSWORD] # Pact Broker basic auth password
|
324
|
+
-k, [--broker-token=BROKER_TOKEN] # Pact Broker bearer token
|
325
|
+
-v, [--verbose], [--no-verbose] # Verbose output. Default: false
|
326
|
+
|
327
|
+
Create or update pacticipant by name
|
328
|
+
```
|
329
|
+
|
312
330
|
### describe-version
|
313
331
|
|
314
332
|
```
|
data/bin/pact-broker
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'pact_broker/client/cli/broker'
|
3
3
|
|
4
|
+
if ENV['PACT_BROKER_DISABLE_SSL_VERIFICATION'] == 'true' || ENV['PACT_DISABLE_SSL_VERIFICATION'] == 'true'
|
5
|
+
require 'openssl'
|
6
|
+
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
|
7
|
+
$stderr.puts "WARN: SSL verification has been disabled by a dodgy hack (reassigning the VERIFY_PEER constant to VERIFY_NONE). You acknowledge that you do this at your own risk!"
|
8
|
+
end
|
9
|
+
|
4
10
|
PactBroker::Client::CLI::Broker.start
|
@@ -2,12 +2,6 @@
|
|
2
2
|
|
3
3
|
#### Requests from Pact Broker Client to Pact Broker
|
4
4
|
|
5
|
-
* [A request for a pacticipant version](#a_request_for_a_pacticipant_version_given_version_5556b8149bf8bac76bc30f50a8a2dd4c22c85f30_of_pacticipant_Foo_exists_with_2_environments_that_aren't_test_available_for_deployment) given version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with 2 environments that aren't test available for deployment
|
6
|
-
|
7
|
-
* [A request for a pacticipant version](#a_request_for_a_pacticipant_version_given_version_5556b8149bf8bac76bc30f50a8a2dd4c22c85f30_of_pacticipant_Foo_exists_with_a_test_environment_available_for_deployment) given version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment
|
8
|
-
|
9
|
-
* [A request for a pacticipant version](#a_request_for_a_pacticipant_version_given_version_5556b8149bf8bac76bc30f50a8a2dd4c22c85f30_of_pacticipant_Foo_does_not_exist) given version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo does not exist
|
10
|
-
|
11
5
|
* [A request for the compatibility matrix for a pacticipant that does not exist](#a_request_for_the_compatibility_matrix_for_a_pacticipant_that_does_not_exist)
|
12
6
|
|
13
7
|
* [A request for the compatibility matrix for all versions of Foo and Bar](#a_request_for_the_compatibility_matrix_for_all_versions_of_Foo_and_Bar_given_the_pact_for_Foo_version_1.2.3_and_1.2.4_has_been_verified_by_Bar_version_4.5.6) given the pact for Foo version 1.2.3 and 1.2.4 has been verified by Bar version 4.5.6
|
@@ -26,8 +20,6 @@
|
|
26
20
|
|
27
21
|
* [A request for the compatibility matrix where only the version of Foo is specified](#a_request_for_the_compatibility_matrix_where_only_the_version_of_Foo_is_specified_given_the_pact_for_Foo_version_1.2.3_has_been_verified_by_Bar_version_4.5.6_and_version_5.6.7) given the pact for Foo version 1.2.3 has been verified by Bar version 4.5.6 and version 5.6.7
|
28
22
|
|
29
|
-
* [A request for the environments](#a_request_for_the_environments_given_an_environment_with_name_test_exists) given an environment with name test exists
|
30
|
-
|
31
23
|
* [A request for the index resource](#a_request_for_the_index_resource)
|
32
24
|
|
33
25
|
* [A request for the index resource](#a_request_for_the_index_resource_given_the_pacticipant_relations_are_present) given the pacticipant relations are present
|
@@ -36,10 +28,10 @@
|
|
36
28
|
|
37
29
|
* [A request for the index resource](#a_request_for_the_index_resource_given_the_pb:latest-version_relation_exists_in_the_index_resource) given the pb:latest-version relation exists in the index resource
|
38
30
|
|
39
|
-
* [A request for the index resource](#a_request_for_the_index_resource_given_the_pb:pacticipant-version_and_pb:environments_relations_exist_in_the_index_resource) given the pb:pacticipant-version and pb:environments relations exist in the index resource
|
40
|
-
|
41
31
|
* [A request for the index resource](#a_request_for_the_index_resource_given_the_pb:pacticipant-version_relation_exists_in_the_index_resource) given the pb:pacticipant-version relation exists in the index resource
|
42
32
|
|
33
|
+
* [A request for the index resource](#a_request_for_the_index_resource_given_the_pb:publish-contracts_relations_exists_in_the_index_resource) given the pb:publish-contracts relations exists in the index resource
|
34
|
+
|
43
35
|
* [A request for the index resource with the webhook relation](#a_request_for_the_index_resource_with_the_webhook_relation)
|
44
36
|
|
45
37
|
* [A request for the list of the latest pacts from all consumers for the Pricing Service'](#a_request_for_the_list_of_the_latest_pacts_from_all_consumers_for_the_Pricing_Service'_given_a_latest_pact_between_Condor_and_the_Pricing_Service_exists) given a latest pact between Condor and the Pricing Service exists
|
@@ -92,7 +84,7 @@
|
|
92
84
|
|
93
85
|
* [A request to publish a pact with method put](#a_request_to_publish_a_pact_with_method_put_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker,_and_Condor_already_has_a_pact_published_for_version_1.3.0) given the 'Pricing Service' and 'Condor' already exist in the pact-broker, and Condor already has a pact published for version 1.3.0
|
94
86
|
|
95
|
-
* [A request to
|
87
|
+
* [A request to publish contracts](#a_request_to_publish_contracts)
|
96
88
|
|
97
89
|
* [A request to register the repository URL of a pacticipant](#a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_already_exists_in_the_pact-broker) given the 'Pricing Service' already exists in the pact-broker
|
98
90
|
|
@@ -126,87 +118,6 @@
|
|
126
118
|
|
127
119
|
#### Interactions
|
128
120
|
|
129
|
-
<a name="a_request_for_a_pacticipant_version_given_version_5556b8149bf8bac76bc30f50a8a2dd4c22c85f30_of_pacticipant_Foo_exists_with_2_environments_that_aren't_test_available_for_deployment"></a>
|
130
|
-
Given **version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with 2 environments that aren't test available for deployment**, upon receiving **a request for a pacticipant version** from Pact Broker Client, with
|
131
|
-
```json
|
132
|
-
{
|
133
|
-
"method": "GET",
|
134
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
135
|
-
"headers": {
|
136
|
-
"Accept": "application/hal+json"
|
137
|
-
}
|
138
|
-
}
|
139
|
-
```
|
140
|
-
Pact Broker will respond with:
|
141
|
-
```json
|
142
|
-
{
|
143
|
-
"status": 200,
|
144
|
-
"headers": {
|
145
|
-
"Content-Type": "application/hal+json;charset=utf-8"
|
146
|
-
},
|
147
|
-
"body": {
|
148
|
-
"_links": {
|
149
|
-
"pb:record-deployment": [
|
150
|
-
{
|
151
|
-
"name": "prod",
|
152
|
-
"href": "href"
|
153
|
-
},
|
154
|
-
{
|
155
|
-
"name": "dev",
|
156
|
-
"href": "href"
|
157
|
-
}
|
158
|
-
]
|
159
|
-
}
|
160
|
-
}
|
161
|
-
}
|
162
|
-
```
|
163
|
-
<a name="a_request_for_a_pacticipant_version_given_version_5556b8149bf8bac76bc30f50a8a2dd4c22c85f30_of_pacticipant_Foo_exists_with_a_test_environment_available_for_deployment"></a>
|
164
|
-
Given **version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment**, upon receiving **a request for a pacticipant version** from Pact Broker Client, with
|
165
|
-
```json
|
166
|
-
{
|
167
|
-
"method": "GET",
|
168
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
169
|
-
"headers": {
|
170
|
-
"Accept": "application/hal+json"
|
171
|
-
}
|
172
|
-
}
|
173
|
-
```
|
174
|
-
Pact Broker will respond with:
|
175
|
-
```json
|
176
|
-
{
|
177
|
-
"status": 200,
|
178
|
-
"headers": {
|
179
|
-
"Content-Type": "application/hal+json;charset=utf-8"
|
180
|
-
},
|
181
|
-
"body": {
|
182
|
-
"_links": {
|
183
|
-
"pb:record-deployment": [
|
184
|
-
{
|
185
|
-
"name": "test",
|
186
|
-
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST"
|
187
|
-
}
|
188
|
-
]
|
189
|
-
}
|
190
|
-
}
|
191
|
-
}
|
192
|
-
```
|
193
|
-
<a name="a_request_for_a_pacticipant_version_given_version_5556b8149bf8bac76bc30f50a8a2dd4c22c85f30_of_pacticipant_Foo_does_not_exist"></a>
|
194
|
-
Given **version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo does not exist**, upon receiving **a request for a pacticipant version** from Pact Broker Client, with
|
195
|
-
```json
|
196
|
-
{
|
197
|
-
"method": "GET",
|
198
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
199
|
-
"headers": {
|
200
|
-
"Accept": "application/hal+json"
|
201
|
-
}
|
202
|
-
}
|
203
|
-
```
|
204
|
-
Pact Broker will respond with:
|
205
|
-
```json
|
206
|
-
{
|
207
|
-
"status": 404
|
208
|
-
}
|
209
|
-
```
|
210
121
|
<a name="a_request_for_the_compatibility_matrix_for_a_pacticipant_that_does_not_exist"></a>
|
211
122
|
Upon receiving **a request for the compatibility matrix for a pacticipant that does not exist** from Pact Broker Client, with
|
212
123
|
```json
|
@@ -628,36 +539,6 @@ Pact Broker will respond with:
|
|
628
539
|
}
|
629
540
|
}
|
630
541
|
```
|
631
|
-
<a name="a_request_for_the_environments_given_an_environment_with_name_test_exists"></a>
|
632
|
-
Given **an environment with name test exists**, upon receiving **a request for the environments** from Pact Broker Client, with
|
633
|
-
```json
|
634
|
-
{
|
635
|
-
"method": "GET",
|
636
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS",
|
637
|
-
"headers": {
|
638
|
-
"Accept": "application/hal+json"
|
639
|
-
}
|
640
|
-
}
|
641
|
-
```
|
642
|
-
Pact Broker will respond with:
|
643
|
-
```json
|
644
|
-
{
|
645
|
-
"status": 200,
|
646
|
-
"headers": {
|
647
|
-
"Content-Type": "application/hal+json;charset=utf-8"
|
648
|
-
},
|
649
|
-
"body": {
|
650
|
-
"_links": {
|
651
|
-
"pb:environments": [
|
652
|
-
{
|
653
|
-
"name": "test",
|
654
|
-
"href": "href"
|
655
|
-
}
|
656
|
-
]
|
657
|
-
}
|
658
|
-
}
|
659
|
-
}
|
660
|
-
```
|
661
542
|
<a name="a_request_for_the_index_resource"></a>
|
662
543
|
Upon receiving **a request for the index resource** from Pact Broker Client, with
|
663
544
|
```json
|
@@ -775,11 +656,11 @@ Pact Broker will respond with:
|
|
775
656
|
}
|
776
657
|
}
|
777
658
|
```
|
778
|
-
<a name="a_request_for_the_index_resource_given_the_pb:pacticipant-
|
779
|
-
Given **the pb:pacticipant-version
|
659
|
+
<a name="a_request_for_the_index_resource_given_the_pb:pacticipant-version_relation_exists_in_the_index_resource"></a>
|
660
|
+
Given **the pb:pacticipant-version relation exists in the index resource**, upon receiving **a request for the index resource** from Pact Broker Client, with
|
780
661
|
```json
|
781
662
|
{
|
782
|
-
"method": "
|
663
|
+
"method": "get",
|
783
664
|
"path": "/",
|
784
665
|
"headers": {
|
785
666
|
"Accept": "application/hal+json"
|
@@ -796,20 +677,17 @@ Pact Broker will respond with:
|
|
796
677
|
"body": {
|
797
678
|
"_links": {
|
798
679
|
"pb:pacticipant-version": {
|
799
|
-
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-{pacticipant}-{version}"
|
800
|
-
},
|
801
|
-
"pb:environments": {
|
802
|
-
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS"
|
680
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-INDEX-PB-PACTICIPANT-VERSION-{pacticipant}-{version}"
|
803
681
|
}
|
804
682
|
}
|
805
683
|
}
|
806
684
|
}
|
807
685
|
```
|
808
|
-
<a name="a_request_for_the_index_resource_given_the_pb:
|
809
|
-
Given **the pb:
|
686
|
+
<a name="a_request_for_the_index_resource_given_the_pb:publish-contracts_relations_exists_in_the_index_resource"></a>
|
687
|
+
Given **the pb:publish-contracts relations exists in the index resource**, upon receiving **a request for the index resource** from Pact Broker Client, with
|
810
688
|
```json
|
811
689
|
{
|
812
|
-
"method": "
|
690
|
+
"method": "GET",
|
813
691
|
"path": "/",
|
814
692
|
"headers": {
|
815
693
|
"Accept": "application/hal+json"
|
@@ -825,8 +703,8 @@ Pact Broker will respond with:
|
|
825
703
|
},
|
826
704
|
"body": {
|
827
705
|
"_links": {
|
828
|
-
"pb:
|
829
|
-
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-
|
706
|
+
"pb:publish-contracts": {
|
707
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS"
|
830
708
|
}
|
831
709
|
}
|
832
710
|
}
|
@@ -1928,30 +1806,73 @@ Pact Broker will respond with:
|
|
1928
1806
|
}
|
1929
1807
|
}
|
1930
1808
|
```
|
1931
|
-
<a name="
|
1932
|
-
|
1809
|
+
<a name="a_request_to_publish_contracts"></a>
|
1810
|
+
Upon receiving **a request to publish contracts** from Pact Broker Client, with
|
1933
1811
|
```json
|
1934
1812
|
{
|
1935
1813
|
"method": "POST",
|
1936
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-
|
1814
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS",
|
1937
1815
|
"headers": {
|
1938
1816
|
"Content-Type": "application/json",
|
1939
1817
|
"Accept": "application/hal+json"
|
1940
1818
|
},
|
1941
1819
|
"body": {
|
1942
|
-
"
|
1820
|
+
"pacticipantName": "Foo",
|
1821
|
+
"pacticipantVersionNumber": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
1822
|
+
"branch": "main",
|
1823
|
+
"tags": [
|
1824
|
+
"dev"
|
1825
|
+
],
|
1826
|
+
"buildUrl": "http://build",
|
1827
|
+
"contracts": [
|
1828
|
+
{
|
1829
|
+
"consumerName": "Foo",
|
1830
|
+
"providerName": "Bar",
|
1831
|
+
"specification": "pact",
|
1832
|
+
"contentType": "application/json",
|
1833
|
+
"content": "eyJjb25zdW1lciI6eyJuYW1lIjoiRm9vIn0sInByb3ZpZGVyIjp7Im5hbWUiOiJCYXIifSwiaW50ZXJhY3Rpb25zIjpbeyJkZXNjcmlwdGlvbiI6ImFuIGV4YW1wbGUgcmVxdWVzdCIsInByb3ZpZGVyU3RhdGUiOiJhIHByb3ZpZGVyIHN0YXRlIiwicmVxdWVzdCI6eyJtZXRob2QiOiJHRVQiLCJwYXRoIjoiLyIsImhlYWRlcnMiOnt9fSwicmVzcG9uc2UiOnsic3RhdHVzIjoyMDAsImhlYWRlcnMiOnsiQ29udGVudC1UeXBlIjoiYXBwbGljYXRpb24vaGFsK2pzb24ifX19XSwibWV0YWRhdGEiOnsicGFjdFNwZWNpZmljYXRpb24iOnsidmVyc2lvbiI6IjIuMC4wIn19fQ==",
|
1834
|
+
"writeMode": "overwrite",
|
1835
|
+
"onConflict": "overwrite"
|
1836
|
+
}
|
1837
|
+
]
|
1943
1838
|
}
|
1944
1839
|
}
|
1945
1840
|
```
|
1946
1841
|
Pact Broker will respond with:
|
1947
1842
|
```json
|
1948
1843
|
{
|
1949
|
-
"status":
|
1844
|
+
"status": 200,
|
1950
1845
|
"headers": {
|
1951
1846
|
"Content-Type": "application/hal+json;charset=utf-8"
|
1952
1847
|
},
|
1953
1848
|
"body": {
|
1954
|
-
"
|
1849
|
+
"_embedded": {
|
1850
|
+
"pacticipant": {
|
1851
|
+
"name": "Foo"
|
1852
|
+
},
|
1853
|
+
"version": {
|
1854
|
+
"number": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
1855
|
+
"buildUrl": "http://build"
|
1856
|
+
}
|
1857
|
+
},
|
1858
|
+
"logs": [
|
1859
|
+
{
|
1860
|
+
"level": "info",
|
1861
|
+
"message": "some message"
|
1862
|
+
}
|
1863
|
+
],
|
1864
|
+
"_links": {
|
1865
|
+
"pb:pacticipant-version-tags": [
|
1866
|
+
{
|
1867
|
+
"name": "dev"
|
1868
|
+
}
|
1869
|
+
],
|
1870
|
+
"pb:contracts": [
|
1871
|
+
{
|
1872
|
+
"href": "http://some-pact"
|
1873
|
+
}
|
1874
|
+
]
|
1875
|
+
}
|
1955
1876
|
}
|
1956
1877
|
}
|
1957
1878
|
```
|
@@ -1,3 +1,3 @@
|
|
1
1
|
# assumes you've set PACT_BROKER_BASE_URL, PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD already
|
2
2
|
|
3
|
-
bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --consumer-app-version=1.0.0 --tag master
|
3
|
+
bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --consumer-app-version=1.0.0 --tag master --verbose
|
@@ -3,6 +3,7 @@ require 'pact_broker/client/pact_broker_client'
|
|
3
3
|
require 'pact_broker/client/retry'
|
4
4
|
require 'pact_broker/client/matrix/formatter'
|
5
5
|
require 'term/ansicolor'
|
6
|
+
require 'pact_broker/client/colorize_notices'
|
6
7
|
|
7
8
|
module PactBroker
|
8
9
|
module Client
|
@@ -32,7 +33,7 @@ module PactBroker
|
|
32
33
|
def call
|
33
34
|
create_result(fetch_matrix_with_retries)
|
34
35
|
rescue PactBroker::Client::Error => e
|
35
|
-
Result.new(false, e.message)
|
36
|
+
Result.new(false, Term::ANSIColor.red(e.message))
|
36
37
|
rescue StandardError => e
|
37
38
|
Result.new(false, "Error retrieving matrix. #{e.class} - #{e.message}\n#{e.backtrace.join("\n")}")
|
38
39
|
end
|
@@ -52,7 +53,7 @@ module PactBroker
|
|
52
53
|
def success_message(matrix)
|
53
54
|
message = format_matrix(matrix)
|
54
55
|
if format != 'json'
|
55
|
-
message = 'Computer says yes \o/ ' + message + "\n\n" +
|
56
|
+
message = warning(matrix) + Term::ANSIColor.green('Computer says yes \o/ ') + message + "\n\n" + notice_or_reason(matrix, :green)
|
56
57
|
end
|
57
58
|
message
|
58
59
|
end
|
@@ -60,11 +61,19 @@ module PactBroker
|
|
60
61
|
def failure_message(matrix)
|
61
62
|
message = format_matrix(matrix)
|
62
63
|
if format != 'json'
|
63
|
-
message = 'Computer says no ¯\_(ツ)_/¯ ' + message + "\n\n" +
|
64
|
+
message = warning(matrix) + Term::ANSIColor.red('Computer says no ¯\_(ツ)_/¯ ') + message + "\n\n" + notice_or_reason(matrix, :red)
|
64
65
|
end
|
65
66
|
message
|
66
67
|
end
|
67
68
|
|
69
|
+
def notice_or_reason(matrix, reason_color)
|
70
|
+
if matrix.notices
|
71
|
+
PactBroker::Client::ColorizeNotices.call(matrix.notices).join("\n")
|
72
|
+
else
|
73
|
+
Term::ANSIColor.send(reason_color, matrix.reason)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
68
77
|
def format_matrix(matrix)
|
69
78
|
formatted_matrix = Matrix::Formatter.call(matrix, format)
|
70
79
|
if format != 'json' && formatted_matrix.size > 0
|
@@ -131,6 +140,14 @@ module PactBroker
|
|
131
140
|
raise PactBroker::Client::Error.new("This version of the Pact Broker does not provide a count of the unknown verification results. Please upgrade your Broker to >= v2.23.4")
|
132
141
|
end
|
133
142
|
end
|
143
|
+
|
144
|
+
def warning(matrix)
|
145
|
+
if matrix_options[:ignore_selectors] && matrix_options[:ignore_selectors].any? && !matrix.supports_ignore?
|
146
|
+
Term::ANSIColor.yellow("WARN: This version of the Pact Broker does not support ignoring pacticipants. Please upgrade your Broker to >= 2.80.0") + "\n\n"
|
147
|
+
else
|
148
|
+
""
|
149
|
+
end
|
150
|
+
end
|
134
151
|
end
|
135
152
|
end
|
136
153
|
end
|