* Update plugins/hooks from branch 'stable-2.14'
to 1955d81e0ce4909a491a8340a2365fe9971eed81
- Add README
Add a README.md file in the repository root with the same content as
the "About" page.
Gitiles will render the README by default when the project is viewed
on the googlesource site [1] and this will make the configuration
documentation and list of supported hooks more easily accessible for
users who have not installed the plugin yet in their Gerrit site.
[1] https://gerrit.googlesource.com/plugins/hooks
Change-Id: Ib2ecf818cbabaca8bfddf58e12cce99842a4f038
- Reword introduction in configuration documentation
Change-Id: I428167c7929a077386e281f4898e8f4693c315f2
- Fix formatting in configuration documentation
Change-Id: I7414451eea210df7cc3e4d865de5cc1286c7a4ef
- Improve the "about" page
Add a link to the git hooks documentation which gives more context
about what is "not supported". Add links to the configuration and
list of supported hooks.
Change-Id: Ica629c70334951124bce439a4672fa28b40a2d61
* Update plugins/replication from branch 'stable-2.14'
to 43d055591174640527f5dec3fc7df00a4aa55f02
- Document how to exclude projects from replication
Change-Id: I8a12011e28be44d600a3ed63eebe596560d73e5f
* Update plugins/hooks from branch 'stable-2.14'
to 5df9a9dfdf4b4028393208d4412cc2c1a95fef39
- Add documentation to help with debugging hook problems
A common problem for users of the plugin is that they are not sure
if their hooks are actually being executed, and what their output
is.
Such information is logged by the plugin, but only at debug level.
Add a section in the documentation showing how to enable the logging.
Change-Id: I6e040f958ce4503f5cc0468ebe09466914d4a7eb
- Document behavior of plugin regarding configuration changes
Change-Id: I6509349994fce8405086982ee0d58bd38292ad29
* Update plugins/download-commands from branch 'stable-2.14'
- CloneWithCommitMsgHook: Stop passing --insecure to curl
Validating certs is an important feature of HTTPS that we should not
disable, especially when downloading code that is going to be trusted.
This "curl" invocation does not take place until after a successful
"git clone", so the -k option would not be useful for dealing with
misconfigured https servers. Any configuration that needs -k would
already be broken because of the "git clone" that comes before it.
Reported-by: Gert van Dijk <gertvdijk@gmail.com>
Bug: Issue 7562
Change-Id: Ibe14bba5c1ce30a771515ff7985796aa1b8cdadf
* Update plugins/hooks from branch 'stable-2.14'
- RefUpdate: Protect against null ObjectId in ReceiveCommand
RefUpdate's onRefOperation method is invoked by RefOperationValidators
for every registered RefOperationValidationListener.
If one of those listeners passes a RefReceivedEvent that contains an
instance of ReceiveCommand that was initialized with null old or
new ObjectId, this results in a NullPointerException when the ObjectId
is dereferenced to get the name.
Protect against such misbehaving validators by translating any null
instance to ObjectId.zeroId().
Change-Id: Ib9399c2351af20b23f8c4481c7b067f3a4dcb688
* Update plugins/replication from branch 'stable-2.14'
- Merge branch 'stable-2.13' into stable-2.14
* stable-2.13:
Fix minor nits in documentation of replication.maxRetries
Fix replication retries when maxRetries is set to 0
Set max retries to avoid queue congestion
Change-Id: Icf972f3df7d3d59925db670bc1f033028306d0c1
- Fix minor nits in documentation of replication.maxRetries
Change-Id: I80e46269e12b9e7a429634dd90ce52e90cc6ad79
- Fix replication retries when maxRetries is set to 0
maxRetries defaults to 0 which means retry indefinitely but it was not
retrying.
Change-Id: I6c8d8d6b1511d67b647f25193dcfe860687eea76
- Set max retries to avoid queue congestion
When servers have *a lot* of remote slaves, some of them
unstable and potentially offline, a maximum retry policy is
needed to prevent push events to stay in the replication queue
and getting rescheduled forever.
Keep backward-compatible configuration by setting maxRetry
by default to zero, which means disabled.
Change-Id: I060cc7bc3a4d1089b0815db02d2e1430f83a2015
* Update plugins/hooks from branch 'stable-2.14'
- HookArgs: Use IdentifiedUser.getNameEmail to format account name
In most of the hooks, the account is being formatted as either:
Name Surname (email@domain.com)
when the account has an email address, or:
Name Surname
when the account does not have an email address. If the account name
is empty the anonymous coward name is used.
Instead of implementing this logic in the hook, defer it to the
existing implementation in IdentifiedUser which properly formats
the name when there is an email address:
Name Surname <email@domain.com>
and also handles the cases where the account does not have an email
address but instead has a username, or falls back to the account Id.
The names used in the ref-update and commit-received hooks were already
formatted like this, so this change makes the rest of the hooks
consistent.
Change-Id: I99eeab1759dcedfdcc8c689ee6ac4599e3b58325
* Update plugins/replication from branch 'stable-2.14'
- Fix minor nits in documentation of replication.maxRetries
Change-Id: I80e46269e12b9e7a429634dd90ce52e90cc6ad79
* Update plugins/replication from branch 'stable-2.14'
- Use rescheduleDelay instead of replicationDelay when rescheduling
The replicationDelay was used for two purposes:
a) initial delay to schedule a replication
b) delay when rescheduling the replication due to an in-flight push
The replicationDelay could be set to zero, which make sense for the case a) but
doesn't make sense for the case b). Actually, when replicationDelay is set to
zero, the case b) will cause an excessive number of retries (over 1K/second) and
will also fire a replication failed event for each retry. The latter is yet
another issue and will be addressed in another change.
Introduce a new config parameter rescheduleDelay and use it for the
case b). Make sure it cannot bet set to a value lower than 3 seconds to
avoid the same issue.
In order to keep backwards compabitility with using the replicationDelay
as rescheduleDelay, a plugin init step is added. For each remote section
which doesn't already define rescheduleDelay, it will set rescheduleDelay
to the current value of the replicationDelay, unless replicationDelay is
set to zero. In the latter case it will assume the default value for
the rescheduleDelay.
Change-Id: Ia78f46460b531b04ee36ec2d5ab4228dba5c0c50
- Fix race condition when scheduling a replication
The state of PushOne object was modified after the operation was scheduled.
Depending on the delay parameter the PushOne.run() could be called before (when
the delay is zero or close to zero) or after (longer delay) the current thread
calls e.addState(ref, state). Thus, the thread executing PushOne.run() may or
may not see the update of its stateMap. Further, the stateMap is a
LinkedListMultimap which is not thread safe and the PushOne doesn't synchronize
access to it.
Change-Id: Ib26a5933a7993a6d2f0501e5daaf06a7892e597f
* Update plugins/hooks from branch 'stable-2.14'
- Fix hook configuration names to match documentation
Most hooks in the documentation are named with "Hook" suffix, but
in the code the "Hook" suffix was omitted. This prevented the hook
from being found when the administrator configured it with the
documented name.
Fix the values used, to match the documented values.
Also update the documentation to add the "Hook" suffix where it was
missing.
Bug: Issue 6508
Change-Id: Icdfdaaa2a4b89ed636e9165fc073234fb79abd2b
* Update plugins/replication from branch 'stable-2.14'
- Fix replication retries when maxRetries is set to 0
maxRetries defaults to 0 which means retry indefinitely but it was not
retrying.
Change-Id: I6c8d8d6b1511d67b647f25193dcfe860687eea76
The cookbook-plugin was made read-only with the intention of replacing
it with a new examples plugin.
Remove the submodule before any futher changes are made in core Gerrit
that will end up causing build problems due to interface changes.
Change-Id: Id8536dc9c3750eecd76bdf61e1d24af92333ce25
(cherry picked from commit ed4d5ecc7c926070652fdb7267576d1c54982a05)
* Update plugins/replication from branch 'master'
- Remove ops from pending when max retries reached
When a push operation is not retried anymore, remove it from
the pending queue as well and log the error on replication.log.
Failing to do so, it would result in the destination to refrain from
retrying again at then next Gerrit event.
Change-Id: I1f3dd4011e2822a2e0b52037fcb130e820af156f
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
* Update plugins/replication from branch 'master'
- Set max retries to avoid queue congestion
When servers have *a lot* of remote slaves, some of them
unstable and potentially offline, a maximum retry policy is
needed to prevent push events to stay in the replication queue
and getting rescheduled forever.
Keep backward-compatible configuration by setting maxRetry
by default to zero, which means disabled.
Change-Id: I060cc7bc3a4d1089b0815db02d2e1430f83a2015
* Update plugins/hooks from branch 'master'
- Rework ref-update hook to use RefOperationValidationListener
Instead of being invoked on every commit received, the ref-update hook
is now invoked before the ref update operation is finalized. Note that
the hook is no longer invoked on commits pushed for review or on changes
that are merged. It is invoked for creation/deletion of refs, and for
ref updates caused by direct pushes (i.e. bypassing review).
The previous behavior of the ref-update hook is moved into a new hook
named commit-received. A new parameter '--cmdref' is added, and the
special handling of 'refs/for' and 'refs/changes' is removed.
Also-By: David Pursehouse <dpursehouse@collab.net>
Bug: Issue 5739
Change-Id: I24d8580aef463f8bfb078d90a4e9e2ce6e8b9b93
Current implementation integrates only CORE_PLUGINS into
release.war however BUCK based build used to also include
CUSTOM_PLUGINS.
Change-Id: I779059ae705d1d0ea8d01857dd0567038dab79b8
Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
* changes:
Migrate external IDs to NoteDb (part 1)
gerrit-server: use hashed passwords for HTTP.
AccountByEmailCacheImpl: Consider emails from all external IDs on load
* submodules:
* Update plugins/cookbook-plugin from branch 'master'
- Merge "Remove for HTTP digest auth from examples."
- Remove for HTTP digest auth from examples.
Change-Id: I495ee8140cbe2ae12510a4d4cbc2c8360b135b33
* Update plugins/hooks from branch 'master'
- HookTask: Reduce amount of INFO logging emitted when running hooks
Reduce the log level of the hook's exit code and output to debug.
Change-Id: I80b6569696407296843eb4ae1d85e53301511d97
* Update plugins/commit-message-length-validator from branch 'master'
- Update default values to match 50/72 rule
The 50/72 rule was laid out by tpope in 2008 (see
www.tpope.net/node/106), and has gained wide acceptance
in the git community. It makes sense to enforce it by
default, since the values are configurable anyway.
Change-Id: I472ddbd2caf7cd1036f8ce2953380445bca8712a
* Update plugins/hooks from branch 'master'
- Refactor to pass injected instances through HookArgs
Instead of injecting the SitePath and GitRepositoryManager in all the
places they're used, inject them only in HookFactory and pass them
around through HookArgs.
Make objects package visible in HookArgs so that they can be accessed
directly rather than through getter methods.
Change-Id: I0cee06e4928748e7dba0315653def894d27244de
* submodules:
* Update plugins/reviewnotes from branch 'master'
- Assign unused Future return value to a variable
Error Prone plans to make this pattern into a compile error; this avoids
future breakage.
Change-Id: I6a023f22f472941854a6729f6450b9b70a020069
* submodules:
* Update plugins/hooks from branch 'master'
- Format all Java files with google-java-format
Change-Id: Ic726e55d416c3ceda674111b20fdc985c857c245
* Update plugins/reviewnotes from branch 'master'
- Format all Java files with google-java-format
Change-Id: I05b6a2e93015e8a5a5e93cf64ad15b710e86b5c9
* Update plugins/commit-message-length-validator from branch 'master'
- Format all Java files with google-java-format
Change-Id: Ibc2af6488f1b117ba3f94613309c8c69f1ed6dc1
* Update plugins/cookbook-plugin from branch 'master'
- Format all Java files with google-java-format
Change-Id: Id46240f027c75888265c1f878df52817cd50ec8a
* Update plugins/replication from branch 'master'
- Merge "Format all Java files with google-java-format"
- Format all Java files with google-java-format
Change-Id: I7884ab98ed1d2baa1776b2bb032ce338e8f88bc9
* Update plugins/singleusergroup from branch 'master'
- Format all Java files with google-java-format
Change-Id: I504a6177f9fded8bee1a8d6d3a7ab4f983d63853
* Update plugins/download-commands from branch 'master'
- Format all Java files with google-java-format
Change-Id: Iec0368bf90d394e0a98662e535ac082ad45f3bbb
* Update plugins/replication from branch 'master'
- Merge branch 'stable-2.13'
* stable-2.13:
ReplicationMetrics: Make members private final
Change-Id: Icf7dd3f5c9dd518c8984546aba9708525a428f79
- ReplicationMetrics: Make members private final
These members should only be accessed through the public methods:
- start(...), to create/start a new timer context
- record(...), to record the retry/delay values
Mark the members as private final to prevent unintended access.
Change-Id: I69a7e3b13ba4c344f3176528306163ebef07653c
When building a Gerrit plugin in-tree, allow to add extra dependencies
to the WORKSPACE file.
The only operation required will be the overwrite of the
plugins/external_plugin_deps.bzl file with the one provided by the
plugin.
Bug: Issue 5305
Change-Id: I07e4538f9f81ef923a4ca1aeceaee75d8429434e
* Update plugins/singleusergroup from branch 'master'
- Actually remove Buck based build
Accidentaly, the wrong file was removed. It was supposed to remove BUCK
and not BUILD.
This partially reverts commit 6800d41177013999c7259b387314d812cb51bcce.
Change-Id: Ia131c160a614b7d6dae242def0ace2203dde1230
Guava team recommends MultimapBuilder over specific Multimap
implementations, so callers don't have to know the specific key/value
behaviors of the individual implementations. The static factory
methods in the implementations will be removed in a later version.
LinkedListMultimap and LinkedHashMultimap are not affected, since
MultimapBuilder lacks support for specifying linked entries, and thus
the factory methods are not in immediate danger of deletion.
Change-Id: I7744db687da84a7beae31d1cb8953e782ed23c1d
Guava team recommends using the subinterfaces of Multimap, for the
same reasons they recommend using Set and List rather than Collection:
it documents expectations about ordering, uniqueness, and behavior of
equals. Do this across the board in Gerrit.
Mostly this is straightforward and I tried to exactly match existing
behavior where possible. However, there were a few wrinkles, where
different callers passed different subtypes to the same method.
The main one is arguments to ParameterParser#parse and
splitQueryString, where some callers used SetMultimaps (perhaps
semi-intentionally, or perhaps misunderstanding the nature of
HashMultimap). For the purposes of parameter parsing, a ListMultimap
makes more sense, because it preserves argument order and repetition.
Another instance is a couple places in ReceiveCommits and downstream
where there were SetMultimap<?, Ref>. Since Refs do not implement
equals, this is effectively the same thing as a ListMultimap, and
changing the interface no longer misleads readers into thinking there
might be some deduplication happening.
Finally, this change includes a breaking API change to the return
type of ExternalIncludedIn#getIncludedIn.
Change-Id: I5f1d15e27a32e534a6aaefe204e7a31815f4c8d7
The account data is moved from ReviewDb into git.
Change-Id: I643827179b24601b138f394cfff5890f919b9da9
Signed-off-by: Edwin Kempin <ekempin@google.com>
* changes:
Only generate SSH test keys if we run SSH tests
Add @UseSsh Annotation and GERRIT_USE_SSH flag
* submodules:
* Update plugins/cookbook-plugin from branch 'master'
- Add @UseSsh to CookbookIT
Change-Id: I5245a09a0dd3593db6d80fab260369044692cd7a
* Update plugins/cookbook-plugin from branch 'master'
- Bazel: Increase time limit for tests to 300 seconds
20 seconds (small size) doesn't seem to be enough on the CI: [1].
[1] https://gerrit-ci.gerritforge.com/job/Gerrit-verifier/1526/consoleText
Change-Id: I41dd945f425510c49603dafb3c2835a5ad9453d7
* Update plugins/cookbook-plugin from branch 'master'
- Merge branch 'stable-2.13'
* stable-2.13:
HelloWebLink: Make the dummy image more visible
Change-Id: I5291aabcf3c57f76fe17c65a770c09fe80022412
- HelloWebLink: Make the dummy image more visible
Change-Id: If2b80d5fd2f719ebd1db4c9b15f5c8e50f5cda3f
Short circuit the plugin loading phase from the unit tests by passing
the module names from the manifest file.
This allows us to avoid building and deploying the plugin JAR from
within build tool chain.
To use the simplified plugin bootstrap tests, plugin test class must
be inherited from the LightweightPluginDaemonTest class and must be
annotated with @TestPlugin annotation:
@TestPlugin(
name = "cookbook",
sysModule = "com.googlesource.gerrit.plugins.cookbook.Module",
httpModule = "com.googlesource.gerrit.plugins.cookbook.HttpModule",
sshModule = "com.googlesource.gerrit.plugins.cookbook.SshModule"
)
public class CookbookIT extends LightweightPluginDaemonTest {
@Test
public void revisionTest() throws Exception {
createChange();
RestResponse response =
adminRestSession.post("/changes/1/revisions/1/cookbook~hello-revision");
assertThat(response.getEntityContent())
.contains("Hello admin from change 1, patch set 1!");
}
}
Inspired-By: Dave Borowitz <dborowitz@google.com>
Change-Id: I689bb71413ecfbbf99f72730b0d2617bf526d9dd
* submodules:
* Update plugins/replication from branch 'master'
- Remove test prefix from test methods in replication plugin
We previously used 'test' to prefix tests but have decided to stop this.
This change removes the prefix from all test code.
Change-Id: I42e6191ece7872f4647e425e3ca0acf8c6452412
Reformat the Bazel build files with the buildifier tool [1].
The style is different for Bazel files. Most notably, indentation level
is 4 spaces instead of 2, and " is used instead of '.
[1] https://github.com/bazelbuild/buildifier
Change-Id: I95c0c6f11b6d76572797853b4ebb5cee5ebd3c98
* Update plugins/replication from branch 'master'
- Add ReplicationScheduledEvent to indicate ref replication is scheduled.
Assure that event is posted only once each time a ref is scheduled.
Covers the corner case when the ref is added to already scheduled push.
Change-Id: I175940f8d4c6b9164c41bbec8c52d221ec30001b
Signed-off-by: Eryk Szymanski <eryksz@gmail.com>
* Update plugins/cookbook-plugin from branch 'master'
- Bazel: Run plugin tests non-hermetically
The plugin tests required the plugin to be built and installed to the
test site (controlled by the test), so that this implementation is by
design non hermeticized so we can't run in the sandbox.
Change-Id: I39b981aaa4c6063f34e97db59a34b6a0f238e28b
* Update plugins/cookbook-plugin from branch 'master'
- Implement bazel build
Tests are still failing as acceptance test framework wasn't migrated
to Bazel yet.
Change-Id: I4f48925df31a9a79da631b0a9ccd2b724a674270
* Update plugins/download-commands from branch 'master'
- Merge branch 'stable-2.13'
* stable-2.13:
CloneWithCommitMsgHook: Fix HTTP clone command inconsistency
Change-Id: I97fafb4e6972d5f11e3dddfd69ad0711d0c0bf7f
- Merge branch 'stable-2.12' into stable-2.13
* stable-2.12:
CloneWithCommitMsgHook: Fix HTTP clone command inconsistency
Change-Id: I8a86b8cc56834933391afd56fc93d4ece67a4401
- CloneWithCommitMsgHook: Fix HTTP clone command inconsistency
When cloning a project using HTTP schema, the "/a" in the URL was added
only when choosing to clone without the commit hook. Now the URL is the
same in both cases.
Change-Id: I8fc0667f17cea592bd702a0441cba7ca3f762968
(cherry picked from commit d632d6471b42a47877664a5266ba509026538a32)
TEST PLAN:
$ bazel build release
Install bazel-bin/release.war and verify that the versions of the
core plugins are reported correctly:
commit-message-length-validator: v2.13.1-2-g76b911
download-commands: v2.13.2-5-gd632d64
hooks: v2.13.2-7-gf27c7e7
replication: v2.13.2-17-g531ed1
reviewnotes: v2.13.1-7-g45f6975
Change-Id: Iaceeeb1daafd7455c8d8a3673682d1ab9e65d8ef
* Update plugins/download-commands from branch 'master'
- CloneWithCommitMsgHook: Fix HTTP clone command inconsistency
When cloning a project using HTTP schema, the "/a" in the URL was added
only when choosing to clone without the commit hook. Now the URL is the
same in both cases.
Change-Id: I8fc0667f17cea592bd702a0441cba7ca3f762968