-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asset-staging.ts: target platform ignored when bundling asset #30239
Labels
@aws-cdk/aws-s3-deployment
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Comments
t3r
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
labels
May 16, 2024
Thank you for the report. We'll review your PR when it's ready. |
pahud
added
p2
effort/medium
Medium work item – several days of effort
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
May 16, 2024
Thanks. PR#30240 is here. |
t3r
added a commit
to kreuzwerker/aws-cdk
that referenced
this issue
May 17, 2024
…th docker Fixes aws#30239 The bundling-properties value was not copied from the AssetBundling properties to the image.run properties so the --platform option for docker run was never added. This patch copies the platform property for AssetBundlingBindMount and AssetBundlingVolumeCopy. This fix makes the 'platform' property work as described in https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.BundlingOptions.html#platform - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
We were faced with the same problem.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
@aws-cdk/aws-s3-deployment
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
When bundling an asset e.g. in an s3_deployment using docker, the platform property gets ignored. The bundling always takes place on the host's platform.
Expected Behavior
Using
platform: 'linux/amd64'
should bundle for amd64 on M1 and
platform: 'linux/arm64'
should bundle for ARM on amd64 architecture as described in https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.BundlingOptions.html#platform
Current Behavior
platform: 'something'
is silently ignored.Reproduction Steps
Bundle for a s3_deployment like this:
Do a
cdk synthesize
and look into the created output file 'uname-m.out.txt' asset in cdk.out. Whatever you put into 'platform', it always contains your host machine's platform string.Possible Solution
The reason is that the platform given does not get propagated in aws-cdk-lib/core/lib/private/asset-staging.ts when calling image.run().
adding
platform: this.options.platform
at two places fixes the issue.Pull request is on it's way.
Additional Information/Context
No response
CDK CLI Version
2.141.0 (build 3d1c06e)
Framework Version
No response
Node.js Version
v20.11.0
OS
macos 14.4.1 (23E224)
Language
TypeScript
Language Version
No response
Other information
As a sidenote: before changing the platform, the local docker build image, e.g.
public.ecr.aws/sam/build-python3.9:latest
has to be deleted manually usingdocker image rm public.ecr.aws/sam/build-python3.9:latest
. Otherwise docker would use the same image for a different/wrong platform with unwanted behavior.Fixing that is not within the scope of this issue.
The text was updated successfully, but these errors were encountered: