pact_broker-client 1.44.0 → 1.47.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +15 -1
  3. data/CHANGELOG.md +36 -0
  4. data/README.md +54 -54
  5. data/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +315 -1
  6. data/doc/pacts/markdown/Pact Broker Client - Pactflow.md +94 -0
  7. data/doc/pacts/markdown/README.md +1 -0
  8. data/lib/pact_broker/client/base_command.rb +3 -0
  9. data/lib/pact_broker/client/can_i_deploy.rb +40 -5
  10. data/lib/pact_broker/client/cli/broker.rb +7 -137
  11. data/lib/pact_broker/client/cli/custom_thor.rb +0 -16
  12. data/lib/pact_broker/client/cli/deployment_commands.rb +25 -5
  13. data/lib/pact_broker/client/cli/matrix_commands.rb +93 -0
  14. data/lib/pact_broker/client/cli/webhook_commands.rb +122 -0
  15. data/lib/pact_broker/client/deployments.rb +4 -4
  16. data/lib/pact_broker/client/deployments/record_support_ended.rb +103 -0
  17. data/lib/pact_broker/client/deployments/record_undeployment.rb +43 -36
  18. data/lib/pact_broker/client/hal/entity.rb +17 -2
  19. data/lib/pact_broker/client/matrix/resource.rb +4 -0
  20. data/lib/pact_broker/client/pacticipants/create.rb +1 -1
  21. data/lib/pact_broker/client/verification_required.rb +34 -0
  22. data/lib/pact_broker/client/version.rb +1 -1
  23. data/lib/pact_broker/client/webhooks/create.rb +14 -8
  24. data/script/record-deployment.sh +1 -1
  25. data/script/record-deployments-and-releases.sh +11 -5
  26. data/script/record-undeployment.sh +1 -1
  27. data/script/webhook-commands.sh +12 -0
  28. data/spec/fixtures/approvals/can_i_deploy_failure_dry_run.approved.txt +7 -0
  29. data/spec/fixtures/approvals/can_i_deploy_success_dry_run.approved.txt +7 -0
  30. data/spec/lib/pact_broker/client/can_i_deploy_spec.rb +62 -2
  31. data/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +15 -2
  32. data/spec/lib/pact_broker/client/cli/broker_run_webhook_commands_spec.rb +4 -2
  33. data/spec/lib/pact_broker/client/deployments/record_support_ended_spec.rb +208 -0
  34. data/spec/lib/pact_broker/client/deployments/record_undeployment_spec.rb +219 -0
  35. data/spec/pacts/pact_broker_client-pact_broker.json +317 -1
  36. data/spec/pacts/pact_broker_client-pactflow.json +118 -0
  37. data/spec/service_providers/pact_broker_client_register_repository_spec.rb +2 -2
  38. data/spec/service_providers/pact_helper.rb +15 -10
  39. data/spec/service_providers/pactflow_webhooks_create_spec.rb +86 -0
  40. data/spec/service_providers/record_deployment_spec.rb +1 -3
  41. data/spec/service_providers/record_release_spec.rb +2 -7
  42. data/spec/service_providers/record_undeployment_spec.rb +164 -0
  43. data/spec/service_providers/webhooks_create_spec.rb +1 -1
  44. data/spec/spec_helper.rb +1 -0
  45. data/spec/support/shared_context.rb +2 -1
  46. data/tasks/pact.rake +8 -6
  47. metadata +23 -3
