163 Commits

Author SHA1 Message Date
Saša Živkov
37da5858bb Set the version to 2.10-SNAPSHOT
Change-Id: I46d413a0e61b5356eb5702ee230785b8b1471ff1
2014-09-04 13:34:38 +02:00
Hugo Arès
0cbe223e40 Allow debug and trace log statements to be printed in log files
System logs file appenders were created with an info threshold which
was preventing debug and trace log statement to be printed in the
files. File appenders should not have a threshold. Instead, the root
logger should have a proper level (i.e. info) so if a specific logger is
using a finer grain level (e.g. debug, trace), the log statements won't
be filtered out by the appender.

Set the root category to info and no longer set the file appender
threshold when creating system logs.

Change-Id: I747bef1f5dcb99784ba91dba6d29cf1fba582b62
2014-08-20 08:18:30 -04:00
Saša Živkov
a20a9fbfc8 Update version to 2.10-rc0
Change-Id: Icf14daa3d9ba14e57b6c487140617191a895e203
2014-07-21 14:44:00 +02:00
Edwin Kempin
4ad8307a10 Move bindings for cache related REST endpoints into own module
This allows Shawn to skip this module in his build so that
administrator users on his servers cannot invoke them.

Change-Id: I9c852d3f22b820f24f3fcab8481feb1a63f2778c
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-07-01 10:44:34 +02:00
Edwin Kempin
bfcbb2960c Merge "Allow to schedule a task to run gc for all projects" 2014-06-20 04:31:55 +00:00
Matthias Sohn
0fb2c999c3 Allow to schedule a task to run gc for all projects
The (global) schedule can be configured in "gerrit.config" by specifying
startTime and interval. The "startTime" can be specified in section "gc"
in the following format:
startTime = <hours>:<minutes>
or
startTime = <day of week> <hours>:<minutes>
The "interval" can be given using the usual time unit suffixes.

Change-Id: I16e92c353d0fa05c020fc18da4ed1f5825ad677c
2014-06-23 13:52:59 +02:00
David Ostrovsky
d8af092c0a Buck: Remove usage of genfile()
genfile() is considered to be deprecated and is going to be discontinued
in future Buck releases [1].

[1] https://groups.google.com/forum/#!topic/buck-build/Ci8Y95USD8I

Change-Id: I7a5a1ee99d1448c412bb51b793c1e874dd3c62f4
2014-06-10 07:14:18 +00:00
Edwin Kempin
0b54dcfe55 Update version to 2.10-SNAPSHOT in pom.xml files
Change-Id: I3209f16fbebd65ab476b4a4644823f0580e5785f
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2014-06-04 13:09:27 +00:00
David Pursehouse
be108a3530 Merge branch 'stable-2.9'
* stable-2.9:
  Bash: Deploy plugin archetypes to Maven Central
  Fix documentation of how to publish artifacts to Maven Central
  Buck: Deploy plugin artifacts to Maven Central

Conflicts:
	.gitignore

Change-Id: I72aca7e13b55fbbe34bbf00d799a8a05dc96a955
2014-05-27 09:58:38 +09:00
David Ostrovsky
520f29c16a Buck: Deploy plugin artifacts to Maven Central
Switch deploying Gerrit extension and plugin API from Google storage
bucket to Maven Central.

To simplify the troubleshooting new trace option was added to
underlying python script. When environment variable VERBOSE=1
is set, then the mvn command is printed to stderr:

  VERBOSE=1 buck build api_deploy_oss
Change-Id: I9ebe44ec8aca91aa6b5514f561209e7c50377927
2014-05-26 22:06:42 +02:00
Shawn Pearce
334997292c Update Buck
java_library() now accepts provided_deps argument which replaces
our custom use of java_library2().

This change replaces compile_deps with provided_deps parameter in
gerrit_{plugin,extension} rules. Plugins that are using it must be
updated.

Change-Id: I16d53793da567c958267f91ca203e9cae6c4d02f
2014-05-04 12:54:17 +02:00
Ahaan Ugale
3e107f55d7 Allow plugins to replace the WebSession implementation
Plugins can replace the existing implementation with the statement:
DynamicItem.bind(binder(), WebSession.class).to(...);
in a module designated as a "<Gerrit-HttpModule>" in the manifest.

Just the Cache implementation used for web sessions can be changed
by binding to a subclass of the now abstract CacheBasedWebSession
which supplies the Cache in the superclass constructor.

This is a step towards solving web session issues with multi-master.

Change-Id: I255661a62cfcbfe07646cb90005764061d618f3d
2014-05-01 16:06:14 -06:00
David Ostrovsky
e73ae61339 Apply "type inference for generic instance creation" Java 7 feature
Change-Id: Ia14802c903ca67b9d94dc6038d70b0e9644bc621
2014-04-26 15:27:57 +02:00
David Ostrovsky
3f3e9ad20c Remove unnecessary reference to $SRCDIR in Buck genrules
In new buck version `$SRCDIR` is not necessary any more.  Buck now
always runs genrule relative to the $SRCDIR link forest.

Change-Id: Iee88bb575c7baa62bc087527927be5347a7f8f95
2014-03-26 18:20:13 -07:00
Edwin Kempin
f63789bf6f Merge "Control which plugins will be auto installed on auto init" 2014-02-24 10:28:57 +00:00
Edwin Kempin
1edb6604dd Merge "Install all packaged plugins automatically on auto site init" 2014-02-24 10:28:35 +00:00
Saša Živkov
9f058b37bc Control which plugins will be auto installed on auto init
Use the system property 'gerrit.install_plugins' to control which
of the packaged plugins will be installed during auto site init
in a servlet container.

When 'gerrit.install_plugins' property is not defined then all packaged
plugins will be installed. If it is present then it is parsed as a
comma separated list of plugin names to install. Defining an empty
string as the property value means that no plugin will be installed.

Change-Id: I52881c9677bc9cc1e51c46c2c2ce4558c79b9a3e
2014-02-24 11:11:04 +01:00
Edwin Kempin
65d06e4f34 Merge "Fix init from WebAppInitializer when using -Dgerrit.site_path" 2014-02-21 12:26:09 +00:00
Saša Živkov
e2a1e7ef34 Install all packaged plugins automatically on auto site init
When Gerrit is deployed in a servlet container and the system property
'gerrit.init' is defined then, besides the automatic site
initialization, also all packaged plugins (under WEB-INF/plugins) will
be installed.

Change-Id: Ia1e50d88ba63e96fc70717f854c87c7409f0c618
2014-02-21 13:24:09 +01:00
Saša Živkov
e90d6e81d3 Fix init from WebAppInitializer when using -Dgerrit.site_path
This fix is mostly useful for those developers who want to deploy/test
Gerrit in Tomcat, use the embedded H2 database and have automatic init
on deployment.

The init of a new site on startup (from WebAppInitializer) was failing
when the site was provided via the -Dgerrit.site_path property because
we assumed that the database initialization has to be skipped always
when running in a servlet container. However, this is only true for
the case when using the -Dgerrit.init_path. When Gerrit site is provided
via -Dgerrit.site_path then we have to perform database initialization.

Change-Id: Id577f391cd888bd71ec8502e8ad2f621cbc3fd80
2014-02-21 13:24:03 +01:00
Bruce Zu
ae479c7fda Refactor the way of binding ssh commands
If a command should only be used on a server in master mode, but not
slave mode, it should be bound in both MasterCommandModule and
SlaveCommandModule, we have to remember to add it separately on each
of the commands list, the maintenance work is tedious.

Refactor the way of binding ssh commands. Add a field 'runsWith' to
CommandMetaData to mark a given ssh command to run on MASTER mode or
MASTER_OR_SLAVE mode. Remove SlaveCommandModule and MasterCommandModule,
and use only DefaultCommandModule.

This reverts commit 84bcead690240e07e0314b165fb8d6dc95d2c5e7.

Change-Id: Ia4908267b135be04ff9c8a9470a243a6c8d665a8
2014-02-04 16:01:55 +09:00
David Ostrovsky
e01d9b7f20 Bump Jetty version to stable 9.1 and Servlet API to 3.1
Change-Id: Ic6a374afa978e66ec1a04a2b39801da158ba31d7
2014-01-04 22:28:10 +01:00
Saša Živkov
6d35cba22c Fix WebAppInitializer when sshd.listenAddress=off and host key doesn't exist
This is the same fix as 91205ae8761fddeb7d0a854c572064cef6476bd4 but for
the WebAppInitializer.

Change-Id: Ib9af4a91ea52ee6e894c6cc857a0aaaff642e9b1
2013-12-06 14:11:40 +01:00
Shawn Pearce
d4ae3a16d5 Delete SQL index support
Require the secondary index to be enabled in Gerrit 2.9.  Unless
configured differently, Lucene is used for the secondary index.

Change-Id: I3d2d804170835d69ffbfef586ddc3873ea3cd1c8
2013-11-29 11:35:39 -08:00
Shawn Pearce
72fb6cc514 Remove unused .gitignore
These were necessary only for the Maven based build.

Change-Id: Ie26669e6ccae60a52d2db1b8ad362e2fa88a26f2
2013-11-28 22:56:51 -08:00
David Ostrovsky
c53fd3ae49 Delete eclipse left-over files from the Maven poop era
Change-Id: Ie3a75e8c6a2d274cd39e362259ab20cff474eb8d
2013-11-28 22:55:09 -08:00
Edwin Kempin
f8be8fdca6 Keep mergeability flag always up to date
The mergeability flag of a change is immediately updated when the
change is created or when a new patch set is uploaded.

When a branch is updated the mergeability flag is asynchronously
updated for all open changes that are destined for that branch.

This way the mergeability flag is always up to date.  With this the
(new) change screen doesn't need to explicitly trigger the update of
this flag whenever the screen is loaded.  The corresponding call is
removed.

In a follow-up change we can now display the mergeability flag also in
the change tables and user dashboards which wouldn't make sense if the
displayed information is outdated.

It is important to update the mergeability flag on a branch update in
the background since the computation and even the check whether the
mergeability flag needs to be recomputed is expensive.

Change-Id: Id20e567e5c5d5b3d851ca5cda9bde01ac01c9967
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-11-23 23:28:50 -08:00
alex.ryazantsev
cc2bccfdfd Remove unnecessary 'return' statements
Change-Id: Ie517a85ad5d0d53479b8f726b932048acce4f889
2013-11-18 02:23:53 +00:00
Dave Borowitz
ec6fca88a5 Make LifecycleModule inherit from FactoryModule
Cut down on a bunch of one-offs of install(new *Module() {...}) by
choosing a more appropriate base module class. This doesn't solve all
such cases, for example RpcServletModule must still inherit from
ServletModule, but it does clean up some code. (And who knows, fewer
modules may even mean faster startup time.)

Change-Id: Ie1aed05d0a64f7f11b121c9a637bb30d80e9a595
2013-11-13 16:14:00 +00:00
Shawn Pearce
84646adb82 Merge branch 'stable-2.7' into stable-2.8
* stable-2.7:
  Bump SSHD version to 0.9.0.201311081

Conflicts:
	gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ShowConnections.java
	pom.xml

Change-Id: I29487ae1efb5bdf6f18fc76fe14790a530481c9f
2013-11-08 21:16:47 -08:00
Shawn Pearce
e4893eb0ff Merge branch 'stable-2.6' into stable-2.7
* stable-2.6:
  Bump SSHD version to 0.9.0.201311081

Conflicts:
	gerrit-sshd/src/main/java/com/google/gerrit/sshd/DatabasePubKeyAuth.java
	gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshDaemon.java

Change-Id: Iacee71305c167687c8f70836bff802b1dfec2082
2013-11-08 20:56:49 -08:00
David Ostrovsky
e5b7f1aa5c Bump SSHD version to 0.9.0.201311081
With new Mina project release two backends are supported Mina & NIO2. Expose
new NIO2 backend through new configuration option while preserving the Mina
backend to be default.

Remove the fake to turn off closing idle connections by using the highest
timeout allowed by Apache SSD (~24 days).  That special treatment is not
needed any more.

Restrict `sshd.tcpKeepAlive` configuration option to be used only for Mina
backend.

Remove `sshd.reuseAddress` (it is per default true) as there is no obvious
way how to set it.

SSHD 0.9.0 incorrectly sends "Authenticated with..." message:

  davido@wizball:>ssh gerrit cookbook say-hello Dude
  Authenticated with partial success.
  Hello Dude!

That bug is tracked under [1].  With that patch applied the problem with
"Authenticated with partial success." is solved. Gerrit's Maven repository
contains 0.9.0.201311081 which is 0.9.0 with [2] cherry-picked on top.

[1] https://issues.apache.org/jira/browse/SSHD-254
[2] https://github.com/apache/mina-sshd/pull/2

Bug: issue 2003
Change-Id: Ic352d7e6a9e6f8ab4122b2667ead24ac3d73f68a
2013-11-09 05:45:19 +01:00
Shawn Pearce
35e97c2aeb Run most acceptance tests in-memory
This allows the tests to run faster, with lower system overheads.
The new @UseLocalDisk annotation must be added to any test method
that wants the classical init and daemon testing strategy.

A new sshd.requestLog configuration variable is introduced to
permit tests to disable the SSH command log.

Timing for `buck test --all` on my Linux desktop:

  before 3m37.129s
  after  2m18.789s

Change-Id: I18c07ef2d913f6abbb3925b3e7d3df5d28668497
(cherry picked from commit 318bfcae5cdf457893083e08aa550ab3d4335393)
2013-11-05 14:41:03 -08:00
alex.ryazantsev
e399d81f2d Fixing jdbc code: correct Statement closing
Change-Id: Iebba6cc02c311b4649d93ddc4a1f224efa643ba4
2013-11-03 14:35:55 +04:00
Dave Borowitz
01cea13727 Set version to 2.7
Change-Id: I49a7fc97fd6d4f199c25774faa50ec4a826ae64a
2013-09-18 13:05:11 -07:00
Sasa Zivkov
e5fc90eb67 Optionally, initialize site from WebAppInitializer.
This supports automatic site initialization on Gerrit server startup
when Gerrit runs in a servlet container. Both creation of a new site
and upgrade of an existing site are supported.

This feature may be useful for such setups where Gerrit admins don't
have direct access to the database and the file system of the server
where Gerrit should be deployed and, therefore, cannot perform the
init from their local machine prior to deploying Gerrit on such a
server. It may also make deployment and testing in a local servlet
container faster to setup as the init step could be skipped.

The site initialization will be performed only if the 'gerrit.init'
system property exists (the value of the property is not, used only the
existence of the property matters).

If the 'gerrit.site_path' system property is defined then the init is
run for that site. The database connectivity, in that case, is defined
in the etc/gerrit.config.

If 'gerrit.site_path' is not defined then Gerrit will try to find an
existing site by looking into the system_config table in the database
defined via the 'jdbc/ReviewDb' JNDI property. If system_config table
exists then the site_path from that table is used for initialization.
Database connectivity is defined by the jdbc/ReviewDb JNDI property.

Finally, if neither 'gerrit.site_path' property nor the system_config
table exists, the 'gerrit.init_path' system property, if defined, will
be used to determine the site path. Database connectivity, also for this
case,is defined by the jdbc/ReviewDb JNDI property.

