Skip to content

Instantly share code, notes, and snippets.

@Arjeno
Created May 6, 2013 12:03
Show Gist options
  • Save Arjeno/5524736 to your computer and use it in GitHub Desktop.
Save Arjeno/5524736 to your computer and use it in GitHub Desktop.
New Relic Deployment Notification
#!/usr/bin/env ruby
# New Relic Deployment Notification
require 'new_relic/agent'
require 'new_relic/command'
config = NewRelic::Agent::Configuration::YamlSource.new(NewRelic::Agent.config[:config_path], ENV['RAILS_ENV'])
app_name = config[:app_name]
branch = `git branch --no-color | sed -e '/^[^*]/d'`.gsub("*", "").strip
description = `git log #{branch} -1 --format="%s"`.chomp
user = ENV['DEPLOY_AUTHOR']
revision = ENV['DEPLOYED_REVISION']
deploy_options = {
:environment => ENV['RAILS_ENV'],
:revision => revision,
:description => description,
:appname => app_name,
:user => user
}
deployment = NewRelic::Command::Deployments.new deploy_options
deployment.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment