in servicecatalog_factory/template_builder/builders.py [0:0]
def build_deploy_stage(self, pipeline_stages, tpl, name, version, category):
deploy_project_name = t.Sub("${AWS::StackName}-DeployProject")
tpl.add_resource(
codebuild.Project(
"DeployProject",
Name=deploy_project_name,
ServiceRole=t.Sub(
"arn:${AWS::Partition}:iam::${AWS::AccountId}:role/servicecatalog-product-factory/DeliveryCodeRole"
),
Tags=t.Tags.from_dict(**{"ServiceCatalogPuppet:Actor": "Framework"}),
Artifacts=codebuild.Artifacts(Type="CODEPIPELINE"),
TimeoutInMinutes=60,
Environment=codebuild.Environment(
ComputeType=constants.ENVIRONMENT_COMPUTE_TYPE_DEFAULT,
Image=constants.ENVIRONMENT_IMAGE_DEFAULT,
Type=constants.ENVIRONMENT_TYPE_DEFAULT,
EnvironmentVariables=[
codebuild.EnvironmentVariable(
Name="TEMPLATE_FORMAT", Type="PLAINTEXT", Value="yaml",
),
codebuild.EnvironmentVariable(
Name="CATEGORY", Type="PLAINTEXT", Value=category,
),
codebuild.EnvironmentVariable(
Name="ACCOUNT_ID",
Type="PLAINTEXT",
Value=t.Sub("${AWS::AccountId}"),
),
],
),
Source=codebuild.Source(
BuildSpec=yaml.safe_dump(
{
"version": "0.2",
"phases": {
"build": {
"commands": [
f"aws s3 cp $CATEGORY.zip s3://sc-puppet-stacks-repository-$ACCOUNT_ID/$CATEGORY/{name}/{version}/$CATEGORY.zip"
],
}
},
"artifacts": {"files": ["*", "**/*"],},
}
),
Type="CODEPIPELINE",
),
Description=t.Sub("deploy project"),
)
)
pipeline_stages.append(
codepipeline.Stages(
Name="Deploy",
Actions=[
codepipeline.Actions(
Name="Deploy",
RunOrder=1,
RoleArn=t.Sub(
"arn:${AWS::Partition}:iam::${AWS::AccountId}:role/servicecatalog-product-factory/SourceRole"
),
InputArtifacts=[
codepipeline.InputArtifacts(
Name=base_template.PACKAGE_OUTPUT_ARTIFACT
),
],
ActionTypeId=codepipeline.ActionTypeId(
Category="Build",
Owner="AWS",
Version="1",
Provider="CodeBuild",
),
OutputArtifacts=[
codepipeline.OutputArtifacts(
Name=base_template.DEPLOY_OUTPUT_ARTIFACT
)
],
Configuration={"ProjectName": deploy_project_name,},
)
],
)
)