Skip to content

Commit

Permalink
Merge pull request #17 from brettswift/feature/add_pipeline_outputs
Browse files Browse the repository at this point in the history
Output information for pipeline source stages
  • Loading branch information
brettswift committed Sep 25, 2018
2 parents 460662e + b47ed09 commit 825e1a9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cumulus/steps/dev_tools/pipeline.py
Expand Up @@ -204,8 +204,8 @@ def handle(self, chain_context):
)

pipeline_output = troposphere.Output(
"PipelineLogicalName",
Description="Pipeline (logical id)",
"PipelineName",
Description="Code Pipeline",
Value=Ref(generic_pipeline),
)

Expand Down
21 changes: 20 additions & 1 deletion cumulus/steps/dev_tools/pipeline_source_action.py
Expand Up @@ -5,6 +5,7 @@
import awacs.logs
import awacs.s3
import awacs.sts
import troposphere
from troposphere import iam, \
codepipeline

Expand Down Expand Up @@ -42,6 +43,8 @@ def __init__(self,
def handle(self, chain_context):
print("Adding source action %s." % self.action_name)

template = chain_context.template

policy_name = "CodeBuildPolicy%s" % chain_context.instance_name
codebuild_policy = cumulus.policies.codebuild.get_policy_code_build_general_access(policy_name)

Expand Down Expand Up @@ -81,7 +84,7 @@ def handle(self, chain_context):
},
)

chain_context.template.add_resource(codebuild_role)
template.add_resource(codebuild_role)

found_pipelines = TemplateQuery.get_resource_by_type(
template=chain_context.template,
Expand All @@ -98,3 +101,19 @@ def handle(self, chain_context):

# TODO accept a parallel action to the previous action, and don't +1 here.
first_stage.Actions.append(source_action)

template.add_output(
troposphere.Output(
"PipelineBucket%s" % self.action_name,
Value=self.s3_bucket_name,
Description="A pipeline source bucket",
)
)
template.add_output(
troposphere.Output(
"PipelineTriggerObject%s" % self.action_name,
Value=self.s3_object_key,
Description="An s3 object key in the pipeline bucket "
"that will trigger the pipeline",
)
)
18 changes: 17 additions & 1 deletion cumulus/steps/dev_tools/pipeline_source_action_code_commit.py
Expand Up @@ -5,6 +5,7 @@
import awacs.logs
import awacs.s3
import awacs.sts
import troposphere
from troposphere import iam, \
codepipeline, Ref

Expand Down Expand Up @@ -38,6 +39,7 @@ def __init__(self,
def handle(self, chain_context):
print("Adding source action %s." % self.action_name)

template = chain_context.template
policy_name = "CodeBuildPolicy%s" % chain_context.instance_name
codebuild_policy = cumulus.policies.codebuild.get_policy_code_build_general_access(policy_name)

Expand Down Expand Up @@ -78,7 +80,7 @@ def handle(self, chain_context):
},
)

chain_context.template.add_resource(codebuild_role)
template.add_resource(codebuild_role)

found_pipelines = TemplateQuery.get_resource_by_type(
template=chain_context.template,
Expand All @@ -95,3 +97,17 @@ def handle(self, chain_context):

# TODO accept a parallel action to the previous action, and don't +1 here.
first_stage.Actions.append(source_action)

template.add_output(
troposphere.Output(
"RepoName%s" % self.action_name,
Value=Ref("RepositoryName")
)
)

template.add_output(
troposphere.Output(
"RepoBranch%s" % self.action_name,
Value=Ref("RepositoryBranch")
)
)

0 comments on commit 825e1a9

Please sign in to comment.