python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cdk synth --app "python app.py"
Created
March 6, 2022 12:08
-
-
Save alexpulver/ae65a76d27769ce036624654a251f11a to your computer and use it in GitHub Desktop.
CDK Pipelines ECR source attribute example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aws_cdk as cdk | |
from aws_cdk import aws_ecr as ecr | |
from aws_cdk import pipelines | |
app = cdk.App() | |
stack = cdk.Stack(app, "CdkPipelinesSourceAttribute") | |
ecr_repository = ecr.Repository(stack, "EcrRepository") | |
codepipeline_source_ecr = pipelines.CodePipelineSource.ecr(ecr_repository) | |
codebuild_step = pipelines.CodeBuildStep( | |
"CodeBuildStep", | |
input=codepipeline_source_ecr, | |
commands=["npx cdk synth"], | |
env={"IMAGE_TAG": codepipeline_source_ecr.source_attribute("ImageTag")}, | |
) | |
codepipeline = pipelines.CodePipeline( | |
stack, | |
"CodePipeline", | |
synth=codebuild_step, | |
) | |
app.synth() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws-cdk-lib==2.15.0 | |
constructs==10.0.77 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment