Class: Pipedream::Pipeline
- Inherits:
-
Object
- Object
- Pipedream::Pipeline
show all
- 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
Dsl::Pipeline::PROPERTIES
Instance Method Summary
collapse
Methods included from Evaluate
#evaluate
#action, #stage
Methods included from Dsl::Ssm
#ssm, #ssm_client
#extract_repo_source, #github
#codebuild
#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={})
@options = options
@pipeline_path = options[:pipeline_path] || get_pipeline_path
@properties = default_properties @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, }
}
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
|