@@ -0,0 +1,94 @@
1
+ ### A pact between Pact Broker Client and Pactflow
2
+
3
+ #### Requests from Pact Broker Client to Pactflow
4
+
5
+ * [A request for the index resource](#a_request_for_the_index_resource)
6
+
7
+ * [A request to create a webhook for a team](#a_request_to_create_a_webhook_for_a_team_given_a_team_with_UUID_2abbc12a-427d-432a-a521-c870af1739d9_exists) given a team with UUID 2abbc12a-427d-432a-a521-c870af1739d9 exists
8
+
9
+ #### Interactions
10
+
11
+ <a name="a_request_for_the_index_resource"></a>
12
+ Upon receiving **a request for the index resource** from Pact Broker Client, with
13
+ ```json
14
+ {
15
+ "method": "get",
16
+ "path": "/",
17
+ "headers": {
18
+ "Accept": "application/hal+json"
19
+ }
20
+ }
21
+ ```
22
+ Pactflow will respond with:
23
+ ```json
24
+ {
25
+ "status": 200,
26
+ "headers": {
27
+ "Content-Type": "application/hal+json;charset=utf-8"
28
+ },
29
+ "body": {
30
+ "_links": {
31
+ "pb:webhooks": {
32
+ "href": "http://localhost:1235/HAL-REL-PLACEHOLDER-PB-WEBHOOKS"
33
+ },
34
+ "pb:pacticipants": {
35
+ "href": "http://localhost:1235/HAL-REL-PLACEHOLDER-PB-PACTICIPANTS"
36
+ },
37
+ "pb:pacticipant": {
38
+ "href": "http://localhost:1235/HAL-REL-PLACEHOLDER-PB-PACTICIPANT-{pacticipant}"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ ```
44
+ <a name="a_request_to_create_a_webhook_for_a_team_given_a_team_with_UUID_2abbc12a-427d-432a-a521-c870af1739d9_exists"></a>
45
+ Given **a team with UUID 2abbc12a-427d-432a-a521-c870af1739d9 exists**, upon receiving **a request to create a webhook for a team** from Pact Broker Client, with
46
+ ```json
47
+ {
48
+ "method": "post",
49
+ "path": "/HAL-REL-PLACEHOLDER-PB-WEBHOOKS",
50
+ "headers": {
51
+ "Content-Type": "application/json",
52
+ "Accept": "application/hal+json"
53
+ },
54
+ "body": {
55
+ "description": "a webhook",
56
+ "events": [
57
+ {
58
+ "name": "contract_content_changed"
59
+ }
60
+ ],
61
+ "request": {
62
+ "url": "https://webhook",
63
+ "method": "POST",
64
+ "headers": {
65
+ "Foo": "bar",
66
+ "Bar": "foo"
67
+ },
68
+ "body": {
69
+ "some": "body"
70
+ }
71
+ },
72
+ "teamUuid": "2abbc12a-427d-432a-a521-c870af1739d9"
73
+ }
74
+ }
75
+ ```
76
+ Pactflow will respond with:
77
+ ```json
78
+ {
79
+ "status": 201,
80
+ "headers": {
81
+ "Content-Type": "application/hal+json;charset=utf-8"
82
+ },
83
+ "body": {
84
+ "description": "a webhook",
85
+ "teamUuid": "2abbc12a-427d-432a-a521-c870af1739d9",
86
+ "_links": {
87
+ "self": {
88
+ "href": "http://localhost:1234/some-url",
89
+ "title": "A title"
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ```
@@ -1,3 +1,4 @@
1
1
  ### Pacts for Pact Broker Client
2
2
 
3
3
  * [Pact Broker](Pact%20Broker%20Client%20-%20Pact%20Broker.md)
4
+ * [Pactflow](Pact%20Broker%20Client%20-%20Pactflow.md)
@@ -65,6 +65,9 @@ module PactBroker
65
65
  { error: error_hash }.to_json
66
66
  end
67
67
 
68
+ def error_message_as_json(message)
69
+ { error: { message: message } }.to_json
70
+ end
68
71
 
69
72
  def text_error_message(e, include_backtrace)
70
73
  maybe_backtrace = (include_backtrace ? "\n" + e.backtrace.join("\n") : "")
@@ -33,9 +33,9 @@ module PactBroker
33
33
  def call
34
34
  create_result(fetch_matrix_with_retries)
35
35
  rescue PactBroker::Client::Error => e
36
- Result.new(false, Term::ANSIColor.red(e.message))
36
+ Result.new(dry_run_or_false, for_dry_run(Term::ANSIColor.red(e.message)))
37
37
  rescue StandardError => e
38
- Result.new(false, "Error retrieving matrix. #{e.class} - #{e.message}\n#{e.backtrace.join("\n")}")
38
+ Result.new(dry_run_or_false, for_dry_run(Term::ANSIColor.red("Error retrieving matrix. #{e.class} - #{e.message}") + "\n#{e.backtrace.join("\n")}"))
39
39
  end
40
40
 
41
41
  private
@@ -46,14 +46,15 @@ module PactBroker
46
46
  if matrix.deployable?
47
47
  Result.new(true, success_message(matrix))
48
48
  else
49
- Result.new(false, failure_message(matrix))
49
+ Result.new(dry_run_or_false, failure_message(matrix))
50
50
  end
51
51
  end
52
52
 
53
53
  def success_message(matrix)
54
54
  message = format_matrix(matrix)
55
55
  if format != 'json'
56
- message = warning(matrix) + Term::ANSIColor.green('Computer says yes \o/ ') + message + "\n\n" + notice_or_reason(matrix, :green)
56
+ message = warning(matrix) + computer_says(true) + message + "\n\n" + notice_or_reason(matrix, :green)
57
+ message = for_dry_run(message)
57
58
  end
58
59
  message
59
60
  end
@@ -61,11 +62,28 @@ module PactBroker
61
62
  def failure_message(matrix)
62
63
  message = format_matrix(matrix)
63
64
  if format != 'json'
64
- message = warning(matrix) + Term::ANSIColor.red('Computer says no ¯\_(ツ)_/¯ ') + message + "\n\n" + notice_or_reason(matrix, :red)
65
+ message = warning(matrix) + computer_says(false) + message + "\n\n" + notice_or_reason(matrix, :red)
66
+ message = for_dry_run(message)
65
67
  end
66
68
  message
67
69
  end
68
70
 
71
+ def computer_says(success)
72
+ if success
73
+ if dry_run?
74
+ "Computer says yes \\o/ (and maybe you don't need to enable dry run)"
75
+ else
76
+ Term::ANSIColor.green('Computer says yes \o/ ')
77
+ end
78
+ else
79
+ if dry_run?
80
+ "Computer says no ¯\\_(ツ)_/¯ (but you're ignoring this by enabling dry run)"
81
+ else
82
+ Term::ANSIColor.red("Computer says no ¯\_(ツ)_/¯")
83
+ end
84
+ end
85
+ end
86
+
69
87
  def notice_or_reason(matrix, reason_color)
70
88
  if matrix.notices
71
89
  PactBroker::Client::ColorizeNotices.call(matrix.notices).join("\n")
@@ -114,6 +132,23 @@ module PactBroker
114
132
  options[:retry_while_unknown] > 0
115
133
  end
116
134
 
135
+ def dry_run?
136
+ options[:dry_run]
137
+ end
138
+
139
+ def dry_run_or_false
140
+ dry_run? || false
141
+ end
142
+
143
+ def for_dry_run(lines)
144
+ if dry_run?
145
+ prefix = Term::ANSIColor.yellow("[dry-run] ")
146
+ lines.split("\n").collect { |line| prefix + Term::ANSIColor.uncolor(line) }.join("\n") + "\n" + prefix + "\n" + prefix + Term::ANSIColor.green("Dry run enabled - ignoring any failures")
147
+ else
148
+ lines
149
+ end
150
+ end
151
+
117
152
  def retry_options
118
153
  {
119
154
  condition: lambda { |matrix| !matrix.any_unknown? },
@@ -4,59 +4,25 @@ require 'thor/error'
4
4
  require 'pact_broker/client/cli/environment_commands'
5
5
  require 'pact_broker/client/cli/deployment_commands'
6
6
  require 'pact_broker/client/cli/pacticipant_commands'
7
+ require 'pact_broker/client/cli/webhook_commands'
8
+ require "pact_broker/client/cli/matrix_commands"
7
9
 
8
10
  module PactBroker
9
11
  module Client
10
12
  module CLI
11
13
  # Thor::Error will have its backtrace hidden
12
14
  class PactPublicationError < ::Thor::Error; end
13
- class WebhookCreationError < ::Thor::Error; end
14
15
  class AuthError < ::Thor::Error; end
15
16
  class VersionCreationError < ::Thor::Error; end
16
17
 
17
18
  class Broker < CustomThor
18
19
  using PactBroker::Client::HashRefinements
19
- if ENV.fetch("PACT_BROKER_FEATURES", "").include?("deployments")
20
- include PactBroker::Client::CLI::EnvironmentCommands
21
- include PactBroker::Client::CLI::DeploymentCommands
22
- end
23
- include PactBroker::Client::CLI::PacticipantCommands
24
-
25
-
26
- desc 'can-i-deploy', ''
27
- long_desc File.read(File.join(__dir__, 'can_i_deploy_long_desc.txt'))
28
-
29
- method_option :pacticipant, required: true, aliases: "-a", desc: "The pacticipant name. Use once for each pacticipant being checked."
30
- method_option :version, required: false, aliases: "-e", desc: "The pacticipant version. Must be entered after the --pacticipant that it relates to."
31
- method_option :ignore, required: false, desc: "The pacticipant name to ignore. Use once for each pacticipant being ignored. A specific version can be ignored by also specifying a --version after the pacticipant name option."
32
- method_option :latest, required: false, aliases: "-l", banner: '[TAG]', desc: "Use the latest pacticipant version. Optionally specify a TAG to use the latest version with the specified tag."
33
- method_option :to, required: false, banner: 'TAG', desc: "This is too hard to explain in a short sentence. Look at the examples.", default: nil
34
- method_option :to_environment, required: false, banner: 'ENVIRONMENT', desc: "The environment into which the pacticipant(s) are to be deployed", default: nil, hide: true
35
- method_option :output, aliases: "-o", desc: "json or table", default: 'table'
36
- method_option :retry_while_unknown, banner: 'TIMES', type: :numeric, default: 0, required: false, desc: "The number of times to retry while there is an unknown verification result (ie. the provider verification is likely still running)"
37
- method_option :retry_interval, banner: 'SECONDS', type: :numeric, default: 10, required: false, desc: "The time between retries in seconds. Use in conjuction with --retry-while-unknown"
38
- # Allow limit to be set manually until https://github.com/pact-foundation/pact_broker-client/issues/53 is fixed
39
- method_option :limit, hide: true
40
- shared_authentication_options
41
20
 
42
- def can_i_deploy(*ignored_but_necessary)
43
- require 'pact_broker/client/cli/version_selector_options_parser'
44
- require 'pact_broker/client/can_i_deploy'
45
-
46
- validate_credentials
47
- selectors = VersionSelectorOptionsParser.call(ARGV).select { |s| !s[:ignore] }
48
- ignore_selectors = if ENV.fetch("PACT_BROKER_FEATURES", "").include?("ignore")
49
- VersionSelectorOptionsParser.call(ARGV).select { |s| s[:ignore] }
50
- else
51
- []
52
- end
53
- validate_can_i_deploy_selectors(selectors)
54
- can_i_deploy_options = { output: options.output, retry_while_unknown: options.retry_while_unknown, retry_interval: options.retry_interval }
55
- result = CanIDeploy.call(options.broker_base_url, selectors, { to_tag: options.to, to_environment: options.to_environment, limit: options.limit, ignore_selectors: ignore_selectors }, can_i_deploy_options, pact_broker_client_options)
56
- $stdout.puts result.message
57
- $stdout.flush
58
- exit(can_i_deploy_exit_status) unless result.success
59
- end
21
+ include PactBroker::Client::CLI::EnvironmentCommands
22
+ include PactBroker::Client::CLI::DeploymentCommands
23
+ include PactBroker::Client::CLI::MatrixCommands
24
+ include PactBroker::Client::CLI::PacticipantCommands
25
+ include PactBroker::Client::CLI::WebhookCommands
60
26
 
61
27
  desc 'publish PACT_DIRS_OR_FILES ...', "Publish pacts to a Pact Broker."
62
28
  method_option :consumer_app_version, required: true, aliases: "-a", desc: "The consumer application version"
@@ -129,31 +95,7 @@ module PactBroker
129
95
  exit(1) unless result.success
130
96
  end
131
97
 
132
- shared_options_for_webhook_commands
133
-
134
- desc 'create-webhook URL', 'Creates a webhook using the same switches as a curl request.'
135
- long_desc File.read(File.join(File.dirname(__FILE__), 'create_webhook_long_desc.txt'))
136
- def create_webhook webhook_url
137
- run_webhook_commands webhook_url
138
- end
139
-
140
- shared_options_for_webhook_commands
141
- method_option :uuid, type: :string, required: true, desc: "Specify the uuid for the webhook"
142
-
143
- desc 'create-or-update-webhook URL', 'Creates or updates a webhook with a provided uuid and using the same switches as a curl request.'
144
- long_desc File.read(File.join(File.dirname(__FILE__), 'create_or_update_webhook_long_desc.txt'))
145
- def create_or_update_webhook webhook_url
146
- run_webhook_commands webhook_url
147
- end
148
98
 
149
- desc 'test-webhook', 'Test the execution of a webhook'
150
- method_option :uuid, type: :string, required: true, desc: "Specify the uuid for the webhook"
151
- shared_authentication_options
152
- def test_webhook
153
- require 'pact_broker/client/webhooks/test'
154
- result = PactBroker::Client::Webhooks::Test.call(options, pact_broker_client_options)
155
- $stdout.puts result.message
156
- end
157
99
 
158
100
  ignored_and_hidden_potential_options_from_environment_variables
159
101
  desc 'generate-uuid', 'Generate a UUID for use when calling create-or-update-webhook'
@@ -187,16 +129,6 @@ module PactBroker
187
129
  true
188
130
  end
189
131
 
190
- def can_i_deploy_exit_status
191
- exit_code_string = ENV.fetch('PACT_BROKER_CAN_I_DEPLOY_EXIT_CODE_BETA', '')
192
- if exit_code_string =~ /^\d+$/
193
- $stderr.puts "Exiting can-i-deploy with configured exit code #{exit_code_string}"
194
- exit_code_string.to_i
195
- else
196
- 1
197
- end
198
- end
199
-
200
132
  def validate_credentials
201
133
  if options.broker_username && options.broker_token
202
134
  raise AuthError, "You cannot provide both a username/password and a bearer token. If your Pact Broker uses a bearer token, please remove the username and password configuration."
@@ -209,10 +141,6 @@ module PactBroker
209
141
  end
210
142
  end
211
143
 
212
- def validate_can_i_deploy_selectors selectors
213
- pacticipants_without_versions = selectors.select{ |s| s[:version].nil? && s[:latest].nil? && s[:tag].nil? }.collect{ |s| s[:pacticipant] }
214
- raise ::Thor::RequiredArgumentMissingError, "The version must be specified using `--version VERSION`, `--latest`, `--latest TAG`, or `--all TAG` for pacticipant #{pacticipants_without_versions.join(", ")}" if pacticipants_without_versions.any?
215
- end
216
144
 
217
145
  def publish_pacts pact_files
218
146
  require 'pact_broker/client/publish_pacts'
@@ -295,64 +223,6 @@ module PactBroker
295
223
 
296
224
  client_options.compact
297
225
  end
298
-
299
- def parse_webhook_events
300
- events = []
301
- events << 'contract_content_changed' if options.contract_content_changed
302
- events << 'contract_published' if options.contract_published
303
- events << 'provider_verification_published' if options.provider_verification_published
304
- events << 'provider_verification_succeeded' if options.provider_verification_succeeded
305
- events << 'provider_verification_failed' if options.provider_verification_failed
306
- events
307
- end
308
-
309
- def parse_webhook_options(webhook_url)
310
- events = parse_webhook_events
311
-
312
- if events.size == 0
313
- raise WebhookCreationError.new("You must specify at least one of --contract-content-changed, --contract-published, --provider-verification-published, --provider-verification-succeeded or --provider-verification-failed")
314
- end
315
-
316
- username = options.user ? options.user.split(":", 2).first : nil
317
- password = options.user ? options.user.split(":", 2).last : nil
318
-
319
- headers = (options.header || []).each_with_object({}) { | header, headers | headers[header.split(":", 2).first.strip] = header.split(":", 2).last.strip }
320
-
321
- body = options.data
322
- if body && body.start_with?("@")
323
- filepath = body[1..-1]
324
- begin
325
- body = File.read(filepath)
326
- rescue StandardError => e
327
- raise WebhookCreationError.new("Couldn't read data from file \"#{filepath}\" due to #{e.class} #{e.message}")
328
- end
329
- end
330
-
331
- {
332
- uuid: options.uuid,
333
- description: options.description,
334
- http_method: options.request,
335
- url: webhook_url,
336
- headers: headers,
337
- username: username,
338
- password: password,
339
- body: body,
340
- consumer: options.consumer,
341
- provider: options.provider,
342
- events: events
343
- }
344
- end
345
-
346
- def run_webhook_commands webhook_url
347
- require 'pact_broker/client/webhooks/create'
348
-
349
- validate_credentials
350
- result = PactBroker::Client::Webhooks::Create.call(parse_webhook_options(webhook_url), options.broker_base_url, pact_broker_client_options)
351
- $stdout.puts result.message
352
- exit(1) unless result.success
353
- rescue PactBroker::Client::Error => e
354
- raise WebhookCreationError, "#{e.class} - #{e.message}"
355
- end
356
226
  end
357
227
  end
358
228
  end
@@ -91,22 +91,6 @@ module PactBroker
91
91
  method_option :verbose, aliases: "-v", type: :boolean, default: false, required: false, desc: "Verbose output. Default: false"
92
92
  end
93
93
 
94
- def self.shared_options_for_webhook_commands
95
- method_option :request, banner: "METHOD", aliases: "-X", desc: "Webhook HTTP method", required: true
96
- method_option :header, aliases: "-H", type: :array, desc: "Webhook Header"
97
- method_option :data, aliases: "-d", desc: "Webhook payload (file or string)"
98
- method_option :user, aliases: "-u", desc: "Webhook basic auth username and password eg. username:password"
99
- method_option :consumer, desc: "Consumer name"
100
- method_option :provider, desc: "Provider name"
101
- method_option :description, desc: "Wwebhook description"
102
- method_option :contract_content_changed, type: :boolean, desc: "Trigger this webhook when the pact content changes"
103
- method_option :contract_published, type: :boolean, desc: "Trigger this webhook when a pact is published"
104
- method_option :provider_verification_published, type: :boolean, desc: "Trigger this webhook when a provider verification result is published"
105
- method_option :provider_verification_failed, type: :boolean, desc: "Trigger this webhook when a failed provider verification result is published"
106
- method_option :provider_verification_succeeded, type: :boolean, desc: "Trigger this webhook when a successful provider verification result is published"
107
- shared_authentication_options
108
- end
109
-
110
94
  def self.verbose_option
111
95
  method_option :verbose, aliases: "-v", type: :boolean, default: false, required: false, desc: "Verbose output. Default: false"
112
96
  end
@@ -2,11 +2,15 @@ module PactBroker
2
2
  module Client
3
3
  module CLI
4
4
  module DeploymentCommands
5
- HELP_URL = "https://docs.pact.io/pact_broker/recording_deployments_and_releases/"
5
+ RECORD_DEPLOYMENT_HELP_URL = "https://docs.pact.io/go/record-deployment"
6
+ RECORD_UNDEPLOYMENT_HELP_URL = "https://docs.pact.io/go/record-undeployment"
7
+ RECORD_RELEASE_HELP_URL = "https://docs.pact.io/go/record-release"
8
+ RECORD_SUPPORT_ENDED_HELP_URL = "https://docs.pact.io/go/record-support-ended"
9
+
6
10
 
7
11
  def self.included(thor)
8
12
  thor.class_eval do
9
- desc "record-deployment", "Record deployment of a pacticipant version to an environment. See #{HELP_URL} for more information."
13
+ desc "record-deployment", "Record deployment of a pacticipant version to an environment. See #{RECORD_DEPLOYMENT_HELP_URL} for more information."
10
14
  method_option :pacticipant, required: true, aliases: "-a", desc: "The name of the pacticipant that was deployed."
11
15
  method_option :version, required: true, aliases: "-e", desc: "The pacticipant version number that was deployed."
12
16
  method_option :environment, required: true, desc: "The name of the environment that the pacticipant version was deployed to."
@@ -24,8 +28,8 @@ module PactBroker
24
28
  execute_deployment_command(params, "RecordDeployment")
25
29
  end
26
30
 
27
- desc "record-undeployment", "Record undeployment of a pacticipant version from an environment."
28
- long_desc "Note that use of this command is not required if you are deploying over a previous version, as record-deployment will handle that scenario for you. This command is only required if you are permanently removing an application instance from an environment."
31
+ desc "record-undeployment", "Record undeployment of a pacticipant from an environment."
32
+ long_desc "Note that use of this command is only required if you are permanently removing an application instance from an environment. It is not required if you are deploying over a previous version, as record-deployment will automatically mark the previously deployed version as undeployed for you. See #{RECORD_UNDEPLOYMENT_HELP_URL} for more information."
29
33
  method_option :pacticipant, required: true, aliases: "-a", desc: "The name of the pacticipant that was undeployed."
30
34
  method_option :environment, required: true, desc: "The name of the environment that the pacticipant version was undeployed from."
31
35
  method_option :target, default: nil, required: false, desc: "Optional. The target that the application is being undeployed from - a logical identifer required to differentiate deployments when there are multiple instances of the same application in an environment."
@@ -41,7 +45,7 @@ module PactBroker
41
45
  execute_deployment_command(params, "RecordUndeployment")
42
46
  end
43
47
 
44
- desc "record-release", "Record release of a pacticipant version to an environment. See See #{HELP_URL} for more information."
48
+ desc "record-release", "Record release of a pacticipant version to an environment. See See #{RECORD_RELEASE_HELP_URL} for more information."
45
49
  method_option :pacticipant, required: true, aliases: "-a", desc: "The name of the pacticipant that was released."
46
50
  method_option :version, required: true, aliases: "-e", desc: "The pacticipant version number that was released."
47
51
  method_option :environment, required: true, desc: "The name of the environment that the pacticipant version was released to."
@@ -57,6 +61,22 @@ module PactBroker
57
61
  execute_deployment_command(params, "RecordRelease")
58
62
  end
59
63
 
64
+ desc "record-support-ended", "Record the end of support for a pacticipant version in an environment. See #{RECORD_SUPPORT_ENDED_HELP_URL} for more information."
65
+ method_option :pacticipant, required: true, aliases: "-a", desc: "The name of the pacticipant."
66
+ method_option :version, required: true, aliases: "-e", desc: "The pacticipant version number for which support is ended."
67
+ method_option :environment, required: true, desc: "The name of the environment in which the support is ended."
68
+ output_option_json_or_text
69
+ shared_authentication_options
70
+
71
+ def record_support_ended
72
+ params = {
73
+ pacticipant_name: options.pacticipant,
74
+ version_number: options.version,
75
+ environment_name: options.environment
76
+ }
77
+ execute_deployment_command(params, "RecordSupportEnded")
78
+ end
79
+
60
80
  no_commands do
61
81
  def execute_deployment_command(params, command_class_name)
62
82
  require 'pact_broker/client/deployments'