Commit Graph

2302 Commits

Author SHA1 Message Date
Sebastian Sdorra
42d79bad63 Multipart form support for AdvancedHttpClient (#1856)
Add support for mutlipart form data to the AdvancedHttpClient API.
2021-11-11 15:48:16 +01:00
René Pfeuffer
7a72359bc9 File lock for svn (#1847)
Implements the file lock command for SVN.
2021-11-11 10:58:26 +01:00
René Pfeuffer
3792374d59 Fix serialization error with health check failures 2021-11-10 14:44:28 +01:00
René Pfeuffer
e1a2d27256 Implement file lock for git (#1838)
Adds a "file lock" command that can be used to mark files as locked by a specific user. This command is implemented for git using a store to keep the locks.

Additionally, the Git LFS locking API is implemented.

To display locks, the scm-manager/scm-file-lock-plugin can be used.

Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
2021-11-01 16:54:58 +01:00
Sebastian Sdorra
87aea1936b Remove www from scm-manager.org url (#1837) 2021-10-28 11:00:24 +02:00
René Pfeuffer
41b8f091c0 Add recursive deletion in modify command (#1821)
Adds a method in the ModifyCommand to delete not only files, but also directories recursively.
2021-10-07 14:40:48 +02:00
Sebastian Sdorra
d1de7bf214 Clear external group cache on explicit logout or user deletion (#1819)
Clears the external group cache whenever a user gets logged out by the logout rest method or the user gets deleted.

Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
2021-10-06 14:34:10 +02:00
René Pfeuffer
2b85081032 Make EMail computation available for DisplayUser (#1815)
Adds an internal api call to determine a email address for a DisplayUser instance
in class EMail. This was available only for the User class before, but there is no
reason, why this should be limited.

Additionally one can also set the author for the merge command as DisplayUser,
which will trigger the fallback mechanisms for the email address, if it is missing.

This is introduced to make merge commits possible for users without email addresses
in the review plugin (scm-manager/scm-review-plugin#149).
2021-09-30 14:32:31 +02: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
Eduard Heimbuch
8a65660278 Auto mapper binding (#1807)
Bind mapper implementations automatically to related mappers using the annotation processor. With this change it is not longer required to bind mapper explicitly using mapper modules which reduces some boilerplate code.
2021-09-14 09:26:47 +02:00
René Pfeuffer
13d72d45c6 Prevent multiple instances of working copy pool (#1797)
The working copy pool has to be a singleton, because
otherwise there could be multiple instances with their
own caches and therefore no reuse and maybe more relevant
working directories that will never be deleted.
2021-09-06 08:40:22 +02:00
Sebastian Sdorra
70fba6c990 More flexible delete and query api (#1790)
Replaces the filter and delete by repository api's with a more flexible api, which allows to filter and delete by any id part.
2021-09-01 16:19:19 +02:00
Sebastian Sdorra
765a39e4ce Remove unsafe index options api (#1787)
The IndexOptions api has several problems:
- It is possible to open the same index with different options, which could lead to scoring problems
- If the index is already opened from another task, the options are ignored and the one from the opening task are used
- The analyzer which is derived from the options is used for every field which has not configured a specific analyzer
- This change removes the options api completely.

Co-authored-by: Konstantin Schaper <konstantin.schaper@cloudogu.com>
2021-08-31 14:03:16 +02:00
Sebastian Sdorra
571025032c Create a more flexible and typesafe id for indexed objects (#1785)
Id's can now be combined with more than just a repository. It is now possible to build a more complex Id such as Comment -> Pull request -> Repository. The id's now bound to a specific type. This makes it harder to accidentally use a id within an index of the wrong type.
2021-08-31 11:27:49 +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
Konstantin Schaper
44f25d6b15 Fix disabled local proxy configuration being used over global config (#1780)
The original proxy configuration implementation only used the global configuration if the local proxy configuration was not provided (i.e. null). This PR adds the corner case where a local configuration is provided, but disabled. In this case, the global proxy configuration will be used as a fallback as well.
2021-08-25 08:19:52 +02:00
Sebastian Sdorra
519748106e Fix too heavy logging of SchemeBasedWebTokenGenerator (#1777)
Reduce log level of `could not create token from authentication header from warn to debug, because it is normal that these message is logged if multiple SchemeBasedWebTokenGenerator are registered.

Fixes #1772
2021-08-23 20:07:52 +02:00
Sebastian Sdorra
7f9f4e566c Proxy support for pull, push and mirror commands (#1773)
Apply proxy support for jGit by extracting the required functionality from the DefaultAdvancedHttpClient into its own class HttpURLConnectionFactory. This new class is now used by the DefaultAdvancedHttpClient and jGit.
The HttpURLConnection also fixes proxy server authentication, which was non functional in DefaultAdvancedHttpClient.
The proxy support for SVNKit is implemented by using the provided method of the BasicAuthenticationManager.
For mercurial the support is configured by writing the required settings to a temporary hgrc file.
2021-08-19 11:27:51 +02:00
Sebastian Sdorra
3e6ce4e814 Add DefaultBranchChangedEvent (#1763)
The DefaultBranchChangedEvent is fired whenever the default branch of repository changes.
2021-08-11 09:28:00 +02:00
René Pfeuffer
8558572c99 Modifications command between two revisions (#1761)
Adds the option to compute the modifications between two revisions unsing the modifications command.
2021-08-09 12:13:41 +02:00
Konstantin Schaper
ddd2fc1055 Add additional help to quick search and an advanced search documentation page (#1757)
Co-authored-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com>
2021-08-09 12:07:28 +02:00
Sebastian Sdorra
8ce69d9848 Allow enrichment of embedded repositories on search hits (#1760)
* Introduce RepositoryCoordinates

RepositoryCoordinates will be used for the enrichment of the embedded repositories of search result hits. This is required, because if we used the normal repository for the enrichment, we would get a lot of unrelated enrichers would be applied.

* Add builder method to HalEnricherContext

With the new builder method it is possible to add an object to the context with an interface as key.

* Add enricher support for embedded repository by applying enricher for RepositoryCoordinates

* Use embedded repository for avatars
2021-08-05 15:12:48 +02:00
Sebastian Sdorra
21a6943980 Refactor Search API and allow analyzer per field (#1755)
The Search api is now simpler, because it provides useful defaults. Only if you want to deviate from the defaults, you can set these values. This is mostly reached by using the builder pattern. Furthermore it is now possible to configure an analyzer per field. The default analyzer is still the one which is derived from the index options, but it is possible to configure a new indexer with the analyzer attribute of the indexed annotation. The attribute allows the configuration for code, identifiers and path. The current implementation uses the same analyzer code, identifiers and path. The new implemented splits tokens on more delimiters as the default analyzer e.g.: dots, underscores etc.

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-08-05 08:21:46 +02:00
Sebastian Sdorra
7c10926244 Add embedded repository to search result hit (#1756)
Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-08-04 16:29:23 +02:00
Sebastian Sdorra
e492a30eea Expose content type resolver api to plugins (#1752)
Expose an api which makes it easy to detect the content type of files. The api is based on the spotter api, but does not expose spotter classes.

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-08-03 10:41:38 +02:00
Sebastian Sdorra
91fec0f478 Add detailed search result ui (#1738)
Add a dedicated search page with more results and different types.
Users and groups are now indexed along with repositories.

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-07-28 11:19:00 +02:00
René Pfeuffer
ad6000722d LRU semantic for workdir cache (#1735)
Introduces a maximum size for the simple workdir cache. On cache overflow workdirs are evicted using an LRU strategy.
Furthermore parallel requests for the same repository will now block until the workdir is released.
2021-07-28 07:54:37 +02:00
Eduard Heimbuch
f52c0b07bf Enhance push command with username/password authentication (#1734) 2021-07-23 13:42:39 +02:00
Sebastian Sdorra
39d2f12b66 Return separate links for searchable types instead of single templated link (#1733)
The search link of the index resource is now an array of links instead of single templated link.
The array contains one link for each searchable type.

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-07-21 10:07:41 +02:00
Sebastian Sdorra
e75d937ee5 Prepare search api for different types (#1732)
We introduced a new annotation '@IndexedType' which gets collected by the scm-annotation-processor. All classes which are annotated are index and searchable. This opens the search api for plugins.
2021-07-19 08:48:43 +02:00
Sebastian Sdorra
e321133ff7 Add search engine and quick search for repositories (#1727)
Add a powerful search engine based on lucene to the scm-manager api.
The api can be used to index objects, simply by annotating them and add them to an index.
The first indexed object is the repository which could queried by quick search in the header.
2021-07-14 11:49:38 +02:00
Eduard Heimbuch
7a3db7ee3f Include cloudogu plugins to plugin center (#1709)
Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-06-25 09:22:53 +02:00
René Pfeuffer
d9d3547a22 Create custom initial user (#1707)
Using a default user with a default password has the implicit risk, that this user is not changed and therefore this system can be compromised. With this change, SCM-Manager does not create the default user with the default password on startup any more, but it shows an initial form where the initial values for the administration user have to be entered by the user. To secure this form, a random token is created on startup and printed in the log.

To implement this form, the concept of an InitializationStep is introduced. This extension point can be implemented to offer different setup tasks. The creation of the administration user is the first implementation, others might be things like first plugin selections or the like.

Frontend components are selected by the name of these initialization steps, whose names will be added to the index resource
(whichever is active at the moment) and will be show accordingly.

Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
2021-06-24 09:29:42 +02:00
Eduard Heimbuch
97b32f3918 Clear caches if gpg key was added or deleted (#1701)
Clear more caches if GPG key was added or deleted. It seems quite difficult to find the right way to invalidate partial caches so for now we keep purging everything.

Maybe we could add an API to efficiently find out what parts of the cache can be removed.

Fixes #1668
2021-06-15 19:10:48 +02:00
Florian Scholdei
f274b7f4b2 Add handling when duplicated branch part cannot be created (#1692)
Add handling when duplicated branch cannot be created because a part of the name already exists as a branch
2021-06-09 14:58:59 +02:00
René Pfeuffer
fc16424e28 Clean up read only API (#1686)
Cleans up an interface method that was badly named but escaped the review process.
2021-06-08 20:35:37 +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
Sebastian Sdorra
f6c91f4b4c Update guice to version 5.0.1 (#1673) 2021-05-27 09:26:29 +02:00
Florian Scholdei
42745c9e34 Notifications for health checks (#1664)
Add list of emergency contacts to global configuration. This user will receive e-mails and notification if some serious system error occurs like repository health check failed.
2021-05-20 08:30:20 +02:00
Sebastian Sdorra
9e45d8255d Fix sse for notifications behind nginx reverse proxy (#1650) 2021-05-10 08:57:46 +02:00
Sebastian Sdorra
b975fb655d Feature/global notifications (#1646)
Add global notifications
2021-05-05 14:43:16 +02:00
Eduard Heimbuch
8f91c217fc Add patch endpoint for global config (#1629)
Co-authored-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com>
2021-04-28 08:47:29 +02:00
Eduard Heimbuch
7579d91505 Fix limit with negative integer for SearchUtil (#1627)
Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-04-21 16:19:16 +02:00
René Pfeuffer
1e83c34823 Enable Health Checks (#1621)
In the release of version 2.0.0 of SCM-Manager, the health checks had been neglected. This makes them visible again in the frontend and adds the ability to trigger them. In addition there are two types of health checks: The "normal" ones, now called "light checks", that are run on startup, and more intense checks run only on request.

As a change to version 1.x, health checks will no longer be persisted for repositories.

Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
2021-04-21 10:09:23 +02:00
Eduard Heimbuch
d94ebb2e3e Validate filepath and filename to prevent path traversal (#1604)
Validate filepath and filename to prevent path traversal in modification
command and provide validations for editor plugin.

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-03-25 12:50:24 +01:00
Eduard Heimbuch
73c1609d92 Add flag to global config to enable/disable api keys as additional authentication method (#1606)
Add flag to global config to enable/disable API keys as additional authentication method.

Fixes #1599
2021-03-25 12:06:22 +01:00
Eduard Heimbuch
22a0362892 Feature/unicode groupname validation (#1600)
Allow all UTF-8 characters except URL identifiers as user and group names and for namespaces.

Fixes #1513

Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
2021-03-25 09:59:23 +01:00
Eduard Heimbuch
c5720b36b5 Collect metrics over lifetime of working copies (#1591)
Capture metrics about the lifetime of working copies used, for example, by the merge and modify commands. Working copies are internal repository clones that can place a large load on the server. Therefore, these metrics can be helpful in identifying sources of large server load.

Co-authored-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com>
2021-03-24 13:03:20 +01:00
Eduard Heimbuch
3ec499d22c Authentication metrics (#1595)
Expose metrics about:

- User login attempts
- Failed user logins
- User logouts
- General successful accesses to SCM-Manager via any authentication realm
- General failed accesses to SCM-Manager

Co-authored-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com>
2021-03-24 08:50:14 +01:00
Eduard Heimbuch
5a20eaea49 Collect cache metrics using guava cache statistics instead own counters. (#1590)
Collect guava cache statistics as metrics using micrometer. We replaced the own counter implementation of guava statistics with the guava internal caching statistics.
2021-03-22 08:56:26 +01:00