-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix(ecr-assets): incorrect handling of nested excludes in .dockerignore #34810
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
base: main
Are you sure you want to change the base?
Conversation
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
9e88188
to
3913643
Compare
Please make sure that your PR title confirms to the conventional commit standard ( |
* @see {@link https://github.com/aws/aws-cdk/issues/13636} for more info on the bug this option fixes. | ||
* @default true if the feature flag DOCKER_IGNORE_NESTED_EXCLUDE_FIX is set to true, otherwise false | ||
*/ | ||
readonly copyNestedExcludes?: boolean; |
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.
Why would you copy "excludes" ?
Does this mean respectedNestedIgnoreFiles
?
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.
"respect" seems to be a better description. I've renamed it to dockerIgnoreRespectNestedExcludes
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 think this is a bit verbose. Can you shorten it? For example, do both ignore and exclude not refer to the same thing? So do we need both?
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.
respectNestedDockerIgnores
?
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.
"exclude" means something that is excluded from the .dockerignore, so an exclude and ignore are not the same thing, they're the opposite.
** # Ignore
!build/*.js # Exclude
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.
It is verbose, but I don't think there's a good way to shorten it.
3913643
to
06574ad
Compare
06574ad
to
315d2ff
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Issue #13636
Closes #13636.
Reason for this change
Fixes a bug where asset copying does not correctly process .dockerignore files. CDK did not copy files excluded by a nested exclude pattern in
.dockerignore
.Description of changes
Added a new method in
DockerIgnoreStrategy
that determines whether a directory is fully or partially ignored. The method isDockerIgnoreStrategy.completelyIgnores
and if it returns true, it means that the directory is ignored AND that all of its children are ignored as well. For directories that are ignored but not "completely" ignored, the copyDirectory function will still walk through them.As this changes the behaviour of asset copying, this can potientally be a breaking change. Therefore, a new feature flag is added which enables this fix. The feature flag is
DOCKER_IGNORE_NESTED_EXCLUDE_FIX
.Describe any new or updated permissions being added
No new permissions are added.
Description of how you validated changes
Unit tests and integration tests are added.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license