class Hashicorptools::RegionDeployment
Attributes
aws_region[RW]
environment[RW]
Public Class Methods
new(aws_region:, environment:)
click to toggle source
# File lib/hashicorptools/code_deploy.rb, line 13 def initialize(aws_region:, environment:) @aws_region = aws_region @environment = environment end
Public Instance Methods
create_deployment(commit_id, commit_message)
click to toggle source
# File lib/hashicorptools/code_deploy.rb, line 18 def create_deployment(commit_id, commit_message) client = Aws::CodeDeploy::Client.new(region: aws_region) response = client.create_deployment({ application_name: application_name, deployment_group_name: "#{application_name}-#{@environment}", revision: { revision_type: 'GitHub', git_hub_location: { repository: "controlshift/#{application_name}", commit_id: commit_id } }, description: (commit_message || "commit #{commit_id}").slice(0,99) }) output "created deployment #{response.deployment_id}" output "https://console.aws.amazon.com/codedeploy/home?region=#{aws_region}#/deployments/#{response.deployment_id}" # Classes that override this method should return true for a successful deployment, false otherwise return true end
Private Instance Methods
application_name()
click to toggle source
# File lib/hashicorptools/code_deploy.rb, line 41 def application_name raise "implement me" end
output(text)
click to toggle source
# File lib/hashicorptools/code_deploy.rb, line 45 def output(text) puts "[#{aws_region}] #{text}" end