Class: Appsignal::CLI::NotifyOfDeploy Private

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/cli/notify_of_deploy.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Note:

The same logic is used in the Capistrano integration. A deploy marker is created on each deploy.

Command line tool to send a "Deploy Marker" for an application to AppSignal.

Deploy markers are used on AppSignal.com to indicate changes in an application, "Deploy markers" indicate a deploy of an application.

Incidents for exceptions and performance issues will be closed and reopened if they occur again in the new deploy.

Options

  • --environment required. The environment of the application being deployed.
  • --user required. User that triggered the deploy.
  • --revision required. Git commit SHA or other identifiable revision id.
  • --name If no "name" config can be found in a config/appsignal.yml file or based on the APPSIGNAL_APP_NAME environment variable, this option is required.

Exit codes

  • Exits with status code 0 if the deploy marker is sent.
  • Exits with status code 1 if the configuration is not valid and active.
  • Exits with status code 1 if the required options aren't present.

Examples:

basic example

appsignal notify_of_deploy \
  --user=tom \
  --environment=production \
  --revision=abc1234

using a custom app name

appsignal notify_of_deploy \
  --user=tom \
  --environment=production \
  --revision=abc1234 \
  --name="My app"

help command

appsignal notify_of_deploy --help

See Also:

Since:

  • 0.2.5

Class Method Summary collapse

Class Method Details

.run(options) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • options (Hash)

Options Hash (options):

  • :environment (String)

    environment to load configuration for.

  • :name (String)

    custom name of the application.

  • :user (String)

    user who triggered the deploy.

  • :revision (String)

    the revision that has been deployed. E.g. a git commit SHA.

Since:

  • 0.2.5



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/appsignal/cli/notify_of_deploy.rb', line 63

def run(options)
  config = config_for(options[:environment])
  config[:name] = options[:name] if options[:name]

  validate_active_config(config)
  required_config = [:revision, :user]
  required_config << :environment if config.env.empty?
  required_config << :name if !config[:name] || config[:name].empty?
  validate_required_options(options, required_config)

  Appsignal::Marker.new(
    {
      :revision => options[:revision],
      :user => options[:user]
    },
    config
  ).transmit
end