-
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
fix(assets): add exclude glob patterns to calculating fingerprint for staging #6085
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@@ -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()); |
There was a problem hiding this comment.
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'] }; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
packages/@aws-cdk/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.expected.json
Outdated
Show resolved
Hide resolved
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
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. |
Fixes #5238
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license