pact_broker-client 1.74.0 → 1.75.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/release_gem.yml +1 -1
- data/.github/workflows/test.yml +4 -1
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -0
- data/README.md +93 -28
- data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +45 -0
- data/doc/pacts/markdown/Pact Broker Client - Pactflow.md +1 -1
- data/lib/pact_broker/client/branches/delete_branch.rb +64 -0
- data/lib/pact_broker/client/cli/branch_commands.rb +40 -0
- data/lib/pact_broker/client/cli/broker.rb +2 -1
- data/lib/pact_broker/client/cli/custom_thor.rb +2 -2
- data/lib/pact_broker/client/cli/environment_commands.rb +1 -1
- data/lib/pact_broker/client/cli/pact_commands.rb +1 -1
- data/lib/pact_broker/client/cli/version_commands.rb +2 -2
- data/lib/pact_broker/client/version.rb +1 -1
- data/lib/pactflow/client/cli/provider_contract_commands.rb +1 -1
- data/lib/pactflow/client/provider_contracts/publish.rb +1 -1
- data/script/publish-provider-contract.sh +0 -1
- data/script/update-cli-usage-in-readme.rb +1 -0
- data/spec/lib/pact_broker/client/branches/delete_branch_spec.rb +103 -0
- data/spec/pacts/pact_broker_client-pact_broker.json +43 -0
- data/spec/pacts/pact_broker_client-pactflow.json +1 -1
- data/spec/service_providers/delete_branch_spec.rb +68 -0
- data/spec/service_providers/pact_helper.rb +1 -0
- data/spec/service_providers/pactflow_publish_provider_contract_spec.rb +1 -1
- data/spec/support/ssl_server.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5089c183a535af491e824cdb9d198cb06150cb44d77014b09957564b9a47be7
|
4
|
+
data.tar.gz: 4d86ae219d734f0d4266214d1adca636f4557691104e75a720e8860d4103f831
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f7e075d702ae824e91835cfbf14068c8c2938877cc0a156f7d99e8f9a577bd41d4b4507f06f714897c8f911e7c85f647f94898d4eb0ebf1ea938b270d004708
|
7
|
+
data.tar.gz: e7f787f092e10fec2166328a1bca16c7517a5a1c65179f92e4b9b71f6a97caaf0633a0ecc71f03cc0b9baaf303a86d26567a11399ff8fcd9a00d1de54685f856
|
data/.github/workflows/test.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
<a name="v1.75.0"></a>
|
2
|
+
### v1.75.0 (2023-11-11)
|
3
|
+
|
4
|
+
#### Features
|
5
|
+
|
6
|
+
* add support for delete-branch command (#151) ([6da6202](/../../commit/6da6202))
|
7
|
+
|
8
|
+
#### Bug Fixes
|
9
|
+
|
10
|
+
* set correct Accept header when publishing provider contracts ([abc8ea3](/../../commit/abc8ea3))
|
11
|
+
|
1
12
|
<a name="v1.74.0"></a>
|
2
13
|
### v1.74.0 (2023-10-14)
|
3
14
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -71,6 +71,7 @@ Options:
|
|
71
71
|
URL from known CI environment variables or git CLI. Supports
|
72
72
|
Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins,
|
73
73
|
Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps.
|
74
|
+
# Default: false
|
74
75
|
-t, [--tag=TAG]
|
75
76
|
# Tag name for consumer version. Can be specified multiple
|
76
77
|
times.
|
@@ -78,13 +79,15 @@ Options:
|
|
78
79
|
# Tag consumer version with the name of the current git branch.
|
79
80
|
Supports Buildkite, Circle CI, Travis CI, GitHub Actions,
|
80
81
|
Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and
|
81
|
-
Azure DevOps.
|
82
|
+
Azure DevOps.
|
83
|
+
# Default: false
|
82
84
|
[--build-url=BUILD_URL]
|
83
85
|
# The build URL that created the pact
|
84
86
|
[--merge], [--no-merge]
|
85
87
|
# If a pact already exists for this consumer version and
|
86
88
|
provider, merge the contents. Useful when running Pact tests
|
87
89
|
concurrently on different build nodes.
|
90
|
+
# Default: false
|
88
91
|
-o, [--output=OUTPUT]
|
89
92
|
# json or text
|
90
93
|
# Default: text
|
@@ -97,7 +100,8 @@ Options:
|
|
97
100
|
-k, [--broker-token=BROKER_TOKEN]
|
98
101
|
# Pact Broker bearer token
|
99
102
|
-v, [--verbose], [--no-verbose]
|
100
|
-
# Verbose output.
|
103
|
+
# Verbose output.
|
104
|
+
# Default: false
|
101
105
|
```
|
102
106
|
|
103
107
|
Publish pacts to a Pact Broker.
|
@@ -118,7 +122,8 @@ Options:
|
|
118
122
|
-k, [--broker-token=BROKER_TOKEN]
|
119
123
|
# Pact Broker bearer token
|
120
124
|
-v, [--verbose], [--no-verbose]
|
121
|
-
# Verbose output.
|
125
|
+
# Verbose output.
|
126
|
+
# Default: false
|
122
127
|
-o, [--output=OUTPUT]
|
123
128
|
# json or table
|
124
129
|
# Default: table
|
@@ -142,7 +147,8 @@ Options:
|
|
142
147
|
# The display name of the environment
|
143
148
|
[--production], [--no-production]
|
144
149
|
# Whether or not this environment is a production environment.
|
145
|
-
This is currently informational only.
|
150
|
+
This is currently informational only.
|
151
|
+
# Default: false
|
146
152
|
[--contact-name=CONTACT_NAME]
|
147
153
|
# The name of the team/person responsible for this environment
|
148
154
|
[--contact-email-address=CONTACT_EMAIL_ADDRESS]
|
@@ -160,7 +166,8 @@ Options:
|
|
160
166
|
-k, [--broker-token=BROKER_TOKEN]
|
161
167
|
# Pact Broker bearer token
|
162
168
|
-v, [--verbose], [--no-verbose]
|
163
|
-
# Verbose output.
|
169
|
+
# Verbose output.
|
170
|
+
# Default: false
|
164
171
|
```
|
165
172
|
|
166
173
|
Create an environment resource in the Pact Broker to represent a real world deployment or release environment.
|
@@ -181,7 +188,8 @@ Options:
|
|
181
188
|
# The display name of the environment
|
182
189
|
[--production], [--no-production]
|
183
190
|
# Whether or not this environment is a production environment.
|
184
|
-
This is currently informational only.
|
191
|
+
This is currently informational only.
|
192
|
+
# Default: false
|
185
193
|
[--contact-name=CONTACT_NAME]
|
186
194
|
# The name of the team/person responsible for this environment
|
187
195
|
[--contact-email-address=CONTACT_EMAIL_ADDRESS]
|
@@ -199,7 +207,8 @@ Options:
|
|
199
207
|
-k, [--broker-token=BROKER_TOKEN]
|
200
208
|
# Pact Broker bearer token
|
201
209
|
-v, [--verbose], [--no-verbose]
|
202
|
-
# Verbose output.
|
210
|
+
# Verbose output.
|
211
|
+
# Default: false
|
203
212
|
```
|
204
213
|
|
205
214
|
Update an environment resource in the Pact Broker.
|
@@ -225,7 +234,8 @@ Options:
|
|
225
234
|
-k, [--broker-token=BROKER_TOKEN]
|
226
235
|
# Pact Broker bearer token
|
227
236
|
-v, [--verbose], [--no-verbose]
|
228
|
-
# Verbose output.
|
237
|
+
# Verbose output.
|
238
|
+
# Default: false
|
229
239
|
```
|
230
240
|
|
231
241
|
Describe an environment
|
@@ -251,7 +261,8 @@ Options:
|
|
251
261
|
-k, [--broker-token=BROKER_TOKEN]
|
252
262
|
# Pact Broker bearer token
|
253
263
|
-v, [--verbose], [--no-verbose]
|
254
|
-
# Verbose output.
|
264
|
+
# Verbose output.
|
265
|
+
# Default: false
|
255
266
|
```
|
256
267
|
|
257
268
|
Delete an environment
|
@@ -275,7 +286,8 @@ Options:
|
|
275
286
|
-k, [--broker-token=BROKER_TOKEN]
|
276
287
|
# Pact Broker bearer token
|
277
288
|
-v, [--verbose], [--no-verbose]
|
278
|
-
# Verbose output.
|
289
|
+
# Verbose output.
|
290
|
+
# Default: false
|
279
291
|
```
|
280
292
|
|
281
293
|
List environments
|
@@ -316,7 +328,8 @@ Options:
|
|
316
328
|
-k, [--broker-token=BROKER_TOKEN]
|
317
329
|
# Pact Broker bearer token
|
318
330
|
-v, [--verbose], [--no-verbose]
|
319
|
-
# Verbose output.
|
331
|
+
# Verbose output.
|
332
|
+
# Default: false
|
320
333
|
```
|
321
334
|
|
322
335
|
Record deployment of a pacticipant version to an environment. See https://docs.pact.io/record-deployment for more information.
|
@@ -356,7 +369,8 @@ Options:
|
|
356
369
|
-k, [--broker-token=BROKER_TOKEN]
|
357
370
|
# Pact Broker bearer token
|
358
371
|
-v, [--verbose], [--no-verbose]
|
359
|
-
# Verbose output.
|
372
|
+
# Verbose output.
|
373
|
+
# Default: false
|
360
374
|
```
|
361
375
|
|
362
376
|
Description:
|
@@ -392,7 +406,8 @@ Options:
|
|
392
406
|
-k, [--broker-token=BROKER_TOKEN]
|
393
407
|
# Pact Broker bearer token
|
394
408
|
-v, [--verbose], [--no-verbose]
|
395
|
-
# Verbose output.
|
409
|
+
# Verbose output.
|
410
|
+
# Default: false
|
396
411
|
```
|
397
412
|
|
398
413
|
Record release of a pacticipant version to an environment. See See https://docs.pact.io/record-release for more information.
|
@@ -422,7 +437,8 @@ Options:
|
|
422
437
|
-k, [--broker-token=BROKER_TOKEN]
|
423
438
|
# Pact Broker bearer token
|
424
439
|
-v, [--verbose], [--no-verbose]
|
425
|
-
# Verbose output.
|
440
|
+
# Verbose output.
|
441
|
+
# Default: false
|
426
442
|
```
|
427
443
|
|
428
444
|
Record the end of support for a pacticipant version in an environment. See https://docs.pact.io/record-support-ended for more information.
|
@@ -459,6 +475,7 @@ Options:
|
|
459
475
|
# Use the latest version of the configured main branch of the
|
460
476
|
pacticipant as the version for which you want to check the
|
461
477
|
verification results
|
478
|
+
# Default: false
|
462
479
|
[--to-environment=ENVIRONMENT]
|
463
480
|
# The environment into which the pacticipant(s) are to be
|
464
481
|
deployed
|
@@ -488,6 +505,7 @@ Options:
|
|
488
505
|
is recommended to use the environment variable and just set it
|
489
506
|
for the build required to deploy that particular version, so
|
490
507
|
you don't accidentally leave the dry run mode enabled.
|
508
|
+
# Default: false
|
491
509
|
-b, --broker-base-url=BROKER_BASE_URL
|
492
510
|
# The base URL of the Pact Broker
|
493
511
|
-u, [--broker-username=BROKER_USERNAME]
|
@@ -497,7 +515,8 @@ Options:
|
|
497
515
|
-k, [--broker-token=BROKER_TOKEN]
|
498
516
|
# Pact Broker bearer token
|
499
517
|
-v, [--verbose], [--no-verbose]
|
500
|
-
# Verbose output.
|
518
|
+
# Verbose output.
|
519
|
+
# Default: false
|
501
520
|
```
|
502
521
|
|
503
522
|
Description:
|
@@ -575,6 +594,7 @@ Options:
|
|
575
594
|
is recommended to use the environment variable and just set it
|
576
595
|
for the build required to deploy that particular version, so
|
577
596
|
you don't accidentally leave the dry run mode enabled.
|
597
|
+
# Default: false
|
578
598
|
-b, --broker-base-url=BROKER_BASE_URL
|
579
599
|
# The base URL of the Pact Broker
|
580
600
|
-u, [--broker-username=BROKER_USERNAME]
|
@@ -584,7 +604,8 @@ Options:
|
|
584
604
|
-k, [--broker-token=BROKER_TOKEN]
|
585
605
|
# Pact Broker bearer token
|
586
606
|
-v, [--verbose], [--no-verbose]
|
587
|
-
# Verbose output.
|
607
|
+
# Verbose output.
|
608
|
+
# Default: false
|
588
609
|
```
|
589
610
|
|
590
611
|
Description:
|
@@ -619,7 +640,8 @@ Options:
|
|
619
640
|
-k, [--broker-token=BROKER_TOKEN]
|
620
641
|
# Pact Broker bearer token
|
621
642
|
-v, [--verbose], [--no-verbose]
|
622
|
-
# Verbose output.
|
643
|
+
# Verbose output.
|
644
|
+
# Default: false
|
623
645
|
```
|
624
646
|
|
625
647
|
Create or update pacticipant by name
|
@@ -645,7 +667,8 @@ Options:
|
|
645
667
|
-k, [--broker-token=BROKER_TOKEN]
|
646
668
|
# Pact Broker bearer token
|
647
669
|
-v, [--verbose], [--no-verbose]
|
648
|
-
# Verbose output.
|
670
|
+
# Verbose output.
|
671
|
+
# Default: false
|
649
672
|
```
|
650
673
|
|
651
674
|
Describe a pacticipant
|
@@ -669,7 +692,8 @@ Options:
|
|
669
692
|
-k, [--broker-token=BROKER_TOKEN]
|
670
693
|
# Pact Broker bearer token
|
671
694
|
-v, [--verbose], [--no-verbose]
|
672
|
-
# Verbose output.
|
695
|
+
# Verbose output.
|
696
|
+
# Default: false
|
673
697
|
```
|
674
698
|
|
675
699
|
List pacticipants
|
@@ -731,7 +755,8 @@ Options:
|
|
731
755
|
-k, [--broker-token=BROKER_TOKEN]
|
732
756
|
# Pact Broker bearer token
|
733
757
|
-v, [--verbose], [--no-verbose]
|
734
|
-
# Verbose output.
|
758
|
+
# Verbose output.
|
759
|
+
# Default: false
|
735
760
|
```
|
736
761
|
|
737
762
|
Description:
|
@@ -796,7 +821,8 @@ Options:
|
|
796
821
|
-k, [--broker-token=BROKER_TOKEN]
|
797
822
|
# Pact Broker bearer token
|
798
823
|
-v, [--verbose], [--no-verbose]
|
799
|
-
# Verbose output.
|
824
|
+
# Verbose output.
|
825
|
+
# Default: false
|
800
826
|
--uuid=UUID
|
801
827
|
# Specify the uuid for the webhook
|
802
828
|
```
|
@@ -827,11 +853,44 @@ Options:
|
|
827
853
|
-k, [--broker-token=BROKER_TOKEN]
|
828
854
|
# Pact Broker bearer token
|
829
855
|
-v, [--verbose], [--no-verbose]
|
830
|
-
# Verbose output.
|
856
|
+
# Verbose output.
|
857
|
+
# Default: false
|
831
858
|
```
|
832
859
|
|
833
860
|
Test the execution of a webhook
|
834
861
|
|
862
|
+
### Branches
|
863
|
+
|
864
|
+
#### delete-branch
|
865
|
+
|
866
|
+
```
|
867
|
+
Usage:
|
868
|
+
pact-broker delete-branch --branch=BRANCH -a, --pacticipant=PACTICIPANT -b, --broker-base-url=BROKER_BASE_URL
|
869
|
+
|
870
|
+
Options:
|
871
|
+
-a, --pacticipant=PACTICIPANT
|
872
|
+
# The name of the pacticipant that the branch belongs to.
|
873
|
+
--branch=BRANCH
|
874
|
+
# The pacticipant branch name.
|
875
|
+
[--error-when-not-found], [--no-error-when-not-found]
|
876
|
+
# Raise an error if the branch that is to be deleted is not
|
877
|
+
found.
|
878
|
+
# Default: true
|
879
|
+
-b, --broker-base-url=BROKER_BASE_URL
|
880
|
+
# The base URL of the Pact Broker
|
881
|
+
-u, [--broker-username=BROKER_USERNAME]
|
882
|
+
# Pact Broker basic auth username
|
883
|
+
-p, [--broker-password=BROKER_PASSWORD]
|
884
|
+
# Pact Broker basic auth password
|
885
|
+
-k, [--broker-token=BROKER_TOKEN]
|
886
|
+
# Pact Broker bearer token
|
887
|
+
-v, [--verbose], [--no-verbose]
|
888
|
+
# Verbose output.
|
889
|
+
# Default: false
|
890
|
+
```
|
891
|
+
|
892
|
+
Deletes a pacticipant branch. Does not delete the versions or pacts/verifications associated with the branch, but does make the pacts inaccessible for verification via consumer versions selectors or WIP pacts.
|
893
|
+
|
835
894
|
### Tags
|
836
895
|
|
837
896
|
#### create-version-tag
|
@@ -850,10 +909,12 @@ Options:
|
|
850
909
|
times.
|
851
910
|
[--auto-create-version], [--no-auto-create-version]
|
852
911
|
# Automatically create the pacticipant version if it does not
|
853
|
-
exist.
|
912
|
+
exist.
|
913
|
+
# Default: false
|
854
914
|
-g, [--tag-with-git-branch], [--no-tag-with-git-branch]
|
855
915
|
# Tag pacticipant version with the name of the current git
|
856
|
-
branch.
|
916
|
+
branch.
|
917
|
+
# Default: false
|
857
918
|
-b, --broker-base-url=BROKER_BASE_URL
|
858
919
|
# The base URL of the Pact Broker
|
859
920
|
-u, [--broker-username=BROKER_USERNAME]
|
@@ -863,7 +924,8 @@ Options:
|
|
863
924
|
-k, [--broker-token=BROKER_TOKEN]
|
864
925
|
# Pact Broker bearer token
|
865
926
|
-v, [--verbose], [--no-verbose]
|
866
|
-
# Verbose output.
|
927
|
+
# Verbose output.
|
928
|
+
# Default: false
|
867
929
|
```
|
868
930
|
|
869
931
|
Add a tag to a pacticipant version
|
@@ -896,7 +958,8 @@ Options:
|
|
896
958
|
-k, [--broker-token=BROKER_TOKEN]
|
897
959
|
# Pact Broker bearer token
|
898
960
|
-v, [--verbose], [--no-verbose]
|
899
|
-
# Verbose output.
|
961
|
+
# Verbose output.
|
962
|
+
# Default: false
|
900
963
|
```
|
901
964
|
|
902
965
|
Describes a pacticipant version. If no version or tag is specified, the latest version is described.
|
@@ -926,7 +989,8 @@ Options:
|
|
926
989
|
-k, [--broker-token=BROKER_TOKEN]
|
927
990
|
# Pact Broker bearer token
|
928
991
|
-v, [--verbose], [--no-verbose]
|
929
|
-
# Verbose output.
|
992
|
+
# Verbose output.
|
993
|
+
# Default: false
|
930
994
|
-o, [--output=OUTPUT]
|
931
995
|
# json or text
|
932
996
|
# Default: text
|
@@ -1002,7 +1066,8 @@ Options:
|
|
1002
1066
|
-k, [--broker-token=BROKER_TOKEN]
|
1003
1067
|
# Pact Broker bearer token
|
1004
1068
|
-v, [--verbose], [--no-verbose]
|
1005
|
-
# Verbose output.
|
1069
|
+
# Verbose output.
|
1070
|
+
# Default: false
|
1006
1071
|
```
|
1007
1072
|
|
1008
1073
|
Publish provider contract to PactFlow
|
@@ -38,6 +38,8 @@
|
|
38
38
|
|
39
39
|
* [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
|
40
40
|
|
41
|
+
* [A request for the index resource](#a_request_for_the_index_resource_given_the_pb:pacticipant-branch_relation_exists_in_the_index_resource) given the pb:pacticipant-branch relation exists in the index resource
|
42
|
+
|
41
43
|
* [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
|
42
44
|
|
43
45
|
* [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
|
@@ -76,6 +78,8 @@
|
|
76
78
|
|
77
79
|
* [A request to create a webhook with every possible event type](#a_request_to_create_a_webhook_with_every_possible_event_type_given_the_'Pricing_Service'_and_'Condor'_already_exist_in_the_pact-broker) given the 'Pricing Service' and 'Condor' already exist in the pact-broker
|
78
80
|
|
81
|
+
* [A request to delete a pacticipant branch](#a_request_to_delete_a_pacticipant_branch_given_a_branch_named_main_exists_for_pacticipant_Foo) given a branch named main exists for pacticipant Foo
|
82
|
+
|
79
83
|
* [A request to determine if Bar can be deployed with all Foo tagged prod, ignoring the verification for Foo version 3.4.5](#a_request_to_determine_if_Bar_can_be_deployed_with_all_Foo_tagged_prod,_ignoring_the_verification_for_Foo_version_3.4.5_given_provider_Bar_version_4.5.6_has_a_successful_verification_for_Foo_version_1.2.3_tagged_prod_and_a_failed_verification_for_version_3.4.5_tagged_prod) given provider Bar version 4.5.6 has a successful verification for Foo version 1.2.3 tagged prod and a failed verification for version 3.4.5 tagged prod
|
80
84
|
|
81
85
|
* [A request to get the Pricing Service](#a_request_to_get_the_Pricing_Service_given_the_'Pricing_Service'_already_exists_in_the_pact-broker) given the 'Pricing Service' already exists in the pact-broker
|
@@ -827,6 +831,33 @@ Pact Broker will respond with:
|
|
827
831
|
}
|
828
832
|
}
|
829
833
|
```
|
834
|
+
<a name="a_request_for_the_index_resource_given_the_pb:pacticipant-branch_relation_exists_in_the_index_resource"></a>
|
835
|
+
Given **the pb:pacticipant-branch relation exists in the index resource**, upon receiving **a request for the index resource** from Pact Broker Client, with
|
836
|
+
```json
|
837
|
+
{
|
838
|
+
"method": "GET",
|
839
|
+
"path": "/",
|
840
|
+
"headers": {
|
841
|
+
"Accept": "application/hal+json"
|
842
|
+
}
|
843
|
+
}
|
844
|
+
```
|
845
|
+
Pact Broker will respond with:
|
846
|
+
```json
|
847
|
+
{
|
848
|
+
"status": 200,
|
849
|
+
"headers": {
|
850
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
851
|
+
},
|
852
|
+
"body": {
|
853
|
+
"_links": {
|
854
|
+
"pb:pacticipant-branch": {
|
855
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-BRANCH-{pacticipant}-{branch}"
|
856
|
+
}
|
857
|
+
}
|
858
|
+
}
|
859
|
+
}
|
860
|
+
```
|
830
861
|
<a name="a_request_for_the_index_resource_given_the_pb:pacticipant-version_and_pb:environments_relations_exist_in_the_index_resource"></a>
|
831
862
|
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
|
832
863
|
```json
|
@@ -1766,6 +1797,20 @@ Pact Broker will respond with:
|
|
1766
1797
|
}
|
1767
1798
|
}
|
1768
1799
|
```
|
1800
|
+
<a name="a_request_to_delete_a_pacticipant_branch_given_a_branch_named_main_exists_for_pacticipant_Foo"></a>
|
1801
|
+
Given **a branch named main exists for pacticipant Foo**, upon receiving **a request to delete a pacticipant branch** from Pact Broker Client, with
|
1802
|
+
```json
|
1803
|
+
{
|
1804
|
+
"method": "DELETE",
|
1805
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-BRANCH-Foo-main"
|
1806
|
+
}
|
1807
|
+
```
|
1808
|
+
Pact Broker will respond with:
|
1809
|
+
```json
|
1810
|
+
{
|
1811
|
+
"status": 204
|
1812
|
+
}
|
1813
|
+
```
|
1769
1814
|
<a name="a_request_to_determine_if_Bar_can_be_deployed_with_all_Foo_tagged_prod,_ignoring_the_verification_for_Foo_version_3.4.5_given_provider_Bar_version_4.5.6_has_a_successful_verification_for_Foo_version_1.2.3_tagged_prod_and_a_failed_verification_for_version_3.4.5_tagged_prod"></a>
|
1770
1815
|
Given **provider Bar version 4.5.6 has a successful verification for Foo version 1.2.3 tagged prod and a failed verification for version 3.4.5 tagged prod**, upon receiving **a request to determine if Bar can be deployed with all Foo tagged prod, ignoring the verification for Foo version 3.4.5** from Pact Broker Client, with
|
1771
1816
|
```json
|
@@ -210,7 +210,7 @@ Upon receiving **a request to publish a provider contract** from Pact Broker Cli
|
|
210
210
|
"path": "/HAL-REL-PLACEHOLDER-PF-PUBLISH-PROVIDER-CONTRACT-Bar",
|
211
211
|
"headers": {
|
212
212
|
"Content-Type": "application/json",
|
213
|
-
"Accept": "application/hal+json"
|
213
|
+
"Accept": "application/hal+json,application/problem+json"
|
214
214
|
},
|
215
215
|
"body": {
|
216
216
|
"pacticipantVersionNumber": "1",
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "pact_broker/client/base_command"
|
2
|
+
|
3
|
+
module PactBroker
|
4
|
+
module Client
|
5
|
+
module Branches
|
6
|
+
class DeleteBranch < PactBroker::Client::BaseCommand
|
7
|
+
|
8
|
+
NOT_SUPPORTED_MESSAGE_PACT_BROKER = "This version of the Pact Broker does not support deleting branches. Please upgrade to version 2.108.0 or later."
|
9
|
+
NOT_SUPPORTED_MESSAGE_PACTFLOW = "This version of PactFlow does not support deleting branches. Please upgrade to the latest version."
|
10
|
+
|
11
|
+
def initialize(params, options, pact_broker_client_options)
|
12
|
+
super
|
13
|
+
@pacticipant_name = params.fetch(:pacticipant)
|
14
|
+
@branch_name = params.fetch(:branch)
|
15
|
+
@error_when_not_found = params.fetch(:error_when_not_found)
|
16
|
+
end
|
17
|
+
|
18
|
+
def do_call
|
19
|
+
check_if_command_supported
|
20
|
+
@deleted_resource = branch_link.delete
|
21
|
+
PactBroker::Client::CommandResult.new(success?, result_message)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :pacticipant_name, :branch_name, :error_when_not_found, :deleted_resource
|
27
|
+
|
28
|
+
def branch_link
|
29
|
+
index_resource._link("pb:pacticipant-branch").expand(pacticipant: pacticipant_name, branch: branch_name)
|
30
|
+
end
|
31
|
+
|
32
|
+
def check_if_command_supported
|
33
|
+
unless index_resource.can?("pb:pacticipant-branch")
|
34
|
+
raise PactBroker::Client::Error.new(is_pactflow? ? NOT_SUPPORTED_MESSAGE_PACTFLOW : NOT_SUPPORTED_MESSAGE_PACT_BROKER)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def success?
|
39
|
+
if deleted_resource.success?
|
40
|
+
true
|
41
|
+
elsif deleted_resource.response.status == 404 && !error_when_not_found
|
42
|
+
true
|
43
|
+
else
|
44
|
+
false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def result_message
|
49
|
+
if deleted_resource.success?
|
50
|
+
green("Successfully deleted branch #{branch_name} of pacticipant #{pacticipant_name}")
|
51
|
+
elsif deleted_resource.response.status == 404
|
52
|
+
if error_when_not_found
|
53
|
+
red("Could not delete branch #{branch_name} of pacticipant #{pacticipant_name} as it was not found")
|
54
|
+
else
|
55
|
+
green("Branch #{branch_name} of pacticipant #{pacticipant_name} not found")
|
56
|
+
end
|
57
|
+
else
|
58
|
+
red(deleted_resource.response.raw_body)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module PactBroker
|
2
|
+
module Client
|
3
|
+
module CLI
|
4
|
+
module BranchCommands
|
5
|
+
def self.included(thor)
|
6
|
+
thor.class_eval do
|
7
|
+
method_option :pacticipant, required: true, aliases: "-a", desc: "The name of the pacticipant that the branch belongs to."
|
8
|
+
method_option :branch, required: true, desc: "The pacticipant branch name."
|
9
|
+
method_option :error_when_not_found, type: :boolean, default: true, desc: "Raise an error if the branch that is to be deleted is not found."
|
10
|
+
shared_authentication_options
|
11
|
+
|
12
|
+
desc "delete-branch", "Deletes a pacticipant branch. Does not delete the versions or pacts/verifications associated with the branch, but does make the pacts inaccessible for verification via consumer versions selectors or WIP pacts."
|
13
|
+
|
14
|
+
def delete_branch
|
15
|
+
require "pact_broker/client/branches/delete_branch"
|
16
|
+
|
17
|
+
validate_credentials
|
18
|
+
params = {
|
19
|
+
pacticipant: options.pacticipant,
|
20
|
+
branch: options.branch,
|
21
|
+
error_when_not_found: options.error_when_not_found
|
22
|
+
}
|
23
|
+
|
24
|
+
result = PactBroker::Client::Branches::DeleteBranch.call(params, {}, pact_broker_client_options)
|
25
|
+
$stdout.puts result.message
|
26
|
+
exit(1) unless result.success
|
27
|
+
end
|
28
|
+
|
29
|
+
no_commands do
|
30
|
+
def validate_delete_branch_params
|
31
|
+
raise ::Thor::RequiredArgumentMissingError, "Pacticipant name cannot be blank" if options.pacticipant.strip.size == 0
|
32
|
+
raise ::Thor::RequiredArgumentMissingError, "Pacticipant branch name cannot be blank" if options.branch.strip.size == 0
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -8,7 +8,7 @@ require "pact_broker/client/cli/pacticipant_commands"
|
|
8
8
|
require "pact_broker/client/cli/version_commands"
|
9
9
|
require "pact_broker/client/cli/webhook_commands"
|
10
10
|
require "pact_broker/client/cli/matrix_commands"
|
11
|
-
|
11
|
+
require "pact_broker/client/cli/branch_commands"
|
12
12
|
module PactBroker
|
13
13
|
module Client
|
14
14
|
module CLI
|
@@ -19,6 +19,7 @@ module PactBroker
|
|
19
19
|
include PactBroker::Client::CLI::MatrixCommands
|
20
20
|
include PactBroker::Client::CLI::PacticipantCommands
|
21
21
|
include PactBroker::Client::CLI::VersionCommands
|
22
|
+
include PactBroker::Client::CLI::BranchCommands
|
22
23
|
include PactBroker::Client::CLI::WebhookCommands
|
23
24
|
|
24
25
|
ignored_and_hidden_potential_options_from_environment_variables
|
@@ -126,11 +126,11 @@ module PactBroker
|
|
126
126
|
method_option :broker_username, aliases: "-u", desc: "Pact Broker basic auth username"
|
127
127
|
method_option :broker_password, aliases: "-p", desc: "Pact Broker basic auth password"
|
128
128
|
method_option :broker_token, aliases: "-k", desc: "Pact Broker bearer token"
|
129
|
-
method_option :verbose, aliases: "-v", type: :boolean, default: false, required: false, desc: "Verbose output.
|
129
|
+
method_option :verbose, aliases: "-v", type: :boolean, default: false, required: false, desc: "Verbose output."
|
130
130
|
end
|
131
131
|
|
132
132
|
def self.verbose_option
|
133
|
-
method_option :verbose, aliases: "-v", type: :boolean, default: false, required: false, desc: "Verbose output.
|
133
|
+
method_option :verbose, aliases: "-v", type: :boolean, default: false, required: false, desc: "Verbose output."
|
134
134
|
end
|
135
135
|
|
136
136
|
def self.output_option_json_or_text
|
@@ -9,7 +9,7 @@ module PactBroker
|
|
9
9
|
def self.shared_environment_options(name_required: false)
|
10
10
|
method_option :name, required: name_required, desc: "The uniquely identifying name of the environment as used in deployment code"
|
11
11
|
method_option :display_name, desc: "The display name of the environment"
|
12
|
-
method_option :production, type: :boolean, default: false, desc: "Whether or not this environment is a production environment. This is currently informational only.
|
12
|
+
method_option :production, type: :boolean, default: false, desc: "Whether or not this environment is a production environment. This is currently informational only."
|
13
13
|
method_option :contact_name, required: false, desc: "The name of the team/person responsible for this environment"
|
14
14
|
method_option :contact_email_address, required: false, desc: "The email address of the team/person responsible for this environment"
|
15
15
|
output_option_json_or_text
|
@@ -18,7 +18,7 @@ module PactBroker
|
|
18
18
|
method_option :branch, aliases: "-h", desc: "Repository branch of the consumer version"
|
19
19
|
method_option :auto_detect_version_properties, aliases: "-r", type: :boolean, default: false, desc: "Automatically detect the repository commit, branch and build URL from known CI environment variables or git CLI. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps."
|
20
20
|
method_option :tag, aliases: "-t", type: :array, banner: "TAG", desc: "Tag name for consumer version. Can be specified multiple times."
|
21
|
-
method_option :tag_with_git_branch, aliases: "-g", type: :boolean, default: false, required: false, desc: "Tag consumer version with the name of the current git branch. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps.
|
21
|
+
method_option :tag_with_git_branch, aliases: "-g", type: :boolean, default: false, required: false, desc: "Tag consumer version with the name of the current git branch. Supports Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor, GitLab, CodeShip, Bitbucket and Azure DevOps."
|
22
22
|
method_option :build_url, desc: "The build URL that created the pact"
|
23
23
|
method_option :merge, type: :boolean, default: false, require: false, desc: "If a pact already exists for this consumer version and provider, merge the contents. Useful when running Pact tests concurrently on different build nodes."
|
24
24
|
output_option_json_or_text
|
@@ -59,8 +59,8 @@ module PactBroker
|
|
59
59
|
method_option :pacticipant, required: true, aliases: "-a", desc: "The pacticipant name"
|
60
60
|
method_option :version, required: true, aliases: "-e", desc: "The pacticipant version"
|
61
61
|
method_option :tag, aliases: "-t", type: :array, banner: "TAG", desc: "Tag name for pacticipant version. Can be specified multiple times."
|
62
|
-
method_option :auto_create_version, type: :boolean, default: false, desc: "Automatically create the pacticipant version if it does not exist.
|
63
|
-
method_option :tag_with_git_branch, aliases: "-g", type: :boolean, default: false, required: false, desc: "Tag pacticipant version with the name of the current git branch.
|
62
|
+
method_option :auto_create_version, type: :boolean, default: false, desc: "Automatically create the pacticipant version if it does not exist."
|
63
|
+
method_option :tag_with_git_branch, aliases: "-g", type: :boolean, default: false, required: false, desc: "Tag pacticipant version with the name of the current git branch."
|
64
64
|
shared_authentication_options
|
65
65
|
|
66
66
|
def create_version_tag
|
@@ -16,7 +16,7 @@ module Pactflow
|
|
16
16
|
method_option :branch, aliases: "-h", desc: "Repository branch of the provider version"
|
17
17
|
#method_option :auto_detect_version_properties, hidden: true, type: :boolean, default: false, desc: "Automatically detect the repository branch from known CI environment variables or git CLI."
|
18
18
|
method_option :tag, aliases: "-t", type: :array, banner: "TAG", desc: "Tag name for provider version. Can be specified multiple times."
|
19
|
-
#method_option :tag_with_git_branch, aliases: "-g", type: :boolean, default: false, required: false, desc: "Tag consumer version with the name of the current git branch.
|
19
|
+
#method_option :tag_with_git_branch, aliases: "-g", type: :boolean, default: false, required: false, desc: "Tag consumer version with the name of the current git branch."
|
20
20
|
method_option :specification, default: "oas", desc: "The contract specification"
|
21
21
|
method_option :content_type, desc: "The content type. eg. application/yml"
|
22
22
|
method_option :verification_success, type: :boolean, desc: "Whether or not the self verification passed successfully."
|
@@ -39,7 +39,7 @@ module Pactflow
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def publish_provider_contracts
|
42
|
-
@response_entity = index_resource._link(PUBLISH_RELATION).expand(provider: provider_name).post!(contract_params,
|
42
|
+
@response_entity = index_resource._link(PUBLISH_RELATION).expand(provider: provider_name).post!(contract_params, { "Accept" => "application/hal+json,application/problem+json" })
|
43
43
|
end
|
44
44
|
|
45
45
|
def contract_params
|
@@ -6,7 +6,6 @@ bundle exec bin/pactflow publish-provider-contract \
|
|
6
6
|
--branch main \
|
7
7
|
--tag dev \
|
8
8
|
--specification oas \
|
9
|
-
--content-type application/yml \
|
10
9
|
--verification-exit-code 0 \
|
11
10
|
--verification-results script/verification-results.txt \
|
12
11
|
--verification-results-content-type text/plain \
|
@@ -23,6 +23,7 @@ PACT_BROKER_COMMAND_GROUPS = [
|
|
23
23
|
[PactBroker::Client::CLI::Broker, "Matrix", %w[can-i-deploy can-i-merge]],
|
24
24
|
[PactBroker::Client::CLI::Broker, "Pacticipants", %w[create-or-update-pacticipant describe-pacticipant list-pacticipants]],
|
25
25
|
[PactBroker::Client::CLI::Broker, "Webhooks", %w[create-webhook create-or-update-webhook test-webhook]],
|
26
|
+
[PactBroker::Client::CLI::Broker, "Branches", %w[delete-branch]],
|
26
27
|
[PactBroker::Client::CLI::Broker, "Tags", %w[create-version-tag]],
|
27
28
|
[PactBroker::Client::CLI::Broker, "Versions", %w[describe-version create-or-update-version]],
|
28
29
|
[PactBroker::Client::CLI::Broker, "Miscellaneous", %w[generate-uuid]]
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require "pact_broker/client/branches/delete_branch"
|
2
|
+
|
3
|
+
module PactBroker
|
4
|
+
module Client
|
5
|
+
module Branches
|
6
|
+
describe DeleteBranch do
|
7
|
+
before do
|
8
|
+
allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:sleep)
|
9
|
+
allow_any_instance_of(PactBroker::Client::Hal::HttpClient).to receive(:default_max_tries).and_return(1)
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:params) do
|
13
|
+
{
|
14
|
+
pacticipant: "Foo",
|
15
|
+
branch: "main",
|
16
|
+
error_when_not_found: error_when_not_found
|
17
|
+
}
|
18
|
+
end
|
19
|
+
let(:options) do
|
20
|
+
{
|
21
|
+
verbose: verbose
|
22
|
+
}
|
23
|
+
end
|
24
|
+
let(:error_when_not_found) { true }
|
25
|
+
let(:pact_broker_base_url) { "http://example.org" }
|
26
|
+
let(:pact_broker_client_options) { { pact_broker_base_url: pact_broker_base_url } }
|
27
|
+
let(:response_headers) { { "Content-Type" => "application/hal+json"} }
|
28
|
+
let(:verbose) { false }
|
29
|
+
|
30
|
+
before do
|
31
|
+
stub_request(:get, "http://example.org/").to_return(status: 200, body: index_response_body, headers: response_headers)
|
32
|
+
stub_request(:delete, "http://example.org/pacticipants/Foo/branches/main").to_return(status: delete_response_status, body: delete_response_body, headers: response_headers)
|
33
|
+
end
|
34
|
+
let(:delete_response_status) { 200 }
|
35
|
+
|
36
|
+
let(:index_response_body) do
|
37
|
+
{
|
38
|
+
"_links" => {
|
39
|
+
"pb:pacticipant-branch" => {
|
40
|
+
"href" => "http://example.org/pacticipants/{pacticipant}/branches/{branch}"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}.to_json
|
44
|
+
end
|
45
|
+
|
46
|
+
let(:delete_response_body) do
|
47
|
+
{ "some" => "error message" }.to_json
|
48
|
+
end
|
49
|
+
|
50
|
+
subject { DeleteBranch.call(params, options, pact_broker_client_options) }
|
51
|
+
|
52
|
+
context "when the branch is deleted" do
|
53
|
+
it "returns a success result" do
|
54
|
+
expect(subject.success).to be true
|
55
|
+
expect(subject.message).to include "Successfully deleted branch main of pacticipant Foo"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "when there is a non-404 error" do
|
60
|
+
let(:delete_response_status) { 403 }
|
61
|
+
|
62
|
+
it "returns an error result with the response body" do
|
63
|
+
expect(subject.success).to be false
|
64
|
+
expect(subject.message).to include "error message"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "when the branch is not found" do
|
69
|
+
let(:delete_response_status) { 404 }
|
70
|
+
|
71
|
+
context "when error_when_not_found is true" do
|
72
|
+
it "returns an error" do
|
73
|
+
expect(subject.success).to be false
|
74
|
+
expect(subject.message).to include "Could not delete branch main of pacticipant Foo as it was not found"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "when error_when_not_found is false" do
|
79
|
+
let(:error_when_not_found) { false }
|
80
|
+
|
81
|
+
it "return a success" do
|
82
|
+
expect(subject.success).to be true
|
83
|
+
expect(subject.message).to include "Branch main of pacticipant Foo not found"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context "when deleting branches is not supported" do
|
89
|
+
let(:index_response_body) do
|
90
|
+
{
|
91
|
+
_links: {}
|
92
|
+
}.to_json
|
93
|
+
end
|
94
|
+
|
95
|
+
it "returns an error" do
|
96
|
+
expect(subject.success).to be false
|
97
|
+
expect(subject.message).to include "not support"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -6,6 +6,49 @@
|
|
6
6
|
"name": "Pact Broker"
|
7
7
|
},
|
8
8
|
"interactions": [
|
9
|
+
{
|
10
|
+
"description": "a request for the index resource",
|
11
|
+
"providerState": "the pb:pacticipant-branch relation exists in the index resource",
|
12
|
+
"request": {
|
13
|
+
"method": "GET",
|
14
|
+
"path": "/",
|
15
|
+
"headers": {
|
16
|
+
"Accept": "application/hal+json"
|
17
|
+
}
|
18
|
+
},
|
19
|
+
"response": {
|
20
|
+
"status": 200,
|
21
|
+
"headers": {
|
22
|
+
"Content-Type": "application/hal+json;charset=utf-8"
|
23
|
+
},
|
24
|
+
"body": {
|
25
|
+
"_links": {
|
26
|
+
"pb:pacticipant-branch": {
|
27
|
+
"href": "http://localhost:1234/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-BRANCH-{pacticipant}-{branch}"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"matchingRules": {
|
32
|
+
"$.body._links.pb:pacticipant-branch.href": {
|
33
|
+
"match": "regex",
|
34
|
+
"regex": "http:\\/\\/.*{pacticipant}.*{branch}"
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"description": "a request to delete a pacticipant branch",
|
41
|
+
"providerState": "a branch named main exists for pacticipant Foo",
|
42
|
+
"request": {
|
43
|
+
"method": "DELETE",
|
44
|
+
"path": "/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-BRANCH-Foo-main"
|
45
|
+
},
|
46
|
+
"response": {
|
47
|
+
"status": 204,
|
48
|
+
"headers": {
|
49
|
+
}
|
50
|
+
}
|
51
|
+
},
|
9
52
|
{
|
10
53
|
"description": "a request to list the latest pacts",
|
11
54
|
"providerState": "a pact between Condor and the Pricing Service exists",
|
@@ -43,7 +43,7 @@
|
|
43
43
|
"path": "/HAL-REL-PLACEHOLDER-PF-PUBLISH-PROVIDER-CONTRACT-Bar",
|
44
44
|
"headers": {
|
45
45
|
"Content-Type": "application/json",
|
46
|
-
"Accept": "application/hal+json"
|
46
|
+
"Accept": "application/hal+json,application/problem+json"
|
47
47
|
},
|
48
48
|
"body": {
|
49
49
|
"pacticipantVersionNumber": "1",
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require "service_providers/pact_helper"
|
2
|
+
require "pact_broker/client/branches/delete_branch"
|
3
|
+
|
4
|
+
RSpec.describe "delete a branch", pact: true do
|
5
|
+
include_context "pact broker"
|
6
|
+
include PactBrokerPactHelperMethods
|
7
|
+
|
8
|
+
let(:params) do
|
9
|
+
{
|
10
|
+
pacticipant: "Foo",
|
11
|
+
branch: "main",
|
12
|
+
error_when_not_found: true
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:options) do
|
17
|
+
{
|
18
|
+
verbose: verbose
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
let(:pact_broker_base_url) { pact_broker.mock_service_base_url }
|
23
|
+
let(:pact_broker_client_options) { { pact_broker_base_url: pact_broker_base_url } }
|
24
|
+
let(:response_headers) { { "Content-Type" => "application/hal+json"} }
|
25
|
+
let(:verbose) { false }
|
26
|
+
|
27
|
+
subject { PactBroker::Client::Branches::DeleteBranch.call(params, options, pact_broker_client_options) }
|
28
|
+
|
29
|
+
def mock_index
|
30
|
+
pact_broker
|
31
|
+
.given("the pb:pacticipant-branch relation exists in the index resource")
|
32
|
+
.upon_receiving("a request for the index resource")
|
33
|
+
.with(
|
34
|
+
method: "GET",
|
35
|
+
path: '/',
|
36
|
+
headers: get_request_headers).
|
37
|
+
will_respond_with(
|
38
|
+
status: 200,
|
39
|
+
headers: pact_broker_response_headers,
|
40
|
+
body: {
|
41
|
+
_links: {
|
42
|
+
:'pb:pacticipant-branch' => {
|
43
|
+
href: placeholder_url_term("pb:pacticipant-branch", ["pacticipant", "branch"], pact_broker)
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def mock_branch_delete_request
|
51
|
+
pact_broker
|
52
|
+
.given("a branch named main exists for pacticipant Foo")
|
53
|
+
.upon_receiving("a request to delete a pacticipant branch")
|
54
|
+
.with(
|
55
|
+
method: "DELETE",
|
56
|
+
path: placeholder_path("pb:pacticipant-branch", ["Foo", "main"])
|
57
|
+
)
|
58
|
+
.will_respond_with(
|
59
|
+
status: 204
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "returns a success result" do
|
64
|
+
mock_index
|
65
|
+
mock_branch_delete_request
|
66
|
+
expect(subject.success).to be true
|
67
|
+
end
|
68
|
+
end
|
@@ -123,7 +123,7 @@ RSpec.describe "publishing a provider contract to PactFlow", pact: true do
|
|
123
123
|
.with(
|
124
124
|
method: :post,
|
125
125
|
path: placeholder_path("pf:publish-provider-contract", ["Bar"]),
|
126
|
-
headers: post_request_headers,
|
126
|
+
headers: post_request_headers.merge("Accept" => "application/hal+json,application/problem+json"),
|
127
127
|
body: request_body
|
128
128
|
).will_respond_with(success_response)
|
129
129
|
end
|
data/spec/support/ssl_server.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact_broker-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.75.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: 2023-
|
11
|
+
date: 2023-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -155,7 +155,9 @@ files:
|
|
155
155
|
- lib/pact_broker/client/backports.rb
|
156
156
|
- lib/pact_broker/client/base_client.rb
|
157
157
|
- lib/pact_broker/client/base_command.rb
|
158
|
+
- lib/pact_broker/client/branches/delete_branch.rb
|
158
159
|
- lib/pact_broker/client/can_i_deploy.rb
|
160
|
+
- lib/pact_broker/client/cli/branch_commands.rb
|
159
161
|
- lib/pact_broker/client/cli/broker.rb
|
160
162
|
- lib/pact_broker/client/cli/can_i_deploy_long_desc.txt
|
161
163
|
- lib/pact_broker/client/cli/create_or_update_webhook_long_desc.txt
|
@@ -281,6 +283,7 @@ files:
|
|
281
283
|
- spec/integration/publish_provider_contract_spec.rb
|
282
284
|
- spec/integration/unknown_options_spec.rb
|
283
285
|
- spec/lib/pact_broker/client/base_client_spec.rb
|
286
|
+
- spec/lib/pact_broker/client/branches/delete_branch_spec.rb
|
284
287
|
- spec/lib/pact_broker/client/can_i_deploy_spec.rb
|
285
288
|
- spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb
|
286
289
|
- spec/lib/pact_broker/client/cli/broker_create_or_update_webhook_spec.rb
|
@@ -321,6 +324,7 @@ files:
|
|
321
324
|
- spec/pacts/pact_broker_client-pactflow.json
|
322
325
|
- spec/readme_spec.rb
|
323
326
|
- spec/service_providers/create_environment_spec.rb
|
327
|
+
- spec/service_providers/delete_branch_spec.rb
|
324
328
|
- spec/service_providers/extra_goodies_spec.rb
|
325
329
|
- spec/service_providers/list_environments_spec.rb
|
326
330
|
- spec/service_providers/list_latest_pact_versions_spec.rb.bak
|
@@ -377,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
377
381
|
- !ruby/object:Gem::Version
|
378
382
|
version: '0'
|
379
383
|
requirements: []
|
380
|
-
rubygems_version: 3.4.
|
384
|
+
rubygems_version: 3.4.22
|
381
385
|
signing_key:
|
382
386
|
specification_version: 4
|
383
387
|
summary: See description
|
@@ -407,6 +411,7 @@ test_files:
|
|
407
411
|
- spec/integration/publish_provider_contract_spec.rb
|
408
412
|
- spec/integration/unknown_options_spec.rb
|
409
413
|
- spec/lib/pact_broker/client/base_client_spec.rb
|
414
|
+
- spec/lib/pact_broker/client/branches/delete_branch_spec.rb
|
410
415
|
- spec/lib/pact_broker/client/can_i_deploy_spec.rb
|
411
416
|
- spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb
|
412
417
|
- spec/lib/pact_broker/client/cli/broker_create_or_update_webhook_spec.rb
|
@@ -447,6 +452,7 @@ test_files:
|
|
447
452
|
- spec/pacts/pact_broker_client-pactflow.json
|
448
453
|
- spec/readme_spec.rb
|
449
454
|
- spec/service_providers/create_environment_spec.rb
|
455
|
+
- spec/service_providers/delete_branch_spec.rb
|
450
456
|
- spec/service_providers/extra_goodies_spec.rb
|
451
457
|
- spec/service_providers/list_environments_spec.rb
|
452
458
|
- spec/service_providers/list_latest_pact_versions_spec.rb.bak
|