Commit Graph

160 Commits

Author SHA1 Message Date
Eduard Heimbuch
df2a91fafe Prevent concurrent access during Copy-on-Write (#2143)
Prevent concurrent access on files during Copy-on-Write which could led to inconsistent or corrupt files.
2022-10-27 10:31:26 +02:00
Eduard Heimbuch
67c083ee54 Reduce code smells (#2089)
Reduce code smells found by deepsource.io. We focused on the low-hanging fruits and not breaking any api.
2022-07-15 15:33:37 +02:00
René Pfeuffer
f2a1effc77 Sorted autocomplete (#1918)
Users, groups, repositories and repository roles have been sorted in the rest layer by default if no other sort option was given. In the layers "below" (aka the manager classes or the dao), the collections have been unsorted. This led to the effect, that the autocomplete resource, which did not sort all values beforehand, returned unsorted results. As a sideeffect, direct matches for an input could occur at a random position or not at all (as reported in #1695), when there were enough other matches.

With this pull request the databases for users, groups, repositories and repository roles will use instances of TreeMap instead of LinkedHashMap internally, so that these values are sorted implicitly (by id respectively name for users, groups and repository roles and namespace/name for repositories).

Due to this change the default sort applied in the rest layer could be removed.
2022-01-18 09:46:10 +01:00
Sebastian Sdorra
9dee08f68d Update Gradle to 7.3 (#1873)
Update Gradle to 7.3. in order to profit from the performance improvement and to prepare for dependency lockfiles. Due to the upgrade to 7.x we had to use a license plugin which supports Gradle 7.
2021-11-29 09:05:24 +01:00
René Pfeuffer
b26ed95333 Autocloseable streams in XML DB (#1868)
Introduce autocloseable streams for file handling in xml database module.
2021-11-22 10:26:00 +01:00
StNekroman
b09284f1f5 Handle resources, never left left opened file handler on windows (#1857)
On windows unit tests are failing because junit checks if all @tempdir directries are empty and can be deleted after test run.
But due to opened file handles (not closed resource streams) Windows keeps files, which are "in use".
Linux is less strict in this area.
Additionally I want highlight that XMLStreamReaderImpl/XMLStreamWriterImpl from apache.xerces library (in OpenJDK11 at least) which are picked at runtime as xml parser implementation - they don't close associated resources.
BTW, I thing that relying on some runtime (sometimes - unpredictable) dependencies - is bad practice, but this it up to separate topic.
Additional fix: in IOUtil is file is locked (due to permissions or opened handle) - it will undlessly try-and-retry to delete it until end of the world, on windows.
2021-11-22 10:22:46 +01:00
Eduard Heimbuch
922dc27c49 Add delete method for configuration store (#1814)
Add method to delete configuration stores completely.
2021-09-30 08:54:22 +02:00
Sebastian Sdorra
0a26741ebd One index per type and parallel indexing (#1781)
Before this change the search uses a single index which distinguishes types (repositories, users, etc.) with a field (_type).
But it has turned out that this could lead to problems, in particular if different types have the same field and uses different analyzers for those fields. The following links show even more problems of a combined index:

    https://www.elastic.co/blog/index-vs-type
    https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html

With this change every type becomes its own index and the SearchEngine gets an api to modify multiple indices at once to remove all documents from all indices, which are related to a specific repository, for example.

The search uses another new api to coordinate the indexing, the central work queue.
The central work queue is able to coordinate long-running or resource intensive tasks. It is able to run tasks in parallel, but can also run tasks which targets the same resources in sequence. The queue is also persistent and can restore queued tasks after restart.

Co-authored-by: Konstantin Schaper <konstantin.schaper@cloudogu.com>
2021-08-25 15:40:11 +02:00
Eduard Heimbuch
dd0975b49a Feature/mirror (#1683)
Add mirror command and extension points.

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
Co-authored-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com>
Co-authored-by: Konstantin Schaper <konstantin.schaper@cloudogu.com>
2021-06-04 14:05:47 +02:00
René Pfeuffer
c8621061bf Overwrite files on import 2021-02-25 17:29:14 +01:00
Eduard Heimbuch
db2ce98721 Feature/import export encryption (#1533)
Add option to encrypt repository exports with a password and add possibility to decrypt them on repository import. Also make the repository export asynchronous. This implies that the repository export will be created on the server and can be downloaded multiple times. The repository export will be deleted automatically 10 days after creation.
2021-02-25 13:01:03 +01:00
René Pfeuffer
ee02ba096f Mark config entry stores explicitly in exports (#1545)
The default (XML) store of SCM-Manager does not distinguish between config and config entry stores in regards to
storage locations. Nonetheless, we want to make a difference in export files, so that other store providers can handle
these stores differently. To do so, this change adds an attribute to the top level xml element of config entry stores
to mark them. In exports, these store files can now be exported in a different folder. To mark existing stores, this
introduces an update step.
2021-02-23 09:37:59 +01:00
Eduard Heimbuch
ac5d145266 Repository export read-only lock (#1519)
* Lock repository for read-only access only while exporting
* Create read-only check api

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-02-04 15:29:49 +01:00
Eduard Heimbuch
d91c71ace1 Add the repository import and export with metadata for Subversion repositories (#1501)
* Add store exporter to collect the repository metadata
* Add EnvironmentInformationXmlGenerator
* Collect export data and put into compressed tar archive output stream
* Create full repository export endpoint.
* Add full repository export to ui
* Ignore irrelevant files from config store directory
* write metadata stores to file since a baos could teardown the server memory
* Migrate store name for git lfs files (#1504)

Changes the directory name for the git LFS blob store by
removing the repository id from the store name.

This is necessary for im- and exports of lfs blob stores,
because the original name had the repository id as a part
of it and therefore the old store would not be found when
the repository is imported with another id.

Existing blob files will be moved to the new store location
by an update step.

Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>

* Introduce util for migrations (#1505)

With this util it is more simple to rename
or delete stores.

* Rename files in export

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-01-28 11:40:35 +01:00
René Pfeuffer
8e3b0e4145 Archive repository (#1477)
This adds a flag "archived" to repositories. Repositories marked with this can no longer be modified in any way. To do this, we switch to a new version of Shiro Static Permissions (sdorra/shiro-static-permissions#4) and specify a permission guard to check for every permission request, whether the repository in question is archived or not. Further we implement checks in stores and other activies so that no writing request may be executed by mistake.

Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
2020-12-16 10:58:29 +01:00
René Pfeuffer
eaf59f91c4 Harmonize logging string for repositories 2020-12-04 11:48:32 +01:00
René Pfeuffer
32d500cc44 Add root exception to new exception
This is needed to get an idea why the context could not be created.
2020-09-15 15:15:29 +02:00
Sebastian Sdorra
d4e9f46aac Fix missing synchronization during repository creation 2020-09-14 15:48:45 +02:00
René Pfeuffer
f8da4ced55 Fixes NullPointerException
There may be v1 properties with key/value pairs, where the value is not
set. Such "pairs" led to a null pointer exception in the `map` function,
because no Optional could be created for the null value.
To solve this, we filter such properties without value in the beginning,
because these properties would create a null result both ways.
2020-07-08 08:27:04 +02:00
Eduard Heimbuch
a9d95623b9 fix tests after changed TempDir dependency 2020-05-25 13:55:42 +02:00
Eduard Heimbuch
060cd6f47e merge with develop 2020-05-25 13:26:07 +02:00
René Pfeuffer
7636f1e845 Remove temp dir extension and use native junit annotation 2020-05-24 16:05:20 +02:00
René Pfeuffer
31ffed43b7 Support copy and renamed modifications for hg 2020-05-18 14:09:58 +02:00
Sebastian Sdorra
58876e4e91 fixed some sonarqube findings 2020-04-28 15:40:35 +02:00
Sebastian Sdorra
14a1427502 use java.util.function.Predicate as api instead of the one from guava 2020-04-28 15:38:08 +02:00
Sebastian Sdorra
1a367b2657 fix duplicate ClassLoader logic 2020-04-28 14:41:31 +02:00
Sebastian Sdorra
38eea06312 added optional store parameter for ClassLoader and adapter 2020-04-28 14:10:11 +02:00
Sebastian Sdorra
cf4c1092b9 create context class in order to configure Marshaller and Unmarshaller central 2020-04-28 13:46:11 +02:00
Sebastian Sdorra
dbc97d8993 simplified structure of store builders 2020-04-28 09:47:16 +02:00
Florian Scholdei
f1b34eb502 Changeover to MIT license (#1066)
* prepare license-maven-plugin for license migration
* added license mapping for tsx files and added some more excludes
* Changeover to MIT license
* Fix build problems
* Delete old remaining licenses
* Add more exclude path for license checker
* Rename included netbeans license, add exclude .m2/repository/
* Specify .m2 exclude because not only repository/, also wrapper/ must match
* Add .cache/ exclude for license check
* Modify formatting of license in java classes to comply with convention and IDE
* Add IntelliJ documentation for license configuration
* Update CHANGELOG.md
* Exclude tmp/workspace/ dir for license check
* Edit README.md

Co-authored-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com>
2020-03-23 15:35:58 +01:00
Sebastian Sdorra
ded08d6a1d supress false positive javasecurity:S2083 on CopyOnWrite 2019-12-19 10:23:16 +01:00
Sebastian Sdorra
9525cba06b suppress sonarqube nio performance warning 2019-12-05 15:20:47 +01:00
Rene Pfeuffer
503bd8fa16 Enhance error handling 2019-12-05 10:10:26 +01:00
Rene Pfeuffer
b2bbd1d9b5 Enhance error handling 2019-12-05 10:06:17 +01:00
Rene Pfeuffer
791437a905 Use copy on write in repository db 2019-12-05 07:57:47 +01:00
Rene Pfeuffer
9ca2a57667 Fix unit test 2019-12-05 07:43:26 +01:00
Rene Pfeuffer
c4ed6f917d Use copy on write in JAXB store implementations 2019-12-04 17:16:17 +01:00
Rene Pfeuffer
3e3ab69b14 Create function for copy on write 2019-12-04 17:04:46 +01:00
Sebastian Sdorra
312fb9bb05 fix sonarqube warning about xxe processing 2019-11-28 10:45:57 +01:00
Sebastian Sdorra
854e42a609 merge with default branch 2019-11-27 15:01:09 +01:00
Rene Pfeuffer
3e2c8b7c4b Remove archive flag 2019-08-20 14:23:52 +02:00
Eduard Heimbuch
97c10a867c merged 2019-07-05 08:03:55 +02:00
René Pfeuffer
c35363b79f Store repository id in git config for each repository
This is needed after migration from v1 to v2 and is done in
GitV1UpdateStep.java. Therefore we hat to make the 'forAllPaths' method
in PathBasedRepositoryLocationResolver available in the interface of
RepositoryLocationResolver.
2019-07-03 07:48:06 +02:00
René Pfeuffer
7db3350439 Migrate git LFS blob directory 2019-07-01 14:17:32 +02:00
Eduard Heimbuch
8e0063e4b7 cleanup 2019-06-25 09:33:56 +02:00
Eduard Heimbuch
de8f15abf5 fix renameGlobalConfigFile / add Test 2019-06-25 09:12:57 +02:00
René Pfeuffer
56996395f1 Close file stream 2019-06-21 15:04:45 +02:00
René Pfeuffer
75cd5165e3 Add file tools for v1 xml stores 2019-06-21 14:35:57 +02:00
René Pfeuffer
9581bf946b Enable plugins to create config stores for repository config
Therefore we have to
- add an API to create stores for repository ids, not only for
  repositories,
- make v1 properties available in scm-core
- make sure that properties are extracted from repositories before the
  update step of a plugin runs (this is done by sorting the update steps
  in a way so that "core" update steps are executed before plugin update
  steps with the same version)
2019-06-20 16:12:16 +02:00
René Pfeuffer
4991c2ad31 Merge with 2.0.0-m3 2019-06-13 06:34:52 +02:00