pact_broker-client 1.73.0 → 1.75.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release_gem.yml +2 -2
  3. data/.github/workflows/test.yml +4 -1
  4. data/.github/workflows/trigger_pact_docs_update.yml +1 -1
  5. data/CHANGELOG.md +22 -0
  6. data/Gemfile +1 -0
  7. data/README.md +100 -35
  8. data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +45 -0
  9. data/doc/pacts/markdown/Pact Broker Client - Pactflow.md +1 -1
  10. data/example/scripts/publish-pact-rake.sh +10 -0
  11. data/example/scripts/publish-pact.sh +25 -1
  12. data/example/scripts/publish-provider-contract.sh +2 -1
  13. data/lib/pact_broker/client/branches/delete_branch.rb +64 -0
  14. data/lib/pact_broker/client/cli/branch_commands.rb +40 -0
  15. data/lib/pact_broker/client/cli/broker.rb +2 -1
  16. data/lib/pact_broker/client/cli/custom_thor.rb +2 -2
  17. data/lib/pact_broker/client/cli/environment_commands.rb +1 -1
  18. data/lib/pact_broker/client/cli/pact_commands.rb +35 -14
  19. data/lib/pact_broker/client/cli/version_commands.rb +2 -2
  20. data/lib/pact_broker/client/git.rb +20 -3
  21. data/lib/pact_broker/client/merge_pacts.rb +5 -2
  22. data/lib/pact_broker/client/publish_pacts_the_old_way.rb +1 -1
  23. data/lib/pact_broker/client/tasks/publication_task.rb +40 -23
  24. data/lib/pact_broker/client/version.rb +1 -1
  25. data/lib/pactflow/client/cli/provider_contract_commands.rb +1 -1
  26. data/lib/pactflow/client/provider_contracts/publish.rb +1 -1
  27. data/script/publish-provider-contract.sh +0 -1
  28. data/script/update-cli-usage-in-readme.rb +1 -0
  29. data/spec/fixtures/MyConsumer-MyProvider (1).json +37 -0
  30. data/spec/fixtures/MyConsumer-MyProvider.json +37 -0
  31. data/spec/integration/can_i_deploy_spec.rb +0 -9
  32. data/spec/lib/pact_broker/client/branches/delete_branch_spec.rb +103 -0
  33. data/spec/lib/pact_broker/client/cli/broker_publish_spec.rb +38 -21
  34. data/spec/lib/pact_broker/client/merge_pacts_spec.rb +26 -0
  35. data/spec/lib/pact_broker/client/publish_pacts_the_old_way_spec.rb +1 -3
  36. data/spec/lib/pact_broker/client/tasks/publication_task_spec.rb +54 -31
  37. data/spec/pacts/pact_broker_client-pact_broker.json +43 -0
  38. data/spec/pacts/pact_broker_client-pactflow.json +1 -1
  39. data/spec/service_providers/delete_branch_spec.rb +68 -0
  40. data/spec/service_providers/pact_helper.rb +1 -0
  41. data/spec/service_providers/pactflow_publish_provider_contract_spec.rb +1 -1
  42. data/spec/support/ssl_server.rb +1 -1
  43. data/tasks/pact.rake +79 -0
  44. metadata +14 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfeaaf44e2dc8a19f90bd55795542da931dec46853371ea5a51955ccb1f3a39f
4
- data.tar.gz: c9d00e81e65a20bc6f8a0b38c5c2af2c135e05266906f3b7bd45207a8f7e7b07
3
+ metadata.gz: c5089c183a535af491e824cdb9d198cb06150cb44d77014b09957564b9a47be7
4
+ data.tar.gz: 4d86ae219d734f0d4266214d1adca636f4557691104e75a720e8860d4103f831
5
5
  SHA512:
6
- metadata.gz: 521599522cf724dd5f0f28becbcc7faf2695c45e1050892ae0494573dc220d22427712548d4a1c5395d7caf9d59263405ff4b8158fdc2634ba8416292afc3447
7
- data.tar.gz: 987e4569edfac0db3e0bc81483b67cee1d73803422e4dea145456dd61dd7afdad2ad632190cba28eb91501069fce9aa6a49b661cb6398be8a865a6dd681a81aa
6
+ metadata.gz: 4f7e075d702ae824e91835cfbf14068c8c2938877cc0a156f7d99e8f9a577bd41d4b4507f06f714897c8f911e7c85f647f94898d4eb0ebf1ea938b270d004708
7
+ data.tar.gz: e7f787f092e10fec2166328a1bca16c7517a5a1c65179f92e4b9b71f6a97caaf0633a0ecc71f03cc0b9baaf303a86d26567a11399ff8fcd9a00d1de54685f856
@@ -29,7 +29,7 @@ jobs:
29
29
  - uses: actions/checkout@v4
30
30
  with:
31
31
  fetch-depth: 0
32
- - uses: pact-foundation/release-gem@v0.0.14
32
+ - uses: pact-foundation/release-gem@v1
33
33
  id: release
34
34
  env:
35
35
  GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_API_KEY }}'
@@ -61,7 +61,7 @@ jobs:
61
61
  runs-on: ubuntu-latest
62
62
  steps:
63
63
  - name: Notify ${{ matrix.repository }} of gem release
64
- uses: peter-evans/repository-dispatch@v1
64
+ uses: peter-evans/repository-dispatch@v2
65
65
  with:
66
66
  token: ${{ secrets.GHTOKENFORPACTCLIRELEASE }}
67
67
  repository: ${{ matrix.repository }}
@@ -1,6 +1,9 @@
1
1
  name: Test
2
2
 
3
- on: [push, pull_request]
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
4
7
 
5
8
  jobs:
6
9
  test:
