Class: Pipedream::Pipeline
- Inherits:
-
Object
- Object
- Pipedream::Pipeline
- Extended by:
- Memoist
- Includes:
- Dsl::Pipeline, Evaluate
- Defined in:
- lib/pipedream/pipeline.rb,
lib/pipedream/pipeline/s3_bucket.rb
Defined Under Namespace
Classes: S3Bucket
Constant Summary
Constants included from Dsl::Pipeline
Instance Method Summary collapse
- #default_properties ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(options = {}) ⇒ Pipeline
constructor
A new instance of Pipeline.
- #run ⇒ Object
- #s3_bucket ⇒ Object
-
#set_source_branch! ⇒ Object
cli branch option always takes highest precedence.
Methods included from Evaluate
Methods included from Dsl::Pipeline
#action, #in_parallel, #pipeline_name, #stage
Methods included from Dsl::Ssm
Methods included from Dsl::Pipeline::Github
Methods included from Dsl::Pipeline::Codebuild
Methods included from Dsl::Pipeline::Approve
Constructor Details
#initialize(options = {}) ⇒ Pipeline
Returns a new instance of Pipeline.
7 8 9 10 11 12 |
# File 'lib/pipedream/pipeline.rb', line 7 def initialize(={}) @options = @pipeline_path = [:pipeline_path] || get_pipeline_path @properties = default_properties # defaults make pipeline.rb simpler @stages = [] end |
Instance Method Details
#default_properties ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pipedream/pipeline.rb', line 28 def default_properties { name: @options[:full_pipeline_name], role_arn: { "Fn::GetAtt": "IamRole.Arn" }, artifact_store: { type: "S3", location: s3_bucket, # auto creates s3 bucket } } end |
#exist? ⇒ Boolean
48 49 50 |
# File 'lib/pipedream/pipeline.rb', line 48 def exist? File.exist?(@pipeline_path) end |
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pipedream/pipeline.rb', line 14 def run evaluate(@pipeline_path) @properties[:stages] ||= @stages set_source_branch! resource = { pipeline: { type: "AWS::CodePipeline::Pipeline", properties: @properties } } CfnCamelizer.transform(resource) end |
#s3_bucket ⇒ Object
52 53 54 |
# File 'lib/pipedream/pipeline.rb', line 52 def s3_bucket S3Bucket.name end |
#set_source_branch! ⇒ Object
cli branch option always takes highest precedence
40 41 42 43 44 45 46 |
# File 'lib/pipedream/pipeline.rb', line 40 def set_source_branch! return unless @options[:branch] source_stage = @properties[:stages].first action = source_stage[:actions].first action[:configuration][:branch] = @options[:branch] end |