Skip to content

Conversation

@rupe120
Copy link

@rupe120 rupe120 commented Nov 11, 2025

Issue # (if applicable)

Closes #35913.

Reason for this change

Reduce unnecessary asset rebuilds in CDK Pipelines so iterative deployments finish faster and consume fewer build minutes.

Description of changes

Added the conditionallyBuildAssets flag to pipelines.CodePipeline and taught the asset publish actions to skip work when an identical asset already exists in S3 or ECR.

Generated per-asset bash commands that parse the manifest, probe S3 (HeadObject) or ECR (DescribeImages) and only invoke cdk-assets publish when needed.

Automatically extend the asset publishing CodeBuild role with the minimal IAM permissions required for the new existence checks.

Documented the feature in pipelines/README.md, including guidance and limitations.

Covered the behavior with compliance tests (command generation + IAM policies) and an integration test + snapshot for mixed file/Docker assets.

Describe any new or updated permissions being added

The asset publishing role now receives, when conditionallyBuildAssets is enabled:

  • File assets: s3:HeadObject, s3:GetObject
  • Docker assets: ecr:DescribeImages, ecr:BatchGetImage, ecr:GetDownloadUrlForLayer

These remain scoped to the specific asset buckets/repositories by the asset publishing process.

Description of how you validated changes

Added Jest compliance tests in pipelines/test/compliance/assets.test.ts.

Added an integration test (integ.newpipeline-with-conditional-asset-builds).

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Nov 11, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team November 11, 2025 04:25
@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Nov 11, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@rupe120 rupe120 changed the title Conditional asset building in Pipelines construct feat: Conditional asset building in Pipelines construct Nov 11, 2025
@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Nov 11, 2025
@rupe120
Copy link
Author

rupe120 commented Nov 11, 2025

Clarification Request

@aws-cdk-automation aws-cdk-automation added the pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run label Nov 11, 2025
@rupe120 rupe120 changed the title feat: Conditional asset building in Pipelines construct feat(pipelines): Conditional asset building in Pipelines construct Nov 12, 2025
@rupe120 rupe120 changed the title feat(pipelines): Conditional asset building in Pipelines construct feat(pipelines): Conditional asset building in Pipelines construct Nov 12, 2025
@rupe120 rupe120 changed the title feat(pipelines): Conditional asset building in Pipelines construct feat (pipelines): Conditional asset building in Pipelines construct Nov 12, 2025
@rupe120 rupe120 changed the title feat (pipelines): Conditional asset building in Pipelines construct feat (pipelines): conditional asset building in Pipelines construct Nov 12, 2025
@rupe120 rupe120 changed the title feat (pipelines): conditional asset building in Pipelines construct feat (pipelines): conditional asset building in pipelines construct Nov 12, 2025
@rupe120 rupe120 changed the title feat (pipelines): conditional asset building in pipelines construct feat: conditional asset building in pipelines construct Nov 12, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review November 12, 2025 22:48

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pipelines: Conditionally build assets on a hash

2 participants