Example 1:
  Prepare Tomcat so that a site is initialized at a given path using
  the H2 database (if the site doesn't exist yet) or using whatever
  database is defined in the etc/gerrit.config of that site:

  $ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.site_path=/path/to/site'
  $ catalina.sh start

Example 2:
  Prepare Tomcat so that an existing site with the path defined in the
  system_config table is initialized (upgraded) on Gerrit startup. The
  assumption is that the jdbc/ReviewDb JNDI property is defined in
  Tomcat:

  $ export CATALINA_OPTS='-Dgerrit.init'
  $ catalina.sh start

Example 3:
  Assuming the database schema doesn't exist in the database defined
  via the jdbc/ReviewDb JNDI property, initialize a new site using that
  database and a given path:

  $ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.init_path=/path/to/site'
  $ catalina.sh start

Change-Id: Ic3e8c993087d2fbb38e14479a539dc62495ad908
2013-09-18 12:52:17 -07:00
Dave Borowitz
0690b1ea06 Split out REST parts of PluginModule into PluginRestApiModule
Command-line programs that don't start a Gerrit daemon may want to
load plugins using this module, but don't need the additional
dependencies brought in by being a RestApiModule.

Change-Id: I4524ba7e04112101cd3a890e171658ad037ef1ee
2013-09-10 15:36:30 -07:00
Yuxuan 'fishy' Wang
e6cbae9ef6 Remove asciidoc.conf
Asciidoctor doesn't support the conf file, so we remove it, do the macro
replacing ourselves, and put all the attributes into the command line
parameters.

Change-Id: I21b49e5a2d75ff0f9b52f26fccaae42fcbaa0837
2013-09-04 21:31:03 -07:00
Shawn Pearce
dc24a4102c Merge branch 'stable-2.7'
* stable-2.7:
  Fix Gerrit plugins under Tomcat by avoiding Guice static filter
2013-08-12 11:57:28 -07:00
Shawn Pearce
c4a0f0c8f0 Merge branch 'stable-2.6' into stable-2.7
* stable-2.6:
  Fix Gerrit plugins under Tomcat by avoiding Guice static filter
2013-08-12 11:57:16 -07:00
Shawn Pearce
09a35b9725 Fix Gerrit plugins under Tomcat by avoiding Guice static filter
The static GuiceFilter breaks when a plugin loads and configures
its own web environment. Follow the pattern used by JettyServer
to initialize and load GuiceFilter in a non-static way, allowing
Gerrit to always have its own filter stack during any request.

Bug: issue 1966
Change-Id: I864f3badc4ec90154a276d35e6a5a3fa75058933
2013-08-12 18:53:43 +00:00
Shawn Pearce
980b51f64e Fix path used in generated prolog class names
Force relative paths by passing the Prolog compiler only a relative
name from within $SRCDIR.  This avoids picking up the user's $HOME
path as part of the generated class file names, and prevents build
failures on filesystems where individual path components are limited
to 256 bytes.

Change-Id: I43f2a93daf857413401f4e1aeb24b9b2a8c741fe
2013-08-06 17:32:43 -07:00
Shawn Pearce
a750617d39 Define AccountDirectory as an abstract backend for user data
Eventually this will fully support all account information, similar
to GroupBackend. For now lets start by defining a simple base class
that can supply name, email and avatar URLs to an AccountInfo for
the REST API. Bind this in the Daemon and web application code so
its at least partially pluggable at the static Guice injector level.

Change-Id: I6e1b55fd46f3e99a982f7bd523f3e9d91b637b0d
2013-08-01 19:00:50 +00:00
Shawn Pearce
1e6c3639f7 Move version.jar to gerrit-war
This saves about 70ms when running targets like
//gerrit-gwtui:ui_chrome that reference a JAR in
gerrit-common but do not need the Version file.

Change-Id: Iab7377f3c5e1ce82cc3dc3ddcb3b1e4f9f12a8b7
2013-07-29 13:54:38 -07:00
Shawn Pearce
11d27c8ee8 Update Buck
Latest version of buck is faster than the prior version used by
Gerrit.  No-op updates when loading a debug version of the UI now take
only 1.804s on my laptop (previously 7s) and a draft UI compile is
only 24.659s (previously 39s).

The slow acceptance tests must now be excluded with `--exclude slow`.
Buck changed the meaning of the -e option to be --emulator, which is
unfortunately useful only for Android application developers.

genrule() now needs to use $(exe) to reference the binary to run,
offers $(location) to make it easier to find files in the build tree.

The empty srcs array is no longer required for genrule().  Buck has
determined it is sufficiently powerful with $(location) and deps that
requiring srcs is unnecessary.

Supporting .src.zip files in the srcs array of java_library() means
Gerrit no longer needs to run a separate genrule() to extract files
produced by ANTLR, or call javac inside of the BuckPrologCompiler
support glue.

Change-Id: Ib03042921a081b867a7aad0423bd45523e42917a
2013-07-26 18:11:51 -07:00
Ahaan Ugale
404c8246bc Add secondary index implementation using SolrCloud
SolrCloud can be used instead of Lucene by adding "type = SOLR"
under [index] and "url = <zookeeper-url>" under [index "solr"]
in gerrit.config.

Change-Id: I0ff8579c5e23c58b16f3605bc20eba4e80fb40fc
2013-06-27 13:52:39 -07:00
Shawn Pearce
f252f5348e Gerrit 2.6
Change-Id: I7b6704181bae0953d7de021611ff8e8a0165b93f
2013-06-21 09:51:01 -07:00
Dave Borowitz
c64399fe93 Control threadpool behavior for indexing
For the Reindex command, use a new threadpool defaulting to the number
of available processors, under the assumption that the bulk of
indexing time is in CPU-intensive work like tree diffing. Modify
ChangeIndexer to return ListenableFutures so we can bound the size of
the work queue.

For the server, default to using the default work queue, but make this
configurable as index.threads to use a dedicated threadpool, with
non-positive values indicating the default.

Because we now have more non-Lucene-specific Guice logic, split that
out into its own module.

Change-Id: I55181e556a2d43b81c9032f53b74b690342ab62b
2013-05-31 15:08:44 -07:00
Dave Borowitz
9161eda6d5 Index modified filenames with Lucene
Add a ChangeIndex interface and an implementation based on Apache
Lucene[1] to provide a secondary index, indexing things we won't or
can't index in the database.

As an example, index the list of modified files in the most recent
patch set of each change. Provide an EqualsFilePredicate for searching
on exact filenames[2], and teach the query builder to rewrite such
predicates as ChangeDataSources returning results from the index.

As this feature is still experimental but we want to avoid prolonged
feature branch development, protect it with an undocumented
index.enabled boolean in gerrit.config.

[1] http://lucene.apache.org/core/

[2] Uses the "file:" operator the same as RegexFilePredicate, but does
    not support regular expressions in the search context.

Change-Id: Ie14ebe062d991eb9626f7b5d78b2d193c1bcb33f
2013-05-29 15:06:15 -07:00
David Ostrovsky
dcee57212f Delete Maven based build
The Maven build does not work since the introduction of CodeMirror.
Remove the build until to prevent people from trying to use a broken
build process.  If buck is rejected this commit will be reverted, and
we will attempt to fix the Maven build to include CodeMirror.  If buck
is accepted, we just saved time by avoiding a messy Maven change.

Change-Id: I147d8d1741d52f59de1d2ddce8e5e82583990c14
2013-05-21 20:28:56 -07:00