Registry /
devops / aws-cdk-aws-codepipeline
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Pipeline
✓ from aws_cdk.aws_codepipeline import Pipeline
✗ from aws_cdk.aws_codecommit import Pipeline
Pipeline is in aws_codepipeline, not aws_codecommit
Artifact
✓ from aws_cdk.aws_codepipeline import Artifact
✗ from aws_cdk.core import Artifact
Artifact class moved to aws_codepipeline module
ShellScriptAction
✓ from aws_cdk.aws_codepipeline_actions import ShellScriptAction
✗ from aws_cdk.aws_codepipeline import ShellScriptAction
Action classes are in the -actions submodule
Create a basic CodePipeline with GitHub source and CodeBuild action
from aws_cdk import core
from aws_cdk.aws_codepipeline import Pipeline, Artifact, StageProps
from aws_cdk.aws_codepipeline_actions import GitHubSourceAction, CodeBuildAction
app = core.App()
stack = core.Stack(app, "MyPipelineStack", env=core.Environment(account="123456789012", region="us-east-1"))
source_output = Artifact()
pipeline = Pipeline(stack, "Pipeline",
stages=[
StageProps(stage_name="Source", actions=[
GitHubSourceAction(
action_name="GitHub_Source",
owner="my-org",
repo="my-repo",
oauth_token=core.SecretValue.secrets_manager("github-token"),
output=source_output
)
]),
StageProps(stage_name="Build", actions=[
CodeBuildAction(
action_name="CodeBuild",
project=codebuild.Project(stack, "Project"),
input=source_output
)
])
]
)
app.synth()
Debug
Known issues
breakingCDK v1 (1.x) is in maintenance mode. No new features will be added, and only critical security patches will be released. You must migrate to CDK v2 for ongoing support.fixMigrate to CDK v2 using the official migration guide: https://docs.aws.amazon.com/cdk/v2/guide/migrating.html
affects: all 1.x versions
deprecatedThe old Pipeline construct (from aws_cdk.aws_codepipeline.Pipeline) is deprecated in favor of Pipeline (the same name) with a different constructor signature. Use the new Pipeline construct which accepts stages as a property.fixUpdate pipeline definition to use StageProps and pass stages in the constructor
affects: >=1.70.0
gotchaWhen using cross-region actions, you must specify the cross-region bucket manually or enable the 'crossRegionActions' property.fixSet cross_region_replication_buckets in Pipeline props or use the 'crossRegionActions' property
affects: all
deprecatedThe 'PollForSourceChanges' property on source actions is deprecated. Instead, use webhooks or event rules to trigger pipelines.fixReplace PollForSourceChanges with a CodePipeline webhook or CloudWatch Events rule
affects: >=1.90.0
gotchaPipeline construct from aws_cdk.aws_codepipeline is not to be confused with the CfnPipeline (low-level CloudFormation) resource.fixUse aws_cdk.aws_codepipeline.Pipeline for the high-level construct
affects: all
Errors
Common errors & fixes
TypeError: 'Artifact' object is not callable
Attempting to call Artifact() as a function; Artifact is a class that requires instantiation.
fixUse Artifact() with correct syntax: artifact = Artifact()
jsii.errors.JSIIError: 'Pipeline' does not match the expected type 'IPipeline'
Passing a Pipeline construct where an interface is expected, often due to incorrect typing in action props.
fixEnsure that the 'pipeline' property of actions receives a Pipeline construct, not a string or other type
ModuleNotFoundError: No module named 'aws_cdk'
CDK is not installed or not in the Python path.
fixInstall aws-cdk.core and aws-cdk.aws-codepipeline: pip install aws-cdk.core aws-cdk.aws-codepipeline
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk-librequiredCore CDK library required for all constructs
constructsrequiredBase constructs library
aws-cdk-aws-codepipeline-actionsoptionalOften needed to add pipeline actions