AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Class: Aws::RailsProvisioner::Views::PipelineStack

Inherits:
Aws::RailsProvisioner::View
  • Object
show all
Defined in:
lib/aws-rails-provisioner/views/pipeline_stack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PipelineStack

Pipeline (CICD) Generation under :cicd

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :pipeline_name (String)

    Name for the AWS CodePipeline generated

  • :source_repo (String)

    CodeCommit Repo name for holding your rails app source, default to folder name where your rails app lives

  • :source_description (String)

    Description for the CodeCommit Repo, default to 'created by aws-rails-provisioner'

  • :build (Hash)

    configurations for codebuild project for building images @see Build

  • :migration (Hash)

    configuration for db migration codebuild, available if :db_cluster is configured @see Migration



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/aws-rails-provisioner/views/pipeline_stack.rb', line 27

def initialize(options = {})
  @stack_prefix = options[:stack_prefix]

  @pipeline_name = options[:pipeline_name] || "#{@stack_prefix}Pipeline"
  @source_repo = options[:source_repo] || _extract_repo_name(options[:source_path])
  @source_description = options[:source_description] || "created by aws-rails-provisioner with AWS CDK for #{@stack_prefix}"

  @build_config = options[:build] || {}
  unless @build_config[:project_name]
    @build_config[:project_name] = "#{@stack_prefix}ImageBuild"
  end

  @skip_migration = options[:skip_migration] || false
  unless @skip_migration
    @migration_config = options[:migration] || {}
    unless @migration_config[:project_name]
      @migration_config[:project_name] = "#{@stack_prefix}DBMigration"
    end
  end
end

Instance Attribute Details

#buildAws::RailsProvisioner::Build (readonly)



80
81
82
# File 'lib/aws-rails-provisioner/views/pipeline_stack.rb', line 80

def build
  @build
end

#migrationAws::RailsProvisioner::Migration (readonly)



83
84
85
# File 'lib/aws-rails-provisioner/views/pipeline_stack.rb', line 83

def migration
  @migration
end

#pipeline_nameString (readonly)

Returns:

  • (String)


71
72
73
# File 'lib/aws-rails-provisioner/views/pipeline_stack.rb', line 71

def pipeline_name
  @pipeline_name
end

#skip_migrationBoolean (readonly)

Returns:

  • (Boolean)


86
87
88
# File 'lib/aws-rails-provisioner/views/pipeline_stack.rb', line 86

def skip_migration
  @skip_migration
end

#source_descriptionString (readonly)

Returns:

  • (String)


77
78
79
# File 'lib/aws-rails-provisioner/views/pipeline_stack.rb', line 77

def source_description
  @source_description
end

#source_repoString (readonly)

Returns:

  • (String)


74
75
76
# File 'lib/aws-rails-provisioner/views/pipeline_stack.rb', line 74

def source_repo
  @source_repo
end

#stack_prefixString (readonly)

Returns:

  • (String)


68
69
70
# File 'lib/aws-rails-provisioner/views/pipeline_stack.rb', line 68

def stack_prefix
  @stack_prefix
end

Instance Method Details

#packagesObject



62
63
64
65
# File 'lib/aws-rails-provisioner/views/pipeline_stack.rb', line 62

def packages
  keys = services.map {|svc| svc[:value] }
  Aws::RailsProvisioner::Utils.to_pkgs(keys)
end

#servicesObject



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/aws-rails-provisioner/views/pipeline_stack.rb', line 48

def services
  [
    { abbr: 'iam', value: 'iam'},
    { abbr: 'ec2', value: 'ec2'},
    { abbr: 'ecr', value: 'ecr' },
    { abbr: 'ecs', value: 'ecs' },
    { abbr: 'rds', value: 'rds' },
    { abbr: 'codebuild', value: 'codebuild'},
    { abbr: 'codecommit', value: 'codecommit'},
    { abbr: 'codepipeline', value: 'codepipeline' },
    { abbr: 'pipelineactions', value: 'codepipeline-actions'}
  ] 
end