A XSRF token is normally set when a user requests one of the
polygerrit index paths (one of which is '/'). The GWT UI
handles setting the cookie on /, so that case wan skipped.
If a user visits /login/ they will be redirected to / after
logging in, which, if PolyGerrit is used, would cause the XSRF
cookie not to be set, which would cause subsequent POST or PUT
operations to fail.
The default sign-in link is to the current page, so typically a
user would end up redirected to /q/status:open and would therefore
end up with a cookie. However, if the user directly visited
/login (or a site enforced authentication by redirecting there),
they would observe the problem.
To correct this, set the cookie on / if the GWT UI is disabled.
Bug: Issue 10281
Change-Id: I79ad22395ca9d83d0a6fb0785929943d7ae0c186
Co-Authored-By: Michael Burns <mbx@google.com>
* stable-2.15:
AccountIT: Test that account is not created with invalid email
CreateAccount: Fail early when invalid SSH key is given
Use base url for commentlink
Change-Id: Ifac43208ba54ffcc012e1ff9374272466555bfbc
If an invalid SSH key was given, the request would fail only after
the account was already created.
Move the addition of the SSH keys to earlier in the process, so that
if it is invalid the request fails before the account is created.
Bug: Issue 11363
Change-Id: I474f2d7125c13057c57236142c841515cc22c3ea
* Update plugins/replication from branch 'stable-2.16'
to 896e67184e9b98262775ab1c71a0b76ac5baff21
- ReplicationIT: Don't swallow exceptions on failed repository operations
The methods getRepo and getRef catch exceptions and return null, which
will then cause NullPointerException on subsequent dereference, making
it less easy to track down the actual cause.
Remove the getRepo method and always open the repo in a try-with-resource
that will throw the exception and fail the test if the repository could
not be opened.
Some calls to getRef are done in a consumer which means the method can't
throw an exception. In these cases, it's OK for the method to return
null because then the test will fail anyway due to InterruptedException
being raised when the non-null was not returned within the timeout.
Other callers of getRef however should not get the null value as it will
cause NPE.
Make getRef throw the exception, thus failing the test early, and add a
variant method "checkedGetRef" which returns null and is used in the
consumer.
Also replace usage of printStackTrace with FluentLogger.
Change-Id: I0f0caca03386c4fa5710f4c8e8fd4f798acead2b
- ReplicationIT: Add explicit test for replication of new branch
Change-Id: I67aa8b4aec05ad23b3c286d56a3b894eede7cd7e
- ReplicationIT: Change test method name to reflect actual operation
The test shouldReplicateNewBranch creates a new change and then
verifies that the corresponding refs/changes/xx/yy/zzzzzz ref is
replicated to the destination.
Rename it to shouldReplicateNewChangeRef to match what it's actually
doing.
Change-Id: I32fe7237c8857907dd51d627a571f6ccb73741a3
- Allow AdminApiFactory to be replaced dynamically
Since change Ie760bf3e1 the GerritSshApi class is no longer a singleton,
and is instead instantiated on demand by a new AdminApiFactory.
This breaks implementations that consume the replication plugin as a
library and extend the GerritSshApi, since the extended class no longer
gets instantiated in place of GerritSshApi.
Refactor it so that AdminApiFactory is an interface with a default
implementation that gets bound as a dynamic item, which can be replaced
by derived implementations.
Change-Id: Ia150d6802e11015fa00ee9144b3dfbfa696c7a0d
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
In JGit 5.1.10.201908230655-r additional debug logs were added in
the FileSnapshot class, and these cause a lot of unwanted messages
when running tests.
Set the log level to WARN for this class.
Change-Id: Ie8dba4fd17e59ae5d49730f36f1b5f06f83b17d1
Since [1], which is included in JGit since 5.1.10.201908230655-r, the
method DirCacheEntry#setLastModified(long) is deprecated in favor of
DirCacheEntry#setLastModified(Instant).
Replace the only usage of the deprecated call with the new one.
[1] https://git.eclipse.org/r/#/c/145437/
Change-Id: I7c87b20d518ad68652d2f91317d6a4505df21fe4
* Update plugins/replication from branch 'stable-2.16'
to 86b3ac835c651cbaff0c0dd9b2540ceee4c32a78
- Fix test build rule to include *IT tests
The glob in the build rule only includes *Test.java files, thus the
recently added ReplicationIT was not being executed.
Update the rule to include *IT.java files.
Change-Id: I04a76723feb6e38dd441b41e9de22e5fdf1c4578
ProjectState is only invalidated if the underlying config changes, but
not when any of its parent's config changes. Therefore it must not
store any data locally that it derived from any parent.
Bug: Issue 11248
Change-Id: I3f8d74e829274701c54d5898f6348971a59f866f
Update is from commit 52925a627f20cbc28bc4eaeffd1824244e6e895d
Includes a fix for Issue 11350.
Adds support for custom css properties.
Adds support for html`` syntax in js.
And some more fixes.
Bug: Issue 11350
Change-Id: I7e5d82697cc5bf506ed2864611fed866d0ff1007
* Update plugins/replication from branch 'stable-2.16'
to 4ed1a3eaa052672422f5f19468736de42e4d4d27
- ReplicationIT: Do not use deprecated getRef()
Change-Id: Idf56bcb4d9e7ed514d1011f62d6738d124ba870a
* Update plugins/replication from branch 'stable-2.16'
to d5170016dbb9db03f686c2a6f4994295b685aeb8
- First ReplicationIT test for new project and change
Test end-to-end that a new project and a new change are propagated
to the replicated repository.
Change-Id: Iea4170aa881757c7e29bc6237fe4c230da8ae0ec
* Update plugins/replication from branch 'stable-2.16'
to 24ae8627fef3aef243e8e22c30901617f724ad4c
- Revert "Delete event file only after replication completed for all destinations"
This reverts commit d557ccc642c59a55750f560ce0d98870e1550d65.
Reason for revert: This fix did not solve the problem, see associated issue.
Bug: Issue 11172
Change-Id: Ifc2e7209bd86163e945f0595ff0ebd681932053f
* stable-2.15:
Upgrade elasticsearch-rest-client to 7.3.1
Add .gitreview file
Update the newly added .gitreview file to point to stable-2.16.
Change-Id: I9ca52ec3d90dea1b44321be4eb648448abafff1e
For folks used to using the git-review tool for interacting with
gerrit servers, it's necessary to have a .gitreview file in the
repo in question pointing to where the gerrit is.
Add one, pointing at gerrit-review.googlesource.com and listing that
https should be used. This will still require that someone add their
http authentication to the .gitcookies file, but otherwise should
work as expected.
Set defaultbranch to stable-2.15 so that patches will be submitted
to refs/for/stable-2.15.
Bug: Issue 9450
Change-Id: Iace9ed4f94441d2fd5cbb1f95eb69f135981836f
Improvements in 5.1.9 and 5.1.10:
- measure FileStoreAttributes per filesystem
- improve measuring file timestamp resolution
- measure minimal racy interval
- use Instant to increase resolution to 1us (limited by FileTime)
- persist FileStoreAttributes
- optional asynchronous measurement of FileStoreAttributes
- directory - FileStore cache
- cache user and system level gitconfig
- fix supportsAtomicCreateNewFile default to true
- fix non-deterministic hash of archives created by ArchiveCommand
Release notes:
https://projects.eclipse.org/projects/technology.jgit/releases/5.1.9https://projects.eclipse.org/projects/technology.jgit/releases/5.1.10
Change-Id: Ifc110f1f305d16cb7f3c2dbe55e3b4855c1b7ce1
When removing all the changes associated with a user,
do not bump the associated updatedOn timestamp similarly
to what it does the single removal of individual drafts.
Add also coverage for the existing use-cases where
adding or removing a draft change should not update
the updatedOn timestamp, already working but not properly
covered.
Bug: Issue 11325
Change-Id: Ieaad3888b570db9eee6e2eb8130acc3b4cfe3d16
Allow to track the progress of the conversion to
NoteDb by sending the progress output to Flogger
instead of throwing it away.
This allows Gerrit admins to keep track of the status
of the migration to NoteDb and predict the ETA of the
conversion completion.
Bug: Issue 11348
Change-Id: I398a118c966faebab64c0dfa718ee268191eae5c
* Update plugins/replication from branch 'stable-2.16'
to bc9c7eaca297578e2e86e961118336a72227ac87
- GerritSshApi: Consistently use logError method
Change-Id: I9aeb27ce9e535c177fcdab3bee417c77233e8310
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
- GerritSshApi: Make sshHelper and uri members protected
This allows them to be accessed by classes that extend GerritSshApi.
Change-Id: Ie2ca2da1303ed4a14ac6074e37696c5f509f3ebe
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
Implementations may want to only change the default for some of the
ChangeReportFormatter's methods, in which case it makes sense to
extend the default implementation. However this is not possible when
its constructor is private.
Likewise, extending classes might need to use the UrlFormatter instance.
Make the constructor public and the UrlFormatter protected so that they
are visible to deriving classes.
Change-Id: Ia4a24f29e0d283cad40b1f90d019ea7f65bc0cb2
* stable-2.15:
StarredChangesUtil: Fix NPE when ref to be deleted doesn't exist
StarredChangesUtil: Throw LockFailureException on LOCK_FAILURE
Add test for creating a change on a non-existing base change
Rebase: Do not fail with 500 ISE if non-existing change is given as base
Fix detecting changes of parent trees when computing change kind for merge commit
Change-Id: I8ec9c55d86c3b425e0bce289f4c92cd5b6adbc80
When deleting star refs on a change deletion the star refs are computed
from the index which may be stale. If the ref that we want to delete
doesn't exist that's fine and we can just skip it.
This NPE was observed when a change deletion failed with LOCK_FAILURE
and then the request was automatically retried.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Icb73fdfd5bf6141176b733a25809c59e7f4d5c22
In case of a LockFailureException we automatically retry the ref update,
however when the deletion of star refs failed with LOCK_FAILURE we threw
a normal IOException which was treated as non-recoverable failure.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I3a557c725eb43eb12ae60329ccc0cbda4560459a
If the specified base change is missing we should rather return
422 Unprocessable Entity.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ic619e2ea80ee9a16c70693cebc2160682da298b7
A new patch set of a merge change is considered as NO_CHANGE if the
commits have the same delta and trees. For merge commits this includes
comparing the trees of the parent commits.
The comparison of the trees of the parent commits was broken, since we
forgot to parse the parent commits before accessing their trees. If a
commit is not parsed the tree information is not available and the
getTree() method returns null. Since Objects.equals(null, null) returns
true, we wrongly assumed that the parent trees didn't change. Due to
this new patch sets of merge changes were detected as NO_CHANGE even if
the tree of the second parent was changed.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ib4ea0501bf5674e479f23510d8e2ceadcb025c3d
Change I45ccec5ed removed several methods from InternalAccountQuery
that are no longer used in core Gerrit. One of them, however, is
used in CollabNet's integration.
Add back the method that is used, and annotate it with @UsedAt.
Make adaptations compared to the original version that was removed:
- Use the FluentLogger rather than slf4j's Logger
- Use the Stream API rather than Guava's Lists.transform
This partially reverts commit 69f297f568aa3648df1096aba08eac387ef7e28d.
Change-Id: I9170932646960754ef2ec4b9287d7c71844403a2
* stable-2.15:
Revert "Migrate from old-style legacy .java provider to the new JavaInfo."
Catch all exceptions for reporting on Schema_130 migration
Migrate from old-style legacy .java provider to the new JavaInfo.
Change-Id: I8fe109677bfa32c4fccceef28ff234d666d90c24
* stable-2.14:
Revert "Migrate from old-style legacy .java provider to the new JavaInfo."
Catch all exceptions for reporting on Schema_130 migration
Change-Id: I06688c3e2f51daead715e232186d74d4fc7fcdf6
As a result of this change the contents of the war file are different,
for example the postgresql library:
Before:
WEB-INF/lib/postgresql-42.2.5.jar
After:
WEB-INF/lib/libpostgresql.jar
This causes the initialization of the site to fail when using the
postgres DB:
fatal: Driver class org.postgresql.Driver not available
fatal: Cannot connect to SQL database
This reverts commit c928ec3adc3286bf740d5c97b6ef0368ce29ee6a.
Change-Id: I3fd0695f12c87fe4a049ee30739ef8674b587c6e
When migrating all projects configs during Schema_130 migration,
any unexpected exception would not show the name of the impacted
repo, causing a headache for the Gerrit admin that is willing to
migrate.
Make sure the impacted repository and the exception caused are
always displayed so that the Gerrit admin can have an easier
life understanding what happens.
Change-Id: I133c435d9e6d8677964102b26740d55d687764c6