@@ -16,7 +16,7 @@ jobs:
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
18
  - name: Trigger docs.pact.io update workflow
19
- uses: peter-evans/repository-dispatch@v1
19
+ uses: peter-evans/repository-dispatch@v2
20
20
  with:
21
21
  token: ${{ secrets.GHTOKENFORTRIGGERINGPACTDOCSUPDATE }}
22
22
  repository: pact-foundation/docs.pact.io
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
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
+
12
+ <a name="v1.74.0"></a>
13
+ ### v1.74.0 (2023-10-14)
14
+
15
+ #### Features
16
+
17
+ * auto detect commit sha, add shorthand -r flag (#119) ([1dac9f8](/../../commit/1dac9f8))
18
+
19
+ #### Bug Fixes
20
+
21
+ * support merging v3 pacts ([d1e01d0](/../../commit/d1e01d0))
22
+
1
23
  <a name="v1.73.0"></a>
2
24
  ### v1.73.0 (2023-10-13)
3
25
 
data/Gemfile CHANGED
@@ -25,4 +25,5 @@ end
25
25
  group :test do
26
26
  gem 'faraday', '~>2.0'
27
27
  gem 'faraday-retry', '~>2.0'
28
+ gem 'rackup', '~> 2.1'
28
29
  end
data/README.md CHANGED
@@ -59,18 +59,19 @@ In the next major version, an error will be raised by default.
59
59
 
60
60
  ```
61
61
  Usage:
62
- pact-broker publish PACT_DIRS_OR_FILES ... -a, --consumer-app-version=CONSUMER_APP_VERSION -b, --broker-base-url=BROKER_BASE_URL
62
+ pact-broker publish PACT_DIRS_OR_FILES ... -b, --broker-base-url=BROKER_BASE_URL
63
63
 
64
64
  Options:
65
- -a, --consumer-app-version=CONSUMER_APP_VERSION
65
+ -a, [--consumer-app-version=CONSUMER_APP_VERSION]
66
66
  # The consumer application version
67
67
  -h, [--branch=BRANCH]
68
68
  # Repository branch of the consumer version
69
- [--auto-detect-version-properties], [--no-auto-detect-version-properties]
70
- # Automatically detect the repository branch from known CI
71
- environment variables or git CLI. Supports Buildkite, Circle
72
- CI, Travis CI, GitHub Actions, Jenkins, Hudson, AppVeyor,
73
- GitLab, CodeShip, Bitbucket and Azure DevOps.
69
+ -r, [--auto-detect-version-properties], [--no-auto-detect-version-properties]
70
+ # Automatically detect the repository commit, branch and build
71
+ URL from known CI environment variables or git CLI. Supports
72
+ Buildkite, Circle CI, Travis CI, GitHub Actions, Jenkins,
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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. Default: false
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_&#39;Pricing_Service&#39;_and_&#39;Condor&#39;_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_&#39;Pricing_Service&#39;_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,10 @@
1
+ #!/bin/bash
2
+ # assumes you've set PACT_BROKER_BASE_URL, PACT_BROKER_TOKEN already
3
+
4
+ bundle exec rake pact:publish:pactflow_auto_on_nil_commit_nil_branch
5
+ bundle exec rake pact:publish:pactflow_auto_on_user_commit_user_branch
6
+ bundle exec rake pact:publish:pactflow_auto_on_user_commit_nil_branch
7
+ bundle exec rake pact:publish:pactflow_auto_on_nil_commit_user_branch
8
+ bundle exec rake pact:publish:pactflow_auto_off_user_commit_nil_branch
9
+ bundle exec rake pact:publish:pactflow_auto_off_nil_commit_nil_branch
10
+ bundle exec rake pact:publish:pactflow_auto_off_empty_string_commit_nil_branch
@@ -1,3 +1,27 @@
1
1
  # assumes you've set PACT_BROKER_BASE_URL, PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD already
2
+ # Must be executed from root directory of project.
2
3
 
3
- bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --consumer-app-version=1.0.0 --tag master --verbose
4
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json
5
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --auto-detect-version-properties
6
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --auto-detect-version-properties --tag-with-git-branch
7
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --branch branch-user-override
8
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --branch branch-user-override --auto-detect-version-properties
9
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --branch branch-user-override --auto-detect-version-properties --tag-with-git-branch
10
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --consumer-app-version commit-user-override
11
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --consumer-app-version commit-user-override --branch branch-user-override
12
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --consumer-app-version commit-user-override --auto-detect-version-properties
13
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --consumer-app-version commit-user-override --auto-detect-version-properties --tag-with-git-branch
14
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --consumer-app-version commit-user-override --branch branch-user-override --auto-detect-version-properties
15
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json --consumer-app-version commit-user-override --branch branch-user-override --auto-detect-version-properties --tag-with-git-branch
16
+
17
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -r
18
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -r -g
19
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -h branch-user-override
20
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -h branch-user-override -r
21
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -h branch-user-override -r -g
22
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -a commit-user-override
23
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -a commit-user-override -r
24
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -a commit-user-override -r -g
25
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -a commit-user-override -h branch-user-override
26
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -a commit-user-override -h branch-user-override -r
27
+ bundle exec bin/pact-broker publish $(dirname "$0")/pact.json -a commit-user-override -h branch-user-override -r -g
@@ -1,4 +1,5 @@
1
- # assumes you've set PACT_BROKER_BASE_URL, PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD already
1
+ # Assumes you've set PACT_BROKER_BASE_URL, PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD already
2
+ # Must be executed from root directory of project.
2
3
 
3
4
  bundle exec bin/pactflow publish-provider-contract $(dirname "$0")/oas.yml \
4
5
  --provider pactflow-cli-test-provider \
@@ -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