class Appsignal::CLI::NotifyOfDeploy

Terminology: Deploy marker
@see docs.appsignal.com/appsignal/terminology.html#markers<br>AppSignal notify_of_deploy documentation
@see docs.appsignal.com/ruby/command-line/notify_of_deploy.html<br>@see Appsignal::Marker Appsignal::Marker
@since 0.2.5
documentation.
(docs.appsignal.com/application/markers/deploy-markers.html)
instead. For more information, please read the [deploy markers]
(docs.appsignal.com/ruby/configuration/options.html#app_revision-revision)
deprecated. Use the [‘revision` config option]
@deprecated This method of sending AppSignal deploy markers is
appsignal notify_of_deploy –help
@example help command
–name=“My app”
–revision=abc1234 <br>–environment=production <br>–user=tom <br>appsignal notify_of_deploy <br>@example using a custom app name
–revision=abc1234
–environment=production <br>–user=tom <br>appsignal notify_of_deploy <br>@example basic example
- Exits with status code `1` if the required options aren’t present.
- Exits with status code ‘1` if the configuration is not valid and active.
- Exits with status code `0` if the deploy marker is sent.
## Exit codes
option is required.
file or based on the `APPSIGNAL_APP_NAME` environment variable, this
- `–name` If no “name” config can be found in a `config/appsignal.yml`
- `–revision` required. Git commit SHA or other identifiable revision id.
- `–user` required. User that triggered the deploy.
deployed.
- `–environment` required. The environment of the application being
## Options
marker is created on each deploy.
@note The same logic is used in the Capistrano integration. A deploy
reopened if they occur again in the new deploy.
Incidents for exceptions and performance issues will be closed and
application, “Deploy markers” indicate a deploy of an application.
Deploy markers are used on AppSignal.com to indicate changes in an
AppSignal.
Command line tool to send a “Deploy Marker” for an application to

def config_for(environment)

def config_for(environment)
  Appsignal::Config.new(
    Dir.pwd,
    environment,
    {},
    Logger.new(StringIO.new)
  )
end

def run(options)

Returns:
  • (void) -

Options Hash: (**options)
  • :revision (String) -- the revision that has been
  • :user (String) -- user who triggered the deploy.
  • :name (String) -- custom name of the application.
  • :environment (String) -- environment to load

Parameters:
  • options (Hash) --
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
  puts
  message = "This command (appsignal notify_of_deploy) has been " \
    "deprecated in favor of the `revision` config option. Please " \
    "see our documentation for more information on the recommended " \
    "method: " \
    "https://docs.appsignal.com/application/markers/deploy-markers.html"
  deprecation_message message, Appsignal.logger
end

def validate_active_config(config)

def validate_active_config(config)
  return if config.active?
  puts "Error: No valid config found."
  exit 1
end

def validate_required_options(options, required_options)

def validate_required_options(options, required_options)
  missing = required_options.select do |required_option|
    val = options[required_option]
    val.nil? || (val.respond_to?(:empty?) && val.empty?)
  end
  return unless missing.any?
  puts "Error: Missing options: #{missing.join(", ")}"
  exit 1
end