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 exclude glob patterns to calculating fingerprint for staging #6085

Merged
merged 3 commits into from
Feb 5, 2020

Conversation

Samrose-Ahmed
Copy link
Contributor

Fixes #5238


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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

eladb
eladb previously requested changes Feb 5, 2020
@@ -31,6 +31,7 @@ export function fingerprint(fileOrDirectory: string, options: FingerprintOptions
? fileOrDirectory
: path.dirname(fileOrDirectory);
const exclude = options.exclude || [];
_hashField(hash, 'options.exclude', exclude.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

I rather we use JSON.stringify instead of toString

@@ -68,11 +68,13 @@ export = {
const outdir = fs.mkdtempSync(path.join(os.tmpdir(), 'copy-tests'));
libfs.copyDirectory(srcdir, outdir);

const options = { exclude: ['*.ignoreme'] };
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid modifying existing tests. Instead, add a new test that will verify the new behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test will fail if they don't have the same exclude options since
const hashSrc = libfs.fingerprint(srcdir); and
const hashCopy = libfs.fingerprint(outdir, { exclude: ['*.ignoreme'] });
aren't going to be equal.

@mergify mergify bot dismissed eladb’s stale review February 5, 2020 19:09

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Feb 5, 2020

Thank you for contributing! Your pull request is now being automatically merged.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Feb 5, 2020

Thank you for contributing! Your pull request is now being automatically merged.

@mergify mergify bot merged commit d9a043b into aws:master Feb 5, 2020
@anguslees
Copy link
Contributor

Shouldn't the content hash already catch this? I think including the exclude option hides a deeper bug here: the exclude handling of globs during fingerprinting is different to the exclude handling during actual asset creation.

To put it another way, two different Assets that reference the same directory, and exclude files that don't actually exist should generate the same hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lambda handlers with differing code exclusions end up with same asset
4 participants