ArtifactPath

class aws_cdk.aws_codepipeline.ArtifactPath(artifact, file_name)

Bases: object

A specific file within an output artifact.

The most common use case for this is specifying the template file for a CloudFormation action.

ExampleMetadata:

lit=aws-codepipeline-actions/test/integ.cfn-template-from-repo.lit.ts infused

Example:

# Source stage: read from repository
repo = codecommit.Repository(stack, "TemplateRepo",
    repository_name="template-repo"
)
source_output = codepipeline.Artifact("SourceArtifact")
source = cpactions.CodeCommitSourceAction(
    action_name="Source",
    repository=repo,
    output=source_output,
    trigger=cpactions.CodeCommitTrigger.POLL
)
source_stage = {
    "stage_name": "Source",
    "actions": [source]
}

# Deployment stage: create and deploy changeset with manual approval
stack_name = "OurStack"
change_set_name = "StagedChangeSet"

prod_stage = {
    "stage_name": "Deploy",
    "actions": [
        cpactions.CloudFormationCreateReplaceChangeSetAction(
            action_name="PrepareChanges",
            stack_name=stack_name,
            change_set_name=change_set_name,
            admin_permissions=True,
            template_path=source_output.at_path("template.yaml"),
            run_order=1
        ),
        cpactions.ManualApprovalAction(
            action_name="ApproveChanges",
            run_order=2
        ),
        cpactions.CloudFormationExecuteChangeSetAction(
            action_name="ExecuteChanges",
            stack_name=stack_name,
            change_set_name=change_set_name,
            run_order=3
        )
    ]
}

codepipeline.Pipeline(stack, "Pipeline",
    cross_account_keys=True,
    stages=[source_stage, prod_stage
    ]
)
Parameters:
  • artifact (Artifact) –

  • file_name (str) –

Attributes

artifact
file_name
location

Static Methods

classmethod artifact_path(artifact_name, file_name)
Parameters:
  • artifact_name (str) –

  • file_name (str) –

Return type:

ArtifactPath