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

Add ability to exclude subdirectories from the workspace #4888

Closed
alexeagle opened this issue Mar 20, 2018 · 13 comments
Closed

Add ability to exclude subdirectories from the workspace #4888

alexeagle opened this issue Mar 20, 2018 · 13 comments
Assignees
Labels
category: misc > misc P2 We'll consider working on this in future. (Assignee optional) type: feature request

Comments

@alexeagle
Copy link
Contributor

alexeagle commented Mar 20, 2018

We have a dist folder in the Angular project, which is in the .gitignore and we have configured editors and so on to ignore this folder. It's a very common setup for frontend projects. This folder also happens to get a copy of the @angular/bazel npm package, which has some BUILD files.

We want to teach Angular developers to bazel build //... but the expansion of the label wildcard descends into all subdirectories that are not external repositories.

I could make a dist/WORKSPACE file as a workaround, and add local_repository(name="_ignore", path="dist") to /WORKSPACE but then we can't tell git to ignore the whole dist folder.

I have the same problem with some dependencies, which frontend projects typically install into a node_modules/ directory in their project - then I hit things like grpc which ship to npm with a half-working Bazel setup.

It has also been observed by others in the ecosystem, for example this bug when the rxjs library is installed in node_modules and breaks the wildcard expansion: ReactiveX/rxjs#3334

@aehlig
Copy link
Contributor

aehlig commented Mar 27, 2018

I'm not sure, I would classify this as related to external repositories; the feature request to ignore certain directories is valid even if not external repositories are involved. Basically, a more flexible form (e.g., allowing to specify only via prefixes) of the --deleted_packages option is requested.

@aehlig aehlig added P3 We're not considering working on this, but happy to review a PR. (No assignee) category: misc > misc and removed category: extensibility > external repositories labels Mar 27, 2018
@dslomov dslomov self-assigned this Mar 27, 2018
@dslomov
Copy link
Contributor

dslomov commented Mar 27, 2018

Hmm, seems like the "ignored" directories should still go into the WORKSPACE file.
What would be the good design?

@dslomov dslomov added P2 We'll consider working on this in future. (Assignee optional) and removed P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Mar 27, 2018
@ittaiz
Copy link
Member

ittaiz commented May 11, 2018

Hey,
This is a long standing issue as I'm fairly certain #1083 and #2460 are related if not actual duplicates.
#1083 is more than 2 years old.
We have projects that are only jvm but contain node_modules in the repo. Because one git-ignores the node_modules folder, the nested WORKSPACE workaround isn't applicable.
What do you advise?

@BenTheElder
Copy link

For Kubernetes being able to ignore _output from the other (bash/make/docker based) builds would fix needing to make clean before bazel building. Bazel currently chokes on an infinite symlink expansion in _output even though we don't use anything in _output for the Bazel build.

I think a lot of projects supporting Bazel and another build system could use some functionality like ignoring directories via an option in WORKSPACE.

@ixdy
Copy link
Contributor

ixdy commented Jul 12, 2018

The --deleted_packages flag doesn't work for kubernetes' use case currently.

As @BenTheElder notes, our make-based build system creates an infinite symlink to ensure it has a valid gopath, _output/local/go/src/k8s.io/kubernetes -> [workspace root].

bazel build -- //... -//vendor/... complains about this symlink chain, and --deleted_packages doesn't seem to help here, as it fails on the infinite symlink before considering it, apparently. (It's also worth noting that _output isn't a bazel package, so I'm not sure how this would work, anyway.)

@petroseskinder
Copy link
Member

Hey,
@dslomov I have another use case that might inform how to design a solution.

At my company, we have configured our package path to be

--package_path=%workspace%:%workspace%/__fuse__

This configuration supports a workflow where users perform sparse-checkouts of our large monorepo, while still being able to bazel build code that has not been locally checked out. Packages that are not locally-checked out, are served via a read-only fuse mount.

Overall, we are fairly satisfied by this approach. However, users often run into issues when moving or deleting BUILD files. Unless they add a --deleted_packages flag, bazel will continue to pick up the package in %workspace%/__fuse__. This sometimes leads to seemingly bewildering build behavior.

If bazel could exclude subdirectories, perhaps through configuring the bazelrc or WORKSPACE, we could simply exclude the fuse version of the package whenever users deleted or move around a package.

Note, this is a supplementary issue that this fix would resolve. We are also dealing with similar issues as @alexeagle that block us from executing bazel build ...

@aehlig
Copy link
Contributor

aehlig commented Jul 25, 2018

Hmm, seems like the "ignored" directories should still go into the WORKSPACE file. What would be the good design?

If we want the ignored directories to be mentioned in the WORKSPACE, at least we have a hack to work around it by adding

local_repository(
  name = "ignore_dist",
  path = "dist",
)

to the WORKSPACE. Still not a proper solution, but maybe something we can live with for the time being.

@ixdy
Copy link
Contributor

ixdy commented Jul 25, 2018

@aehlig that doesn't work for kubernetes' needs, at least:

$ git diff
diff --git a/build/root/WORKSPACE b/build/root/WORKSPACE
index 8c6a8c6b6d..d043d75dba 100644
--- a/build/root/WORKSPACE
+++ b/build/root/WORKSPACE
@@ -92,3 +92,8 @@ docker_pull(
 load("//build:workspace_mirror.bzl", "export_urls")

 export_urls("workspace_urls")
+
+local_repository(
+    name = "ignore_output",
+    path = "_output",
+)
$ bazel build ...
ERROR: infinite symlink expansion detected
[start of symlink chain]
[HOME]/code/kubernetes/src/k8s.io/kubernetes
[HOME]/code/kubernetes/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes
[end of symlink chain]
ERROR: Failed to get information about path, for _output/local/go/src/k8s.io/kubernetes, skipping: Infinite symlink expansion
ERROR: Infinite symlink expansion
INFO: Elapsed time: 0.226s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (3 packages loaded)
    currently loading: hack ... (90 packages)

@aehlig
Copy link
Contributor

aehlig commented Jul 26, 2018

Ah, good point. Thanks.

I'll try and see if I can find a way to change bazel to have the ability to really ignore subdirectories. I'm not sure, how feasible it is, though.

@aehlig
Copy link
Contributor

aehlig commented Jul 26, 2018 via email

bazel-io pushed a commit that referenced this issue Aug 9, 2018
Add suport for a file .bazelignore, allowing to specify directories
that should be ignored. So far, even for the "ignored" directories,
the directory structure, including following symlinks, still has
to be well founded. We plan to lift that restriction in the future,
but already with the restriction, it is an improvement over the
status quo.

RELNOTES: bazel now supports a .bazelignore file specifying
  directories to be ignored; however, these directories still
  have to be well founded and, in particular, may not contain
  symlink cycles.

Improves on #4888.

Change-Id: Icfe0b7f5c35eceea16e28944ca7711431b71271a
PiperOrigin-RevId: 208050372
@ixdy
Copy link
Contributor

ixdy commented Nov 28, 2018

Are there any plans to address symlink loops?

@ghorn
Copy link

ghorn commented Dec 3, 2018

@ixdy upgrade to latest bazel and add a .bazelignore file with a list of directories you want to ignore

lucamilanesio pushed a commit to GerritCodeReview/plugins_project-group-structure that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_quota that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_readonly that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_reviewassistant that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_reviewers that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_serviceuser that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_slack-integration that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_uploadvalidator that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_verify-status that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_webhooks that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_admin-console that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_autosubmitter that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_changemessage that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_delete-project that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_emoticons that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_events-log that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_force-draft that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_gitiles that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_go-import that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_high-availability that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_importer that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_its-base that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_javamelody that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_lfs that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_messageoftheday that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_oauth that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
lucamilanesio pushed a commit to GerritCodeReview/plugins_owners that referenced this issue Dec 5, 2018
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
openstack-gerrit pushed a commit to openstack-infra/gerrit that referenced this issue Dec 9, 2018
* Update plugins/delete-project from branch 'master'
  to e0618f3dff8fcc1c36861a99b2162ac611e707c6
  - Merge branch 'stable-2.16'
    
    * stable-2.16:
      Bazel: Include eclipse-out directory in .bazelignore
      Add explanatory comment to empty BUILD file(s)
      Update mockito to 2.23.4
      Upgrade bazlets to latest stable-2.16 to build with 2.16 API
      Always pass ALLOW_INSECURE to MoreFiles.deleteRecursively
      ArchiveRepositoryRemoverTest: Refactor assertions on repo content
      Format external_plugin_deps.bzl with buildifier
      Upgrade bazlets to latest stable-2.14 to build with 2.14.17 API
      Upgrade bazlets to latest stable-2.14 to build with 2.14.16 API
      Align Eclipse compiler settings with core Gerrit's
      WORKSPACE: Make commented out lines spaces indent consistent
      Add IT test
      FilesystemDeleteHandler: Use more readable name for trash folder
      Configure whether to allow user to select preserve
      Introduce an archiving mechanism for deleted repos
      bazlets: Replace native.git_repository with skylark rule
      Harmonize external dependency names to use hyphen
      Upgrade mockito to 2.23.0
      Update bazlets to latest stable-2.14 to build with 2.14.15 API
      Update bazlets to latest stable-2.14 to build with 2.14.14 API
      Update bazlets to latest stable-2.14 to build with 2.14.13 API
      FilesystemDeleteHandler: Don't instantiate event if there are no listeners
      FilesystemDeleteHandler: Rename deletedListener to deletedListeners
      DatabaseDeleteHandler.java: Remove unused Provider<InternalChangeQuery>
      Add RecursiveDeleteOption.ALLOW_INSECURE for recursive deletion
      Simplify DeleteTrashFolder
      DeleteTrashFolders: Extract predicate to its own class
      Add unit test for DeleteTrashFolders
      Update bazlets to latest stable-2.14 to use 2.14.12 API
      Migrate `tools/bazel.rc` to `.bazelrc`
      Tidy up FilesystemDeleteHandler
      Add unit tests for FilesystemDeleteHandler
      Extract deletion preconditions to its own class
    
    Adapt DeleteProjectIT to master's AbstractDaemonTest
    createProjectOverAPI method, replacing the pre-master createProject
    ones.
    
    Change-Id: Ib0fb7be6160c3aabfa763b751bcb682fe2c54346
    
  - Merge branch 'stable-2.15' into stable-2.16
    
    * stable-2.15:
      Bazel: Include eclipse-out directory in .bazelignore
      Add explanatory comment to empty BUILD file(s)
    
    Change-Id: Ie99d742ec161ecf675bed674fdc939fb6ced71f2
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Bazel: Include eclipse-out directory in .bazelignore
    
    Change-Id: I8a7b1bbb90361fa99d9f32fb8b444a0004502897
    
  - Bazel: Include eclipse-out directory in .bazelignore
    
    Since [1] (included since 0.17) Bazel added support for a .bazelignore
    file, allowing to specify directories that should be ignored.
    
    [1] bazelbuild/bazel#4888
    
    Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Add explanatory comment to empty BUILD file(s)
    
    Change-Id: I26811188253cc4d73bd0470bafad6fb0f5edbb61
    
  - Add explanatory comment to empty BUILD file(s)
    
    Change-Id: Ifc4e5146672ffa35ba45882cafaae82bf9ea5751
    
  - Merge branch 'stable-2.15' into stable-2.16
    
    * stable-2.15:
      Update mockito to 2.23.4
      Always pass ALLOW_INSECURE to MoreFiles.deleteRecursively
      ArchiveRepositoryRemoverTest: Refactor assertions on repo content
      Format external_plugin_deps.bzl with buildifier
      Upgrade bazlets to latest stable-2.14 to build with 2.14.17 API
      Upgrade bazlets to latest stable-2.14 to build with 2.14.16 API
      Align Eclipse compiler settings with core Gerrit's
      WORKSPACE: Make commented out lines spaces indent consistent
      Add IT test
      FilesystemDeleteHandler: Use more readable name for trash folder
      Configure whether to allow user to select preserve
      Introduce an archiving mechanism for deleted repos
      bazlets: Replace native.git_repository with skylark rule
      Harmonize external dependency names to use hyphen
      Upgrade mockito to 2.23.0
      Update bazlets to latest stable-2.14 to build with 2.14.15 API
      Update bazlets to latest stable-2.14 to build with 2.14.14 API
      Update bazlets to latest stable-2.14 to build with 2.14.13 API
      FilesystemDeleteHandler: Don't instantiate event if there are no listeners
      FilesystemDeleteHandler: Rename deletedListener to deletedListeners
      DatabaseDeleteHandler.java: Remove unused Provider<InternalChangeQuery>
      Add RecursiveDeleteOption.ALLOW_INSECURE for recursive deletion
      Simplify DeleteTrashFolder
      DeleteTrashFolders: Extract predicate to its own class
      Add unit test for DeleteTrashFolders
      Update bazlets to latest stable-2.14 to use 2.14.12 API
      Migrate `tools/bazel.rc` to `.bazelrc`
      Tidy up FilesystemDeleteHandler
      Add unit tests for FilesystemDeleteHandler
      Extract deletion preconditions to its own class
    
    Change-Id: Id48037c00116b10ca809835d03f915ae231a629d
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Update mockito to 2.23.4
      Always pass ALLOW_INSECURE to MoreFiles.deleteRecursively
      ArchiveRepositoryRemoverTest: Refactor assertions on repo content
      Format external_plugin_deps.bzl with buildifier
      Upgrade bazlets to latest stable-2.14 to build with 2.14.17 API
      Upgrade bazlets to latest stable-2.14 to build with 2.14.16 API
    
    Change-Id: Ie45390df44f13bf66234cf8b41f3e51eb405701d
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Align Eclipse compiler settings with core Gerrit's
      WORKSPACE: Make commented out lines spaces indent consistent
      Add IT test
      FilesystemDeleteHandler: Use more readable name for trash folder
      Configure whether to allow user to select preserve
      Introduce an archiving mechanism for deleted repos
      bazlets: Replace native.git_repository with skylark rule
      Harmonize external dependency names to use hyphen
      Upgrade mockito to 2.23.0
      Update bazlets to latest stable-2.14 to build with 2.14.15 API
      Update bazlets to latest stable-2.14 to build with 2.14.14 API
      Update bazlets to latest stable-2.14 to build with 2.14.13 API
      FilesystemDeleteHandler: Don't instantiate event if there are no listeners
      FilesystemDeleteHandler: Rename deletedListener to deletedListeners
      DatabaseDeleteHandler.java: Remove unused Provider<InternalChangeQuery>
      Add RecursiveDeleteOption.ALLOW_INSECURE for recursive deletion
      Simplify DeleteTrashFolder
      DeleteTrashFolders: Extract predicate to its own class
      Add unit test for DeleteTrashFolders
      Update bazlets to latest stable-2.14 to use 2.14.12 API
      Migrate `tools/bazel.rc` to `.bazelrc`
      Tidy up FilesystemDeleteHandler
      Add unit tests for FilesystemDeleteHandler
      Extract deletion preconditions to its own class
    
    Change-Id: Iba2e175783cf18ace0329efe81fc417640f77aa0
    
  - Update mockito to 2.23.4
    
    Also update its dependency byte buddy to 1.9.3.
    
    Change-Id: I23d224db808e8620ac136c428f75a467065e0528
    
  - Upgrade bazlets to latest stable-2.16 to build with 2.16 API
    
    Change-Id: I9f565aba3467ca7fab9036d201b4d901002b45f0
    
  - Always pass ALLOW_INSECURE to MoreFiles.deleteRecursively
    
    If ALLOW_INSECURE is not set, it fails on OSX with:
    
      unable to guarantee security of recursive delete
    
    See change Ic0894b88e for previous fix.
    
    Change-Id: I0e323230542174a14c5d2038df838052af6fc5be
    
  - ArchiveRepositoryRemoverTest: Refactor assertions on repo content
    
    The current assertion for an empty folder only checks if there is
    any content and fails if there is. Refactor it so that when it fails
    it includes a message listing the actual content that was unexpected.
    
    Change-Id: Ie974690cf90f98bb517a9b4dc195b09076c3a076
    
  - Format external_plugin_deps.bzl with buildifier
    
    Change-Id: Ic654b81b5f91726fecc0599d96ff06f75d0e8c07
    
  - Upgrade bazlets to latest stable-2.14 to build with 2.14.17 API
    
    Change-Id: Ib8f6629f514119d6cbdb445bb3654a66c98168a5
    
  - Upgrade bazlets to latest stable-2.14 to build with 2.14.16 API
    
    Change-Id: I1b17a3692ad762861d19affc7fb46afca9387432
    
  - Align Eclipse compiler settings with core Gerrit's
    
    Having the same compiler settings as core Gerrit means that when
    the project is opened in its standalone Eclipse project, the same
    warnings appear as when opened within the Gerrit tree (i.e. as a
    bundled plugin).
    
    Change-Id: I72ee1b550db591655370952a1465ad1fdf4acb9b
    
  - WORKSPACE: Make commented out lines spaces indent consistent
    
    Change-Id: Idf671f1e4699123f991502763a5a3e530addaf5a
    
  - Merge "bazlets: Replace native.git_repository with skylark rule" into stable-2.14
  - Merge changes I28300bd3,I2028c0db,I62985e8f into stable-2.14
    
    * changes:
      Add IT test
      Configure whether to allow user to select preserve
      Introduce an archiving mechanism for deleted repos
    
  - Merge "FilesystemDeleteHandler: Use more readable name for trash folder" into stable-2.14
  - Add IT test
    
    Change-Id: I28300bd3e1a606b99f1f902eccc691f8681900d8
    
  - Configure whether to allow user to select preserve
    
    In some cases, it could be desirable to prevent users from choosing the
    "Preserve git repository" option when deleting a project. For example,
    when the administrators have choose to archive a repository instead of
    deleting it and the preserve option is selected, the repository will be
    present twice on the file system.
    
    Add a new configuration, enablePreserveOption, to control whether to
    enable the preserve option on the UI and the ssh command.
    
    In order to keep the current behaviour, the default value of this option
    is set to true. If this configuration is set to be false, the deleted
    git repository will not be preserved.
    
    Change-Id: I2028c0dbe126a56d4b71f44742bd5fc734465631
    
  - Introduce an archiving mechanism for deleted repos
    
    So far, if the preserveGitRepository option was set to false, once a
    repository was deleted, there was no way to recover it. Even if this
    makes sense, mistakes happen and it could be handy to have a backup
    mechanism when they occur. Besides, in some environments it could be
    desirable to give end users the permission to delete their own projects
    as this reduces the administrative tasks. In this case, being able to
    recover mistakenly deleted repositories could be even more critical.
    
    Introduce a new option to archive a repository instead of deleting it.
    This will allow the administrators to recover the git repositories in
    case of deletion by mistake. From the user point of view, and even for
    Gerrit, the repository is deleted as it is no longer available given it
    is moved to a different name and under a different, configurable named,
    folder.
    
    The archived repositories are kept for a configurable amount of time
    after which they are deleted; the auto-cleaning of the archived git
    repositories is done periodically, i.e., once a day.
    
    Three new configuration fields are added to customize the behaviour of
    this feature:
    
      - archiveDeletedRepos: whether to enable this feature. By default
        false.
      - archiveFolder: the path of the target archive folder. By default,
        the plugin data folder.
      - deleteArchivedReposAfter: the time period to keep the archived git
        repositories. By default, 180 days. If archiveDeletedRepos is true
        but this values is set to 0, the periodic task will not run and the
        archived repositories need to be cleaned manually or using an
        external task.
    
    Change-Id: I62985e8ffa5e3300c6927507e793dffd7aa2e54c
    
  - FilesystemDeleteHandler: Use more readable name for trash folder
    
    Some users consider more readable to use a time format that includes the
    date and time the repository was moved to the trash rather than an epoch
    number.
    
    Change-Id: I7d9733373a6d2ddd01905b6e44084d9cfdfc67fd
    
  - bazlets: Replace native.git_repository with skylark rule
    
    The native.git_repository rule does not work properly when invoked
    in a `git submodule foreach` command. Bazel will deprecate the
    native rules anyway, so replace with skylark's git_repository.
    
    See [1] for context.
    
    [1] bazelbuild/bazel#6358 (comment)
    
    Change-Id: I336ec65f6751ee526c95ea46c9ccb4905f5b6fc3
    
  - Harmonize external dependency names to use hyphen
    
    Change-Id: Ica25b94672a11e9cc2001b5a9d68fe981f22b7e0
    
  - Upgrade mockito to 2.23.0
    
    Change-Id: I2e629c54b842cae3f36f48f7c86e2348b8d7a68f
    
  - Update bazlets to latest stable-2.14 to build with 2.14.15 API
    
    Change-Id: Ib402205ea2d20aeccd6d45cb52dbcba540b5a867
    
  - Update bazlets to latest stable-2.14 to build with 2.14.14 API
    
    Change-Id: I2b558fcdedde748dc8b781218277cf1618b6c3ce
    
  - Update bazlets to latest stable-2.14 to build with 2.14.13 API
    
    Change-Id: I4a7d001ae9314d51ee6166c2429746b51679d2da
    
  - FilesystemDeleteHandler: Don't instantiate event if there are no listeners
    
    If there are no ProjectDeletedListener instances registered, it is
    not necessary to instantiate an Event object that will not be used.
    
    Check if there are any listeners, and early exit when there are none.
    
    Change-Id: Ib036920e2c2d07507748fcc182db7568dbdb96f4
    
  - FilesystemDeleteHandler: Rename deletedListener to deletedListeners
    
    Change-Id: I126266d0105aa3f51a78107b428ce47b8e286816
    
  - DatabaseDeleteHandler.java: Remove unused Provider<InternalChangeQuery>
    
    Change-Id: Iff67e58fee00a1f7fd3a9259e1f914ef2216f882
    Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
    
  - Add RecursiveDeleteOption.ALLOW_INSECURE for recursive deletion
    
    Otherwise unit tests are failing on osx with the following error:
    JUnit4 Test Runner
    ...............log4j:WARN No appenders could be found for logger
      (org.eclipse.jgit.util.FS).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig
      for more info.
    E......
    Time: 1.255
    There was 1 failure:
    1) testStart(com.googlesource.gerrit.plugins.deleteproject.fs
      .DeleteTrashFoldersTest)
    java.lang.AssertionError: The subject was expected to be false,
      but was true
        at com.googlesource.gerrit.plugins.deleteproject.fs
          .DeleteTrashFoldersTest.testStart(DeleteTrashFoldersTest.java:63)
          ...
    
    which is caused by:
    [2018-09-18 15:23:01,351] [DeleteTrashFolders] ERROR com.googlesource.gerrit
        .plugins.deleteproject.fs.DeleteTrashFolders :
      Failed to delete /.../repo.1234567890123.deleted
      com.google.common.io.InsecureRecursiveDeleteException:
        /.../repo.1234567890123.deleted:
        unable to guarantee security of recursive delete
        at com.google.common.io.MoreFiles
          .checkAllowsInsecure(MoreFiles.java:739)
        at com.google.common.io.MoreFiles
          .deleteRecursively(MoreFiles.java:525)
        at com.googlesource.gerrit.plugins.deleteproject.fs
          .DeleteTrashFolders
            .recursivelyDelete(DeleteTrashFolders.java:102)
    
    Change-Id: Ic0894b88e912ef538796f6817065d974b28bc0a4
    Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
    
  - Simplify DeleteTrashFolder
    
    Replace inner class with Java 8 stream, Files.walkFileTree() with Files.
    walk() and for recursive removal of subtree, use Guava's MoreFiles.
    deleteRecursively.
    
    Change-Id: I3007bb608ab27920627d016943b1de67682fd590
    
  - DeleteTrashFolders: Extract predicate to its own class
    
    Change-Id: If6f754ecccd5313bb46e71b366eb2264487e3432
    
  - Add unit test for DeleteTrashFolders
    
    Change-Id: I1873f5e9e748b33edd42bd40d31a9ca8e7cf6d48
    
  - Merge "Tidy up FilesystemDeleteHandler" into stable-2.14
  - Update bazlets to latest stable-2.14 to use 2.14.12 API
    
    Change-Id: Ie46bb591a5e2577c60a83bfead7aa3ea06bdd1e6
    
  - Migrate `tools/bazel.rc` to `.bazelrc`
    
    Since: [1] Bazel changed the list of resource file locations.
    Adapt to that list and move `%workspace%/tools/bazelrc` to
    `%workspace%/.bazelrc`.
    
    [1] bazelbuild/bazel@ec83598
    
    Change-Id: I3d2c05691b757684ba8f816cf2669c754dd77888
    (cherry picked from commit b31596bb73cc8a67481ba3439f44384341bd15e4)
    
  - Tidy up FilesystemDeleteHandler
    
    * Inline one-time use variables
    * Remove final from method parameters
    * Rename, reorder and extract additional methods to improve readability
    * Use Guava's MoreFiles.deleteRecursively instead of Path walkers
    
    Change-Id: I3808c3e78e3a572c158a88abe8cb77d3f2168b6e
    
  - Add unit tests for FilesystemDeleteHandler
    
    Change-Id: I6016003bc8938e6389e17cb96bd5a439f803b4c0
    
  - Extract deletion preconditions to its own class
    
    Instead of spreading the assertions done before deleting a change in
    several classes, extract them in a dedicated class, DeletePreconditions.
    This eases the unit testing of the now simplified classes and better
    reflects the fact that some of these assertions do not belong anymore to
    the class where they were hosted. One example: the check for submodules
    was in the DatabaseDeleteHandler class because this information used to
    be in the database, but this is no longer the case.
    
    Additional test coverage for this class will be provided in an upcoming
    change adding IT tests.
    
    Change-Id: Ie1f513f5981035aba217200f608c6ca6e6357cb1
lucamilanesio pushed a commit to GerritCodeReview/plugins_log-level that referenced this issue Feb 9, 2019
Since [1] (included since 0.17) Bazel added support for a .bazelignore
file, allowing to specify directories that should be ignored.

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
qtprojectorg pushed a commit to qtqa/gerrit that referenced this issue Feb 9, 2019
* Update plugins/gitiles from branch 'master'
  to b90db6dd4c43294e94523222a9ee57a65d11d058
  - Merge branch 'stable-2.16'
    
    * stable-2.16:
      Upgrade bazlets to latest stable-2.15 to build with 2.15.10 API
      Upgrade bazlets to latest stable-2.16 to build with 2.16.4 API
      Upgrade bazlets to latest stable-2.15 to build with 2.15.9 API
      Upgrade bazlets to latest stable-2.15 to build with 2.15.8 API
      Upgrade bazlets to latest stable-2.14 to build with 2.14.18 API
      Bazel: Include eclipse-out directory in .bazelignore
      Add explanatory comment to empty BUILD file(s)
    
    Change-Id: I0467ee0dced8cc5109def53be2db21d03cfcdcdc
    
  - Merge branch 'stable-2.15' into stable-2.16
    
    * stable-2.15:
      Upgrade bazlets to latest stable-2.15 to build with 2.15.10 API
    
    Change-Id: I08fae3342c9f2a228a90f6111f3862f8170a47f0
    
  - Upgrade bazlets to latest stable-2.15 to build with 2.15.10 API
    
    Change-Id: Id11f7812c7e60694cc3844de982203411c93bc07
    
  - Merge branch 'stable-2.15' into stable-2.16
    
    * stable-2.15:
      Upgrade bazlets to latest stable-2.15 to build with 2.15.9 API
      Upgrade bazlets to latest stable-2.15 to build with 2.15.8 API
      Upgrade bazlets to latest stable-2.14 to build with 2.14.18 API
      Bazel: Include eclipse-out directory in .bazelignore
      Add explanatory comment to empty BUILD file(s)
    
    Change-Id: Ibcbf7f766db422b78aa908b5eb0d7c0abbe29870
    
  - Upgrade bazlets to latest stable-2.16 to build with 2.16.4 API
    
    Change-Id: If7661de29f4275e17485347b839e5f9cf435b666
    
  - Upgrade bazlets to latest stable-2.15 to build with 2.15.9 API
    
    Change-Id: I0420add4c27af424214e2916ed4347c8ee6367a2
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Upgrade bazlets to latest stable-2.14 to build with 2.14.18 API
    
    Change-Id: I7253e237c4a141350fcf426e7efee58a3e4ec2e0
    
  - Upgrade bazlets to latest stable-2.15 to build with 2.15.8 API
    
    Change-Id: I37a69b9513859283bf51b138d2a18f37d5bf32e0
    
  - Upgrade bazlets to latest stable-2.14 to build with 2.14.18 API
    
    Change-Id: I47b6c7a49d1b09b505f16e9d282af2e499a93bb1
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Bazel: Include eclipse-out directory in .bazelignore
    
    Change-Id: If07072fce48702924a3b64df38524dcdc99b1b50
    
  - Bazel: Include eclipse-out directory in .bazelignore
    
    Since [1] (included since 0.17) Bazel added support for a .bazelignore
    file, allowing to specify directories that should be ignored.
    
    [1] bazelbuild/bazel#4888
    
    Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
    
  - Merge branch 'stable-2.14' into stable-2.15
    
    * stable-2.14:
      Add explanatory comment to empty BUILD file(s)
    
    Change-Id: I1f8704b964327597d0a26ef849b6ab40a077c0c1
    
  - Add explanatory comment to empty BUILD file(s)
    
    Change-Id: Ifc4e5146672ffa35ba45882cafaae82bf9ea5751
lucamilanesio pushed a commit to GerritCodeReview/gerrit that referenced this issue Oct 13, 2019
Since [1] Bazel added support for .bazelignore, allowing to specify
directories that should be ignored. We still preserve the exclusion of
BUILD files in generated .classpath file to avoid Eclipse warnings in
the form:

  The resource is a duplicate of java/BUILD \
  and was not copied to the output folder

[1] bazelbuild/bazel#4888

Change-Id: I8dfd9b5701dfcc85fd51f626af448d0306b02857
@TheButlah
Copy link

This doesn't properly ignore subdirectories of the given folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: misc > misc P2 We'll consider working on this in future. (Assignee optional) type: feature request
Projects
None yet
Development

No branches or pull requests

10 participants