Sha256: 19425f713caa02de550a1cfa01eb3be7a9107817d75c8a9c8cc5dc86d2e1b70c
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
require 'httparty' require 'hipchat' require 'bib/opsworks/logging' module Bib module Opsworks class HipChat include Logging def publish_deployment(app_name, deploy_data, api_token, room) params = prepare_data(app_name, deploy_data) log.debug("HipChat Token: #{api_token}, Room: #{room}") begin client = ::HipChat::Client.new(api_token, api_version: 'v2') client[room].send('', "Deployment: #{params['name']} to #{params['environment']}", color: 'green') rescue StandardError => e log.error("Failed to publish deployment to HipChat: #{e}") end end def prepare_data(app_name, deploy_data) scm_revision = deploy_data['scm']['revision'] deployment_user = if deploy_data['deploying_user'].nil? || deploy_data['deploying_user'].empty? 'opsworks' else deploy_data['deploying_user'].split('/')[1] end name_text = "#{scm_revision} by #{deployment_user}" qafoo_params = {} qafoo_params['name'] = name_text qafoo_params['environment'] = app_name qafoo_params['type'] = 'release' qafoo_params end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
BibOpsworks-0.2.0 | lib/bib/opsworks/hipchat.rb |