Florian Zschocke [Thu, 30 Jan 2020 20:47:12 +0000 (21:47 +0100)]
Build: create macro for creating the release process script
Refactor the creation of the release process script, from
`release.template` into a `macrodef`.
Add a new target `releaseScript`, so that the release script can be
created after the `tagRelease` target was run.
This is helpful if the `tagRelease` target is run by a different,
earlier process than the actual release creation process.
Florian Zschocke [Thu, 30 Jan 2020 20:42:13 +0000 (21:42 +0100)]
Build: Store release version information in file.
If requested, by setting a file name in the `versionInfo`
property, store release version and tag in a file, for
other scripts and programs to pick up.
Florian Zschocke [Tue, 28 Jan 2020 12:53:39 +0000 (13:53 +0100)]
Add Maven Central to registeredRepositories
Moxie does have these defined by default, but with transport HTTP.
Since January 2020, Maven Central only accepts HTTPS, no HTTP
anymore. So we add them here explicitly, with `https://`.
We add it to the `build.moxie` file, instead of keeping it in a
local `settings.moxie`, so that a CI server can immediately use it.
Florian Zschocke [Mon, 27 Jan 2020 20:53:15 +0000 (21:53 +0100)]
Doc: Update built-in docs with missing pages and links
Add pages for `fail2ban` and GFS to the `generateDocs` target, so that
they also show up in the documentation on GO etc.
Also adjust the links to issues and commits.
Florian Zschocke [Mon, 27 Jan 2020 19:30:44 +0000 (20:30 +0100)]
Add project property `release.tag` as a global `project.tag`
Add property `release.tag` to keep a generally available property.
The `project.tag` was getting used in many places, so I need a global
definition for it. The property `project.tag`, defined in the target
`tagRelease` could not be reused, since when that target runs, the
version is still a SNAPSHOT version. (And properties don't get
re-assigned.) So instead a new property `release.tag` is defined,
just like `release.name`, which can be only used sensible in a
release stage, i.e. after `tagRelease` ran.
Florian Zschocke [Sun, 26 Jan 2020 18:50:58 +0000 (19:50 +0100)]
Adjust `release.template` for publishing releases on GitHub
The major change is switching from `publishBinaries`, which still
exists and uploads to Bintray, to `releaseBinaries`, which creates
a draft release on GitHub and uploads the binaries.
Another change is some reordering. Now first the binaries are
uploaded, the maven artifacts pubished and the tag and site pages
pushed. Then the GitHub release is made public.
Only after that is the minor version bumped and pushed.
The whole script could use some error checking and stoping when
things go wrong, instead of blindly continuing.
A minor change, and temporary, is that we need and check for Ant 1.9,
as we still build with Java 7.
Florian Zschocke [Sun, 26 Jan 2020 15:47:44 +0000 (16:47 +0100)]
Add deployment of a release to GitHub
Add Ant tasks and macros to deploy binaries to GitHub,
using GitHub's releases.
Adds an Awk script to extract GH flavoured markdown release notes
from the release.moxie file.
Adds `ok.sh` to the repository so that it is readily available.
This is a Bourne shell GitHub API client, used to create a release
on GitHub and upload the binaries.
Florian Zschocke [Fri, 10 Jan 2020 22:24:08 +0000 (23:24 +0100)]
ci: Add build with Java 7 on Linux
Add a job to run a build with Java 7.
The job currently only runs on Linux.
In order to run on Java 7, an old Ant version is downloaded and
installed. We use moxie+ant for this, so we build with moxie.
Build on matrix of latest Ubunutu and latest Windows.
Currently that is Ubuntu 18.04 and Windows Server 2019.
https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners
Florian Zschocke [Mon, 11 Nov 2019 22:45:56 +0000 (23:45 +0100)]
Adjust versions of JaCoCo and parboiled to match and work.
Adjust the version of JaCoCo down to 0.8.4 and the version
of parboiled-java up to 1.3.1. They need to match because both
use ASM. This combination has the same dependency on ASM: 7.1.
And it seems to work, at least the docs get generated and the
`moxie test` doesn't fail building the report anymore.
Florian Zschocke [Mon, 11 Nov 2019 21:03:32 +0000 (22:03 +0100)]
Update test file with MD hashed password
With the feature of passwords getting automatically
upgraded to a hashed version, the default `admin`
password in the test-users file will get stored
as MD5 hashed during test execution. Commit this
change, so that the file isn't always showing up
as changed.
Florian Zschocke [Mon, 11 Nov 2019 17:13:11 +0000 (18:13 +0100)]
Fix user preferences selecting the wrong preferred locale.
Due to a wrong comparison, when loading the preferred locale in the
user preferences page, in cases like `zh_CN` or `de_DE` the wrong
locale would be chosen.
As with too many things, the code is duplicated on the `UserPage`
and the `EditUserPage`. And they differ. So extract the choosing of
the preferred language for display into a method in the (more up-to-date)
`UserPage` and call that from the `EditUserPage`.
Florian Zschocke [Mon, 11 Nov 2019 15:24:45 +0000 (16:24 +0100)]
Guard docs pages against bad URLs
If, for example, an external site links to a docs page or a specific
doc page, and the branch that link points to is no longer existing,
an internal error happens due to a NPE.
The NPE is guarded against and a No Docs page is returned.
Florian Zschocke [Sun, 10 Nov 2019 23:10:43 +0000 (00:10 +0100)]
Fix NPE when no action can be parsed from the URL
Renames `static final` variables according to convention to be in all
upper case. That makes it easier to see that in an `equals` comparison
the final variable should come first as it will not trigger a NPE.
Also strip parameters from the URL when extracting the repository
name from it. Parameters can not be part of a repository name, and
this way an empty repository name can be detected.
Florian Zschocke [Sun, 10 Nov 2019 12:04:29 +0000 (13:04 +0100)]
In SSH tests ignore an external SSH tool
The SshDaemonTest would fail under Windows. That is because JGit looks
at the `GIT_SSH` environment variable. If it is set, the tool the variable
is pointing to is used for the SSH connection. This is a problem when
it is set to "Plink" under Windows, because Plink will not recognize the
server key and will not find it in the registry, cached as a known host.
Since a test can/should not add the key to the registry but simply wants
to ignore it, but there is no way to tell Plink to do so, the tests would
fail.
This patch filters the `GIT_SSH` environment variable from JGit's
`SystemReader`, so that the internal SSH client is used.
Florian Zschocke [Sun, 10 Nov 2019 12:02:07 +0000 (13:02 +0100)]
Update BouncyCastle dependency to version 1.57
To support the new PBKDF2 password hashing, the Bouncy Castle provider
needs to be updated to a version that supports PBKDF2 with HMAC SHA265.
The current version doesn't have PBKDF2WithHmacSHA265, and neither does
Java 7, so that under Java 7 it can not be used. This update enables
the new password hashing under Java 7, too.
Fix NullpointerException when stopping GitBlit Server.
When GitBlit server did not start properly, is running but couldn't
start the `PluginManager`, then stopping the server via the `--stop`
argument on the command line resulted in a NullpointerException.
Which left the server running. Now this is prevented and the server
will actually shut down.
For Java 9+ define the classpath instead of using a Launcher.
The (moxie and other) Launcher do not work with Java 9 and later anymore.
It used to dynamically extend the classpath, misusing an internal
interface of the `URLClassLoader`. This is no longer possible since Java 9,
which closed that path and does not offer any way to dynamically extend
the classpath during runtime.
So the choice is between providing one large Jar with everything in it,
providing a Jar that has the Jars in `ext` listed explicitly in its
manifest, and specifying the classpath on the command line where
the `ext` directory can be added and all contained jar files will
be put on the classpath.
The motivation for the Launcher class was to be able to simply drop
new jar files into a directory and they will be picked up at the
application start, without having to specify a classpath. We opt
for solution three here. This way jar files can still be dropped
into the ext directory, albeit the directory needs to be added to
the classpath on the command line. Unfortunately using a wildcard
is not possible in the manifest file. We change the calls in the
script files accordingly. This seems like a good compromise,
since no one will run the application manually typing the whole
commandline anyway.
This also does away with the splash screen, by the way. Again,
doesn't seem like a big loss, as I don't think it was ever shown
for the Authority.
Personally, I am not convinced that it is the best way, because
I don't really think that the use case of dropping whatever jar
files into the `ext` directory is a valid one that happened a lot.
This does not yet fix the client programs, which still use a
Launcher. Maybe for them a all-in-one Jar is a better solution.
Report Java versions used during build and server start.
With three versions about to be supported right now
it is getting more important to know which Java version is
used when building and testing Gitblit, and which Java
version is used to run Gitblit.
So have the Moxie build report the javac version, and the
JVM version that Moxie is running on. These might be
different.
The `GitBlitServer` will print the Java version and vendor,
so that it gets visible if a user would paste a log output
for analysis.
Integrate the `PasswordHash` class and subclass in the user
and password editing and authentication. Replaces the old code and
the previous `SecurePasswordHashingUtils` class.
Integrate the work of pingunaut to add support for PBKDF2 password
hashing. A new class `PasswordHashPbkdf2` is added, which builds
on his `SecurePasswordHashUtils` class, but makes it a subclass
of `PasswordHash`. This will replace the original class when
integrating the new PasswordHash way into GitBlit.
Add a PasswordHash class as a central place to deal with password hashes.
Instead of having to deal with the implementation details of hashing
and verifying passwords in multiple places, have a central unit
be responsible for it. Otherwise we need to edit three different places
when adding a new hashing scheme.
With this class adding a new hashing scheme just requires creating a
new subclass of `PasswordHash` and registering its type in the enum
`PasswordHash.Type`.
The rest of the code will use a common interface for all hashing
schemes and doesn't need to be changed when a new one is added.
Florian Zschocke [Sat, 15 Jun 2019 19:37:07 +0000 (21:37 +0200)]
Set default to `expanded` for collapsible repo groups.
Move the new property `web.collapsibleRepositoryGroups` into the
`web` section, close to the list type property. Set the default
to be `expanded`, so that the new feature is visible but the list
is still the full list like before.
Add new value `tree` to the description of the property
`web.repositoryListType`.
Florian Zschocke [Sat, 15 Jun 2019 19:09:36 +0000 (21:09 +0200)]
Remove "folding outlines" and sort repositories before subfolders.
Remove guard rails at the left to get a cleaner look.
To make it easier to determine which repositories belong to which
folder, display the repositories first, then the subfolder.
Florian Zschocke [Thu, 13 Jun 2019 19:03:32 +0000 (21:03 +0200)]
Add build dependency on parboiled to fix build of documentation.
Updating JaCoCo in commit 23072ffb broke the build of the
HTML documentation. As found out by @chirontt, adding parboiled
as a build dependency fixes it.
Florian Zschocke [Mon, 10 Jun 2019 19:32:02 +0000 (21:32 +0200)]
Create unit tests for special characters in path names
Create a regression test for issue #999.
Add directories with '[]' ans '()' in the name to the
hello-world repository, so that they can be used in unit
tests for repository paths with special characters.
Florian Zschocke [Mon, 10 Jun 2019 14:37:15 +0000 (16:37 +0200)]
Do not resolve symbolic links to repositories.
When symbolic links under the base repository folder point to repositories
outside the base repository folder, the forming of relative repository
names failed and resulted in NullPointerExceptions.
Create the relative path by not following symbolic links, i.e. the link
name is taken as is and not resolved to the external path.
This also changes the whole `exactPath` method to work on Paths, instead
of Files.
Zips of recreated hello-world.git and all external repositories for testing.
This hello-world.git repo is created using the native Git for Windows
software.
Various test classes in the GitBlitSuite test suite require the presence
of the hello-world.git repo in github.com/git/ which has been missing,
hence causing many test failures in the suite. This recreation of the
hello-world.git repo aims to conform to the many test cases'
requirements in the suite, and to be checked in as part of the gitblit
repo, thus eliminates the requirement of a remote hello-world.git repo
during the test run. The repo is now stored is a zip ball in the new
src/test/data folder.
The hello-world repo's various commit IDs were hard-coded in various
test classes. These commit IDs, which must now have new values in the
recreated repo, are now extracted out to the
src/test/data/hello-world.properties file. The gitblit's build.xml is
modified to generate the HelloworldKeys.java file containing the
hello-world.properties file's key strings, in similar fashion as the
existing generation of the com.gitblit.Keys.java file. And these key
strings in HelloworldKeys.java are now used in the various test classes,
thus eliminating the hard-coding of the hello-world repo's commit IDs in
the test code.
During the test run by GitBlitSuite test suite, some repos from GitHub
were cloned and became part of the test data. These repos are now zipped
to be part of gitblit repo itself, thus eliminating the network fetch at
the start of test run which can be slow, especially with the JGit repo
cloning which is huge and time consuming. The cloned JGit repo is now
zipped and checked in to gitblit, along with the other 4 repos
(hello-world, ambition, gitective and ticgit). They will be unzipped
during the test suite run and be available in the local file system,
thus avoiding the need for some network fetch.
Special note on the zipped JGit repo: this repo is big (and growing all
the time on GitHub), and takes up about 32MB of disk space after cloning
from GitHub. I've made it smaller by resetting HEAD back to a commit of
5 years ago (with git reset --hard <commitId> command), to put it back
to roughly where/when the tests were written for it (which is not quite,
because there are tons of commit history since which can't be removed.)
The local JGit repo is then garbage-collected (with git gc --prune
--aggressive) to reduce its size to about 19MB.
Zipped it is still 17MB. This is a lot of MBs for a few tests.
So the JGit repo is not included in this commit.
Most of failures were due to temporary test repos, users and/or teams
being left behind after the test run, and these left-over stuff in
$baseFolder/data/git caused assertion errors in many tests in subsequent
test runs. This fix tries to delete those left-over stuff at the end of
each test, mainly in their @Afterclass code blocks.
PushLogTest.java is deleted as it doesn't work, and has been superseded
with better tests in various protocol test suites (GitServletTest,
GitDaemonTest, SshDaemonTest, etc.)
Added javax.activation dependency "
thanks to this dependency, one can start gitblit with java 9 without using deprecated internal module --add-modules java.activation
Sebastiano Pilla [Wed, 31 May 2017 22:07:45 +0000 (00:07 +0200)]
Adds the
server.httpTimeout
setting to allow cloning big repositories over HTTP. This change fixes the java.util.concurrent.TimeoutException issue described in https://groups.google.com/d/topic/gitblit/UvDC48NpmF4/discussion .
Martin Spielmann [Sun, 21 May 2017 22:32:23 +0000 (00:32 +0200)]
Revert "Add feedback to SSH Key Form. #1226"
This reverts commit c3e317a28899915036517c3a05a2b883796f633d.
Was added by mistake here. Should go into own branch to be able to merge with upstream using separate PR
Florian Zschocke [Sat, 18 Mar 2017 12:37:25 +0000 (13:37 +0100)]
Merge pull request #1168 from lucamilanesio/bump-to-lucene-5.5.2
Bump to Lucene 5.5.2
The new code will create Lucene indices in a new directory named after codec and index version.
This provides for easy and safe up- and downgrades. But it also means that the old indices will
stick around on disk. What this version is missing is a kind of "garbage collection" deleting old, unused
indices when they are no longer needed. That task needs to be done manually currently. We should
at leas at some point provide a script for it.
Reindex tickets on server start if no index exists
Check if tickets need to be reindexed when the server starts. This is the
case if no ticket index exists. In that case the ticket index is built.
This is done during the start of the `ITicketService`.
For this the interface of `ITicketService` needed to change. The `start`
method was defined abstract and the specific ticket services had to
implement it. None does any real starting stuff in it.
The `start` method is now final. It calls a new abstract method `onStart`
which the specific ticket services need to implement. In the existing
implementations I just changed `start` to `onStart`.
Use versioned index directories for repository indices.
Change from the index version of a repository index being stored in a config
file to also using index directories with the version in the name. For that,
`LuceneRepoIndexStore` is added, which adds the fixed `lucene` part to the path.
It also gives out the location of the `lucene.conf` file, which is now stored in
the index directory. This way it is automatically deleted when the directory is
deleted.
I believe that it should also provide means to store branch aliases and tips,
i.e. hide the config file completely. But this isn't implemented with this
commit, the `LuceneService` is still aware that a config file is used.
In order to be able to update the index definition, the ticket index
is assigned a version number, 2. This way the definiton can be updated
and compatability with existing index files can be checked.
The actual index is stored in a directory of name `indexVersion_codecVersion`.
This wayit is veriy easy to check if an index of a certain version exists on the
filesystem. It allows to have multiple indexes of different versions present,
so that a downgrade of the software is possible without having to reindex
again. Of coure, this is only possible if no new tickets were created since these
would be missing in the old index.
A new class `LuceneIndexStore` is introduced, which abstracts away the versioned
index directory. The idea is, that this provides one place to keep the Lucene
codec version and to allow to code compatibility rules into this class, so that
older indices can still be used if they are compatible.