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

Asset.fingerprint() does not handle excludes correctly #7718

Closed
christophgysin opened this issue Apr 30, 2020 · 0 comments · Fixed by #7719
Closed

Asset.fingerprint() does not handle excludes correctly #7718

christophgysin opened this issue Apr 30, 2020 · 0 comments · Fixed by #7719
Assignees
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package bug This issue is a bug. in-progress This issue is being actively worked on. needs-triage This issue or PR still needs to be triaged. p1

Comments

@christophgysin
Copy link
Contributor

When creating an asset from a directory with certain exclude options, the fingerprint does not change even if the files change.

Reproduction Steps

Add to packages/@aws-cdk/assets/test/fs/test.fs-fingerprint.ts

'considers negated exclude patterns for fingerprint'(test: Test) {
  // GIVEN
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'fingerprint-tests'));
  const options = {path: dir, exclude: ['**', '!file.txt'], sourcePath: dir};

  // WHEN
  const f1 = libfs.fingerprint(dir, options);
  fs.writeFileSync(path.join(dir, 'file.txt'), 'data');
  const f2 = libfs.fingerprint(dir, options);

  // THEN
  test.notDeepEqual(f1, f2);
  test.done();
},

Error Log

AssertionError: 'c917eba4ddad2e97bec2e1c5607246911cb811be0f87131042791f5525f69575' notDeepEqual 'c917eba4ddad2e97bec2e1c5607246911cb811be0f87131042791f5525f69575'

Environment

  • CLI Version : master
  • Framework Version: master
  • OS : linux
  • Language : typescript

Other


This is 🐛 Bug Report

@christophgysin christophgysin added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 30, 2020
christophgysin added a commit to christophgysin/aws-cdk that referenced this issue Apr 30, 2020
@SomayaB SomayaB added @aws-cdk/assets Related to the @aws-cdk/assets package in-progress This issue is being actively worked on. labels Apr 30, 2020
@eladb eladb added the p1 label May 3, 2020
christophgysin added a commit to christophgysin/aws-cdk that referenced this issue May 5, 2020
@mergify mergify bot closed this as completed in #7719 May 6, 2020
mergify bot pushed a commit that referenced this issue May 6, 2020
… root directory name (#7719)

When creating an asset from a directory with certain exclude options, the fingerprint does not change even if the files change.

If a fingerprint is calculated over a directory with exclude options `[ '**', '!file' ]`, the code never descends into the directory.

This commit skips the exclude check for the root directory, to correctly handle negated expressions in the exclude options.

fixes #7718
karupanerura pushed a commit to karupanerura/aws-cdk that referenced this issue May 7, 2020
… root directory name (aws#7719)

When creating an asset from a directory with certain exclude options, the fingerprint does not change even if the files change.

If a fingerprint is calculated over a directory with exclude options `[ '**', '!file' ]`, the code never descends into the directory.

This commit skips the exclude check for the root directory, to correctly handle negated expressions in the exclude options.

fixes aws#7718
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 bug This issue is a bug. in-progress This issue is being actively worked on. needs-triage This issue or PR still needs to be triaged. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants