-
Notifications
You must be signed in to change notification settings - Fork 24.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
Improve file filter for insecure repo tests #51121
Conversation
Tests in BuildPluginIT copy the workspace but exclude the build directories based on whether the directory string representation includes `/build/` or not. This check is problematic if the directory of the project has a parent directory also named `build`. The change in this commit checks to see if the path relative to the project directory has any path parts equal to `build`.
Pinging @elastic/es-core-infra (:Core/Infra/Build) |
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.
One minor comment, otherwise LGTM.
final Path projectDirPath = projectDir.toPath(); | ||
FileUtils.copyDirectory(projectDir, tmpDir.getRoot(), file -> { | ||
final Path relativePath = projectDirPath.relativize(file.toPath()); | ||
for (int i = 0; i < relativePath.getNameCount(); i++) { |
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.
Path
is itself an Iterable
so it might be easier to grok this if we replace it with for (Path segment : relativePath) { }
.
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.
Nice, that is a new one to me.
Tests in BuildPluginIT copy the workspace but exclude the build directories based on whether the directory string representation includes `/build/` or not. This check is problematic if the directory of the project has a parent directory also named `build`. The change in this commit checks to see if the path relative to the project directory has any path parts equal to `build`.
Tests in BuildPluginIT copy the workspace but exclude the build directories based on whether the directory string representation includes `/build/` or not. This check is problematic if the directory of the project has a parent directory also named `build`. The change in this commit checks to see if the path relative to the project directory has any path parts equal to `build`.
Tests in BuildPluginIT copy the workspace but exclude the build directories based on whether the directory string representation includes `/build/` or not. This check is problematic if the directory of the project has a parent directory also named `build`. The change in this commit checks to see if the path relative to the project directory has any path parts equal to `build`.
Tests in BuildPluginIT copy the workspace but exclude the build directories based on whether the directory string representation includes `/build/` or not. This check is problematic if the directory of the project has a parent directory also named `build`. The change in this commit checks to see if the path relative to the project directory has any path parts equal to `build`.
Tests in BuildPluginIT copy the workspace but exclude the build directories based on whether the directory string representation includes `/build/` or not. This check is problematic if the directory of the project has a parent directory also named `build`. The change in this commit checks to see if the path relative to the project directory has any path parts equal to `build`.
Tests in BuildPluginIT copy the workspace but exclude the build
directories based on whether the directory string representation
includes
/build/
or not. This check is problematic if the directoryof the project has a parent directory also named
build
. The change inthis commit checks to see if the path relative to the project directory
has any path parts equal to
build
.