Skip to content

Conversation

ejschaefer
Copy link
Contributor

@ejschaefer ejschaefer commented Mar 21, 2025

Issue # (if applicable)

Closes #30239

Reason for this change

The BundlingOptions platform property is not being used in AssetBundlingBindMount or AssetBundlingVolumeCopy and is not passed as a command line option to Docker.

Fix makes the platform property work as described in BundlingOptions documentation: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.BundlingOptions.html#platform.

Description of changes

added platform: this.options.platform to AssetBundlingBindMount.run and AssetBundlingVolumeCopy.run in packages/aws-cdk-lib/core/lib/asset-staging.ts

Describe any new or updated permissions being added

N/A

Description of how you validated changes

Added platform property to unit and integration tests

  • packages/aws-cdk-lib/core/test/private/asset-staging.test.ts
  • packages/@aws-cdk-testing/framework-integ/test/aws-s3-assets/test/integ.assets.bundling.docker-opts.ts

Checklist


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

@ejschaefer ejschaefer requested a review from a team as a code owner March 21, 2025 17:04
@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Mar 21, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team March 21, 2025 17:05
@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Mar 21, 2025
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Mar 21, 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)

@ejschaefer
Copy link
Contributor Author

Exemption Request - I updated existing integration tests to include the platform option but there are no changes to generated templates

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Mar 21, 2025
@shikha372 shikha372 added the skip-abstractions-board signal to automated workflow to skip adding to project board label Mar 31, 2025
@iliapolo iliapolo self-assigned this Apr 16, 2025
@iliapolo iliapolo added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Apr 16, 2025
@iliapolo
Copy link
Contributor

Added exemption from integration test because indeed this change does not cause a snapshot diff. Modifications to existing tests are sufficient.

@aws-cdk-automation aws-cdk-automation dismissed their stale review April 16, 2025 07:57

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

@iliapolo
Copy link
Contributor

@ejschaefer I'm happy to merge this but can you please explain how this change fixes #33522? Seems unrelated because platform was ignored during bundling, but said issue speaks about a docker image asset that is pushed to ECR.

@iliapolo iliapolo added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Apr 16, 2025
Copy link
Contributor

This PR has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Apr 18, 2025
@ejschaefer
Copy link
Contributor Author

commenting to keep PR open

@iliapolo - I believe the DockerImageCode.fromImageAsset code path uses the same AssetBundling path to build locally before pushing to ECR. I will confirm shorly

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Apr 18, 2025
@tech-meppem
Copy link

tech-meppem commented May 6, 2025

Also came across this, where platform is not passed to the cli command.
Also, it seems that buildArgs also aren't passed to the cli, as setting {"--platform": "linux/arm64"} as the buildArgs in bundling options doesn't pass through either.
I'm using @aws-cdk/aws-lambda-go-alpha for context.

@ejschaefer
Copy link
Contributor Author

@ejschaefer I'm happy to merge this but can you please explain how this change fixes #33522? Seems unrelated because platform was ignored during bundling, but said issue speaks about a docker image asset that is pushed to ECR.

@iliapolo - finally had a free moment to recheck #33522. You're correct, that issue is unrelated to this change. I updated the PR description to remove the reference.

@iliapolo iliapolo changed the title fix(core): platform property not being passed to Docker in AssetBundling fix(core): platform is ignored during asset bundling May 19, 2025
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 4c8753c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented May 19, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 91bec88 into aws:main May 19, 2025
21 checks passed
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2025
@ejschaefer ejschaefer deleted the bug-s3-asset-docker-platform branch May 22, 2025 18:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. skip-abstractions-board signal to automated workflow to skip adding to project board

Projects

None yet

Development

Successfully merging this pull request may close these issues.

asset-staging.ts: target platform ignored when bundling asset

5 participants