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.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +21 -0
- data/CHANGELOG.md +13 -0
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +0 -281
- data/lib/pact_broker/client/cli/broker.rb +3 -55
- data/lib/pact_broker/client/cli/deployment_commands.rb +74 -0
- data/lib/pact_broker/client/cli/pacticipant_commands.rb +9 -0
- data/lib/pact_broker/client/deployments.rb +4 -0
- data/lib/pact_broker/client/deployments/record_deployment.rb +38 -0
- data/lib/pact_broker/client/deployments/record_release.rb +99 -0
- data/lib/pact_broker/client/deployments/record_undeployment.rb +120 -0
- data/lib/pact_broker/client/describe_text_formatter.rb +23 -0
- data/lib/pact_broker/client/environments.rb +6 -3
- data/lib/pact_broker/client/environments/describe_environment.rb +3 -13
- data/lib/pact_broker/client/hal/entity.rb +5 -2
- data/lib/pact_broker/client/hal/http_client.rb +3 -2
- data/lib/pact_broker/client/pacticipants.rb +3 -3
- data/lib/pact_broker/client/pacticipants/create.rb +1 -1
- data/lib/pact_broker/client/pacticipants/describe.rb +33 -0
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pact_broker/client/versions.rb +4 -1
- data/lib/pact_broker/client/versions/describe.rb +3 -1
- data/lib/pact_broker/client/versions/formatter.rb +3 -1
- data/lib/pact_broker/client/versions/json_formatter.rb +5 -3
- data/lib/pact_broker/client/versions/text_formatter.rb +3 -1
- data/script/record-deployments-and-releases.sh +10 -0
- data/spec/fixtures/approvals/describe_pacticipant.approved.txt +2 -0
- data/spec/integration/describe_environment_spec.rb +31 -0
- data/spec/lib/pact_broker/client/deployments/record_deployment_spec.rb +204 -0
- data/spec/pacts/pact_broker_client-pact_broker.json +0 -288
- data/spec/service_providers/publish_pacts_spec.rb +3 -1
- data/spec/service_providers/record_deployment_spec.rb +7 -29
- data/spec/service_providers/record_release_spec.rb +135 -0
- data/spec/spec_helper.rb +13 -2
- data/tasks/pact.rake +19 -1
- metadata +18 -6
- data/lib/pact_broker/client/versions/record_deployment.rb +0 -85
- data/lib/pact_broker/client/versions/record_undeployment.rb +0 -102
- data/spec/lib/pact_broker/client/versions/record_deployment_spec.rb +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9a0a2b003221c85dee29fcab0f035344c961a676faaa63c9eb7a86837726471
|
4
|
+
data.tar.gz: 0356350e5894b59fde846079ed48dee78f494de755728f5c91a01a9f6df25594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14ebf92314a784825a3788d5fb9e717e6b545cc2273c863095a3a43a679b24491df1e8cc8b810e4aa8a77d42cd004bcb79e76beff954d386a54f39fc00692ad7
|
7
|
+
data.tar.gz: 965f255b44bc7b9ca1a1bbc85c28a692167b1b08ac1e16c92d0751c8171b7d805a224cbcba7337ecaaa42f3cf85adcc1b53158318c711bf9f3af53828e9ca939
|
data/.github/workflows/test.yml
CHANGED
@@ -21,3 +21,24 @@ jobs:
|
|
21
21
|
ruby-version: ${{ matrix.ruby_version }}
|
22
22
|
- run: "bundle install"
|
23
23
|
- run: "bundle exec rake"
|
24
|
+
pact:
|
25
|
+
runs-on: "ubuntu-latest"
|
26
|
+
continue-on-error: true
|
27
|
+
strategy:
|
28
|
+
fail-fast: false
|
29
|
+
matrix:
|
30
|
+
feature: ["", "publish_contracts", "deployments"]
|
31
|
+
steps:
|
32
|
+
- uses: actions/checkout@v2
|
33
|
+
- uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: "2.7"
|
36
|
+
- run: "bundle install"
|
37
|
+
- run: |
|
38
|
+
rm -rf spec/pacts/*
|
39
|
+
bundle exec rspec spec/service_providers/
|
40
|
+
bundle exec rake pact:publish:pactflow
|
41
|
+
env:
|
42
|
+
PACT_BROKER_TOKEN: ${{ secrets.PACTFLOW_PACT_OSS_TOKEN }}
|
43
|
+
PACT_BROKER_FEATURES: ${{ matrix.feature }}
|
44
|
+
TEST_FEATURE: ${{ matrix.feature }}
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
<a name="v1.44.0"></a>
|
2
|
+
### v1.44.0 (2021-06-09)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* add record-undeployment (feature toggled off) ([951d334](/../../commit/951d334))
|
7
|
+
* add describe-environment command ([cd11ebb](/../../commit/cd11ebb))
|
8
|
+
* add record-release (feature toggled off) ([e32e4e5](/../../commit/e32e4e5))
|
9
|
+
|
10
|
+
#### Bug Fixes
|
11
|
+
|
12
|
+
* hardcode file requires Fixes: https://github.com/pact-foundation/pact_broker-client/issues/88 ([581f2fd](/../../commit/581f2fd))
|
13
|
+
|
1
14
|
<a name="v1.43.0"></a>
|
2
15
|
### v1.43.0 (2021-06-03)
|
3
16
|
|
@@ -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,12 +28,8 @@
|
|
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
|
|
43
|
-
* [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
|
44
|
-
|
45
33
|
* [A request for the index resource with the webhook relation](#a_request_for_the_index_resource_with_the_webhook_relation)
|
46
34
|
|
47
35
|
* [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
|
@@ -96,10 +84,6 @@
|
|
96
84
|
|
97
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
|
98
86
|
|
99
|
-
* [A request to publish contracts](#a_request_to_publish_contracts)
|
100
|
-
|
101
|
-
* [A request to record a deployment](#a_request_to_record_a_deployment_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
|
102
|
-
|
103
87
|
* [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
|
104
88
|
|
105
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'_does_not_exist_in_the_pact-broker) given the 'Pricing Service' does not exist in the pact-broker
|
@@ -132,87 +116,6 @@
|
|
132
116
|
|
133
117
|
#### Interactions
|
134
118
|
|
135
|
-
<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>
|
136
|
-
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
|
137
|
-
```json
|
138
|
-
{
|
139
|
-
"method": "GET",
|
140
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
141
|
-
"headers": {
|
142
|
-
"Accept": "application/hal+json"
|
143
|
-
}
|
144
|
-
}
|
145
|
-
```
|
146
|
-
Pact Broker will respond with:
|
147
|
-
```json
|
148
|
-
{
|
149
|
-
"status": 200,
|
150
|
-
"headers": {
|
151
|
-
"Content-Type": "application/hal+json;charset=utf-8"
|
152
|
-
},
|
153
|
-
"body": {
|
154
|
-
"_links": {
|
155
|
-
"pb:record-deployment": [
|
156
|
-
{
|
157
|
-
"name": "prod",
|
158
|
-
"href": "href"
|
159
|
-
},
|
160
|
-
{
|
161
|
-
"name": "dev",
|
162
|
-
"href": "href"
|
163
|
-
}
|
164
|
-
]
|
165
|
-
}
|
166
|
-
}
|
167
|
-
}
|
168
|
-
```
|
169
|
-
<a name="a_request_for_a_pacticipant_version_given_version_5556b8149bf8bac76bc30f50a8a2dd4c22c85f30_of_pacticipant_Foo_exists_with_a_test_environment_available_for_deployment"></a>
|
170
|
-
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
|
171
|
-
```json
|
172
|
-
{
|
173
|
-
"method": "GET",
|
174
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
175
|
-
"headers": {
|
176
|
-
"Accept": "application/hal+json"
|
177
|
-
}
|
178
|
-
}
|
179
|
-
```
|
180
|
-
Pact Broker will respond with:
|
181
|
-
```json
|
182
|
-
{
|
183
|
-
"status": 200,
|
184
|
-
"headers": {
|
185
|
-
"Content-Type": "application/hal+json;charset=utf-8"
|
186
|
-
},
|
187
|
-
"body": {
|
188
|
-
"_links": {
|
189
|
-
"pb:record-deployment": [
|
190
|
-
{
|
191
|
-
"name": "test",
|
192
|
-
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST"
|
193
|
-
}
|
194
|
-
]
|
195
|
-
}
|
196
|
-
}
|
197
|
-
}
|
198
|
-
```
|
199
|
-
<a name="a_request_for_a_pacticipant_version_given_version_5556b8149bf8bac76bc30f50a8a2dd4c22c85f30_of_pacticipant_Foo_does_not_exist"></a>
|
200
|
-
Given **version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo does not exist**, upon receiving **a request for a pacticipant version** from Pact Broker Client, with
|
201
|
-
```json
|
202
|
-
{
|
203
|
-
"method": "GET",
|
204
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-Foo-5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
205
|
-
"headers": {
|
206
|
-
"Accept": "application/hal+json"
|
207
|
-
}
|
208
|
-
}
|
209
|
-
```
|
210
|
-
Pact Broker will respond with:
|
211
|
-
```json
|
212
|
-
{
|
213
|
-
"status": 404
|
214
|
-
}
|
215
|
-
```
|
216
119
|
<a name="a_request_for_the_compatibility_matrix_for_a_pacticipant_that_does_not_exist"></a>
|
217
120
|
Upon receiving **a request for the compatibility matrix for a pacticipant that does not exist** from Pact Broker Client, with
|
218
121
|
```json
|
@@ -634,36 +537,6 @@ Pact Broker will respond with:
|
|
634
537
|
}
|
635
538
|
}
|
636
539
|
```
|
637
|
-
<a name="a_request_for_the_environments_given_an_environment_with_name_test_exists"></a>
|
638
|
-
Given **an environment with name test exists**, upon receiving **a request for the environments** from Pact Broker Client, with
|
639
|
-
```json
|
640
|
-
{
|
641
|
-
"method": "GET",
|
642
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS",
|
643
|
-
"headers": {
|
644
|
-
"Accept": "application/hal+json"
|
645
|
-
}
|
646
|
-
}
|
647
|
-
```
|
648
|
-
Pact Broker will respond with:
|
649
|
-
```json
|
650
|
-
{
|
651
|
-
"status": 200,
|
652
|
-
"headers": {
|
653
|
-
"Content-Type": "application/hal+json;charset=utf-8"
|
654
|
-
},
|
655
|
-
"body": {
|
656
|
-
"_links": {
|
657
|
-
"pb:environments": [
|
658
|
-
{
|
659
|
-
"name": "test",
|
660
|
-
"href": "href"
|
661
|
-
}
|
662
|
-
]
|
663
|
-
}
|
664
|
-
}
|
665
|
-
}
|
666
|
-
```
|
667
540
|
<a name="a_request_for_the_index_resource"></a>
|
668
541
|
Upon receiving **a request for the index resource** from Pact Broker Client, with
|
669
542
|
```json
|
@@ -781,36 +654,6 @@ Pact Broker will respond with:
|
|
781
654
|
}
|
782
655
|
}
|
783
656
|
```
|
784
|
-
<a name="a_request_for_the_index_resource_given_the_pb:pacticipant-version_and_pb:environments_relations_exist_in_the_index_resource"></a>
|
785
|
-
Given **the pb:pacticipant-version and pb:environments relations exist in the index resource**, upon receiving **a request for the index resource** from Pact Broker Client, with
|
786
|
-
```json
|
787
|
-
{
|
788
|
-
"method": "GET",
|
789
|
-
"path": "/",
|
790
|
-
"headers": {
|
791
|
-
"Accept": "application/hal+json"
|
792
|
-
}
|
793
|
-
}
|
794
|
-
```
|
795
|
-
Pact Broker will respond with:
|
796
|
-
```json
|
797
|
-
{
|
798
|
-
"status": 200,
|
799
|
-
"headers": {
|
800
|
-
"Content-Type": "application/hal+json;charset=utf-8"
|
801
|
-
},
|
802
|
-
"body": {
|
803
|
-
"_links": {
|
804
|
-
"pb:pacticipant-version": {
|
805
|
-
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-VERSION-{pacticipant}-{version}"
|
806
|
-
},
|
807
|
-
"pb:environments": {
|
808
|
-
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-ENVIRONMENTS"
|
809
|
-
}
|
810
|
-
}
|
811
|
-
}
|
812
|
-
}
|
813
|
-
```
|
814
657
|
<a name="a_request_for_the_index_resource_given_the_pb:pacticipant-version_relation_exists_in_the_index_resource"></a>
|
815
658
|
Given **the pb:pacticipant-version relation exists in the index resource**, upon receiving **a request for the index resource** from Pact Broker Client, with
|
816
659
|
```json
|
@@ -838,33 +681,6 @@ Pact Broker will respond with:
|
|
838
681
|
}
|
839
682
|
}
|
840
683
|
```
|
841
|
-
<a name="a_request_for_the_index_resource_given_the_pb:publish-contracts_relations_exists_in_the_index_resource"></a>
|
842
|
-
Given **the pb:publish-contracts relations exists in the index resource**, upon receiving **a request for the index resource** from Pact Broker Client, with
|
843
|
-
```json
|
844
|
-
{
|
845
|
-
"method": "GET",
|
846
|
-
"path": "/",
|
847
|
-
"headers": {
|
848
|
-
"Accept": "application/hal+json"
|
849
|
-
}
|
850
|
-
}
|
851
|
-
```
|
852
|
-
Pact Broker will respond with:
|
853
|
-
```json
|
854
|
-
{
|
855
|
-
"status": 200,
|
856
|
-
"headers": {
|
857
|
-
"Content-Type": "application/hal+json;charset=utf-8"
|
858
|
-
},
|
859
|
-
"body": {
|
860
|
-
"_links": {
|
861
|
-
"pb:publish-contracts": {
|
862
|
-
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS"
|
863
|
-
}
|
864
|
-
}
|
865
|
-
}
|
866
|
-
}
|
867
|
-
```
|
868
684
|
<a name="a_request_for_the_index_resource_with_the_webhook_relation"></a>
|
869
685
|
Upon receiving **a request for the index resource with the webhook relation** from Pact Broker Client, with
|
870
686
|
```json
|
@@ -2038,103 +1854,6 @@ Pact Broker will respond with:
|
|
2038
1854
|
}
|
2039
1855
|
}
|
2040
1856
|
```
|
2041
|
-
<a name="a_request_to_publish_contracts"></a>
|
2042
|
-
Upon receiving **a request to publish contracts** from Pact Broker Client, with
|
2043
|
-
```json
|
2044
|
-
{
|
2045
|
-
"method": "POST",
|
2046
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-PUBLISH-CONTRACTS",
|
2047
|
-
"headers": {
|
2048
|
-
"Content-Type": "application/json",
|
2049
|
-
"Accept": "application/hal+json"
|
2050
|
-
},
|
2051
|
-
"body": {
|
2052
|
-
"pacticipantName": "Foo",
|
2053
|
-
"pacticipantVersionNumber": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
2054
|
-
"branch": "main",
|
2055
|
-
"tags": [
|
2056
|
-
"dev"
|
2057
|
-
],
|
2058
|
-
"buildUrl": "http://build",
|
2059
|
-
"contracts": [
|
2060
|
-
{
|
2061
|
-
"consumerName": "Foo",
|
2062
|
-
"providerName": "Bar",
|
2063
|
-
"specification": "pact",
|
2064
|
-
"contentType": "application/json",
|
2065
|
-
"content": "eyJjb25zdW1lciI6eyJuYW1lIjoiRm9vIn0sInByb3ZpZGVyIjp7Im5hbWUiOiJCYXIifSwiaW50ZXJhY3Rpb25zIjpbeyJkZXNjcmlwdGlvbiI6ImFuIGV4YW1wbGUgcmVxdWVzdCIsInByb3ZpZGVyU3RhdGUiOiJhIHByb3ZpZGVyIHN0YXRlIiwicmVxdWVzdCI6eyJtZXRob2QiOiJHRVQiLCJwYXRoIjoiLyIsImhlYWRlcnMiOnt9fSwicmVzcG9uc2UiOnsic3RhdHVzIjoyMDAsImhlYWRlcnMiOnsiQ29udGVudC1UeXBlIjoiYXBwbGljYXRpb24vaGFsK2pzb24ifX19XSwibWV0YWRhdGEiOnsicGFjdFNwZWNpZmljYXRpb24iOnsidmVyc2lvbiI6IjIuMC4wIn19fQ==",
|
2066
|
-
"writeMode": "overwrite",
|
2067
|
-
"onConflict": "overwrite"
|
2068
|
-
}
|
2069
|
-
]
|
2070
|
-
}
|
2071
|
-
}
|
2072
|
-
```
|
2073
|
-
Pact Broker will respond with:
|
2074
|
-
```json
|
2075
|
-
{
|
2076
|
-
"status": 200,
|
2077
|
-
"headers": {
|
2078
|
-
"Content-Type": "application/hal+json;charset=utf-8"
|
2079
|
-
},
|
2080
|
-
"body": {
|
2081
|
-
"_embedded": {
|
2082
|
-
"pacticipant": {
|
2083
|
-
"name": "Foo"
|
2084
|
-
},
|
2085
|
-
"version": {
|
2086
|
-
"number": "5556b8149bf8bac76bc30f50a8a2dd4c22c85f30",
|
2087
|
-
"buildUrl": "http://build"
|
2088
|
-
}
|
2089
|
-
},
|
2090
|
-
"logs": [
|
2091
|
-
{
|
2092
|
-
"level": "info",
|
2093
|
-
"message": "some message"
|
2094
|
-
}
|
2095
|
-
],
|
2096
|
-
"_links": {
|
2097
|
-
"pb:pacticipant-version-tags": [
|
2098
|
-
{
|
2099
|
-
"name": "dev"
|
2100
|
-
}
|
2101
|
-
],
|
2102
|
-
"pb:contracts": [
|
2103
|
-
{
|
2104
|
-
"href": "http://some-pact"
|
2105
|
-
}
|
2106
|
-
]
|
2107
|
-
}
|
2108
|
-
}
|
2109
|
-
}
|
2110
|
-
```
|
2111
|
-
<a name="a_request_to_record_a_deployment_given_version_5556b8149bf8bac76bc30f50a8a2dd4c22c85f30_of_pacticipant_Foo_exists_with_a_test_environment_available_for_deployment"></a>
|
2112
|
-
Given **version 5556b8149bf8bac76bc30f50a8a2dd4c22c85f30 of pacticipant Foo exists with a test environment available for deployment**, upon receiving **a request to record a deployment** from Pact Broker Client, with
|
2113
|
-
```json
|
2114
|
-
{
|
2115
|
-
"method": "POST",
|
2116
|
-
"path": "/HAL-REL-PLACEHOLDER-PB-RECORD-DEPLOYMENT-FOO-5556B8149BF8BAC76BC30F50A8A2DD4C22C85F30-TEST",
|
2117
|
-
"headers": {
|
2118
|
-
"Content-Type": "application/json",
|
2119
|
-
"Accept": "application/hal+json"
|
2120
|
-
},
|
2121
|
-
"body": {
|
2122
|
-
"target": "blue"
|
2123
|
-
}
|
2124
|
-
}
|
2125
|
-
```
|
2126
|
-
Pact Broker will respond with:
|
2127
|
-
```json
|
2128
|
-
{
|
2129
|
-
"status": 201,
|
2130
|
-
"headers": {
|
2131
|
-
"Content-Type": "application/hal+json;charset=utf-8"
|
2132
|
-
},
|
2133
|
-
"body": {
|
2134
|
-
"target": "blue"
|
2135
|
-
}
|
2136
|
-
}
|
2137
|
-
```
|
2138
1857
|
<a name="a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_'Pricing_Service'_already_exists_in_the_pact-broker"></a>
|
2139
1858
|
Given **the 'Pricing Service' already exists in the pact-broker**, upon receiving **a request to register the repository URL of a pacticipant** from Pact Broker Client, with
|
2140
1859
|
```json
|
@@ -2,6 +2,7 @@ require 'pact_broker/client/cli/custom_thor'
|
|
2
2
|
require 'pact_broker/client/hash_refinements'
|
3
3
|
require 'thor/error'
|
4
4
|
require 'pact_broker/client/cli/environment_commands'
|
5
|
+
require 'pact_broker/client/cli/deployment_commands'
|
5
6
|
require 'pact_broker/client/cli/pacticipant_commands'
|
6
7
|
|
7
8
|
module PactBroker
|
@@ -17,9 +18,11 @@ module PactBroker
|
|
17
18
|
using PactBroker::Client::HashRefinements
|
18
19
|
if ENV.fetch("PACT_BROKER_FEATURES", "").include?("deployments")
|
19
20
|
include PactBroker::Client::CLI::EnvironmentCommands
|
21
|
+
include PactBroker::Client::CLI::DeploymentCommands
|
20
22
|
end
|
21
23
|
include PactBroker::Client::CLI::PacticipantCommands
|
22
24
|
|
25
|
+
|
23
26
|
desc 'can-i-deploy', ''
|
24
27
|
long_desc File.read(File.join(__dir__, 'can_i_deploy_long_desc.txt'))
|
25
28
|
|
@@ -170,61 +173,6 @@ module PactBroker
|
|
170
173
|
exit(1) unless result.success
|
171
174
|
end
|
172
175
|
|
173
|
-
if ENV.fetch("PACT_BROKER_FEATURES", "").include?("deployments")
|
174
|
-
ignored_and_hidden_potential_options_from_environment_variables
|
175
|
-
desc "record-deployment", "Record deployment of a pacticipant version to an environment. See https://docs.pact.io/go/record_deployment for more information."
|
176
|
-
method_option :pacticipant, required: true, aliases: "-a", desc: "The name of the pacticipant that was deployed."
|
177
|
-
method_option :version, required: true, aliases: "-e", desc: "The pacticipant version number that was deployed."
|
178
|
-
method_option :environment, required: true, desc: "The name of the environment that the pacticipant version was deployed to."
|
179
|
-
method_option :target, default: nil, required: false, desc: "Optional. The target of the deployment - a logical identifer required to differentiate deployments when there are multiple instances of the same application in an environment."
|
180
|
-
output_option_json_or_text
|
181
|
-
shared_authentication_options
|
182
|
-
|
183
|
-
def record_deployment
|
184
|
-
require 'pact_broker/client/versions/record_deployment'
|
185
|
-
params = {
|
186
|
-
pacticipant_name: options.pacticipant,
|
187
|
-
version_number: options.version,
|
188
|
-
environment_name: options.environment,
|
189
|
-
target: options.target,
|
190
|
-
output: options.output
|
191
|
-
}
|
192
|
-
result = PactBroker::Client::Versions::RecordDeployment.call(
|
193
|
-
params,
|
194
|
-
options.broker_base_url,
|
195
|
-
pact_broker_client_options
|
196
|
-
)
|
197
|
-
$stdout.puts result.message
|
198
|
-
exit(1) unless result.success
|
199
|
-
end
|
200
|
-
|
201
|
-
ignored_and_hidden_potential_options_from_environment_variables
|
202
|
-
desc "record-undeployment", "Record undeployment of (or the end of support for) a pacticipant version from an environment"
|
203
|
-
method_option :pacticipant, required: true, aliases: "-a", desc: "The name of the pacticipant that was deployed."
|
204
|
-
method_option :version, required: true, aliases: "-e", desc: "The pacticipant version number that was deployed."
|
205
|
-
method_option :environment, required: true, desc: "The name of the environment that the pacticipant version was deployed to."
|
206
|
-
output_option_json_or_text
|
207
|
-
shared_authentication_options
|
208
|
-
|
209
|
-
def record_undeployment
|
210
|
-
require 'pact_broker/client/versions/record_undeployment'
|
211
|
-
params = {
|
212
|
-
pacticipant_name: options.pacticipant,
|
213
|
-
version_number: options.version,
|
214
|
-
environment_name: options.environment,
|
215
|
-
output: options.output
|
216
|
-
}
|
217
|
-
result = PactBroker::Client::Versions::RecordUndeployment.call(
|
218
|
-
params,
|
219
|
-
options.broker_base_url,
|
220
|
-
pact_broker_client_options
|
221
|
-
)
|
222
|
-
$stdout.puts result.message
|
223
|
-
exit(1) unless result.success
|
224
|
-
end
|
225
|
-
|
226
|
-
end
|
227
|
-
|
228
176
|
ignored_and_hidden_potential_options_from_environment_variables
|
229
177
|
desc 'version', "Show the pact_broker-client gem version"
|
230
178
|
def version
|