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

Improve file filter for insecure repo tests #51121

Merged
merged 4 commits into from
Jan 17, 2020

Conversation

jaymode
Copy link
Member

@jaymode jaymode commented Jan 16, 2020

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`.
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Build)

Copy link
Contributor

@mark-vieira mark-vieira left a 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++) {
Copy link
Contributor

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) { }.

Copy link
Member Author

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.

@jaymode jaymode merged commit 0f7f1ec into elastic:master Jan 17, 2020
@jaymode jaymode deleted the build_plugin_it_file_filter branch January 17, 2020 16:59
jaymode added a commit to jaymode/elasticsearch that referenced this pull request Jan 17, 2020
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`.
jaymode added a commit to jaymode/elasticsearch that referenced this pull request Jan 17, 2020
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`.
jaymode added a commit that referenced this pull request Jan 17, 2020
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`.
jaymode added a commit that referenced this pull request Jan 17, 2020
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`.
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this pull request Jan 23, 2020
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`.
@polyfractal polyfractal added v7.6.0 and removed v7.6.1 labels Feb 7, 2020
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure >enhancement Team:Delivery Meta label for Delivery team v7.6.0 v7.7.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants