Skip to content
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

fix(assets): add missing SAM asset metadata information #17591

Merged
merged 5 commits into from
Nov 19, 2021

Conversation

moelasmar
Copy link
Contributor

Following up on issue #14593

The integration with SAM tool requires to have some more info about the Assets. SAM needs to know if the Asset was already bundled or not, and what is the original asset path before staging.

This change is to add the following assets metadata:

  • aws:asset:is-bundled
  • aws:asset:original-path

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

…data to indicate the asset metadata original path before staging
@gitpod-io
Copy link

gitpod-io bot commented Nov 19, 2021

@github-actions github-actions bot added the @aws-cdk/assets Related to the @aws-cdk/assets package label Nov 19, 2021
@mergify
Copy link
Contributor

mergify bot commented Nov 19, 2021

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@moelasmar moelasmar changed the title Add new metadata to indicate if the asset got bundled, and a new meta… fix(assets): Add new metadata to indicate if the asset got bundled, and a new metadata to indicate the asset original path before staging Nov 19, 2021
@rix0rrr rix0rrr changed the title fix(assets): Add new metadata to indicate if the asset got bundled, and a new metadata to indicate the asset original path before staging fix(assets): add missing SAM asset metadata information Nov 19, 2021
rix0rrr
rix0rrr previously approved these changes Nov 19, 2021
@mergify mergify bot dismissed rix0rrr’s stale review November 19, 2021 15:39

Pull request has been modified.

@moelasmar moelasmar requested a review from rix0rrr November 19, 2021 16:01
rix0rrr
rix0rrr previously approved these changes Nov 19, 2021
@mergify mergify bot dismissed rix0rrr’s stale review November 19, 2021 16:22

Pull request has been modified.

@moelasmar moelasmar requested a review from rix0rrr November 19, 2021 16:22
@mergify
Copy link
Contributor

mergify bot commented Nov 19, 2021

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: e97b4cb
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit 55df760 into aws:master Nov 19, 2021
@mergify
Copy link
Contributor

mergify bot commented Nov 19, 2021

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

@@ -191,6 +207,8 @@ export class Asset extends CoreConstruct implements cdk.IAsset {
// points to a local path in order to enable local invocation of this function.
resource.cfnOptions.metadata = resource.cfnOptions.metadata || { };
resource.cfnOptions.metadata[cxapi.ASSET_RESOURCE_METADATA_PATH_KEY] = this.assetPath;
resource.cfnOptions.metadata[cxapi.ASSET_RESOURCE_METADATA_ORIGINAL_PATH_KEY] = this.originalAssetPath;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we injecting absolute paths into templates? Doesn't that break build determinism across machines?

See https://github.com/cdklabs/construct-hub/pull/648/files#r764446322 (copy @Chriscbr).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can't afford for this to be an absolute path because it means that CDK output will differ between systems (e.g. where the project directory is, etc).

Copy link
Contributor

Choose a reason for hiding this comment

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

Tracking the fix here: #17706

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
Following up on issue aws#14593

The integration with SAM tool requires to have some more info about the Assets. SAM needs to know if the Asset was already bundled or not, and what is the original asset path before staging.

This change is to add the following assets metadata:
 - aws:asset:is-bundled 
 - aws:asset:original-path

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants