Update git submodules
* 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] https://github.com/bazelbuild/bazel/issues/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] https://github.com/bazelbuild/bazel/issues/6358#issuecomment-429103745
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] https://github.com/bazelbuild/bazel/commit/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
This commit is contained in:
committed by
Gerrit Code Review
parent
d5a83e8175
commit
160ed97887
Submodule plugins/delete-project updated: 6d5deba11e...e0618f3dff
Reference in New Issue
Block a user