Avatica HOWTO
Here’s some miscellaneous documentation about using Avatica.
- Building from a source distribution
- Building from Git
- Running tests
- Contributing
- Getting started
- Advanced topics for developers
- Advanced topics for committers
- Set up PGP signing keys (for Calcite committers)
- Run a GPG agent
- Set up Nexus repository credentials (for Calcite committers)
- Making a snapshot (for Calcite committers)
- Making a release candidate (for Calcite committers)
- Checking the artifacts
- Cleaning up after a failed release attempt (for Calcite committers)
- Validate a release
- Get approval for a release via Apache voting process (for Calcite committers)
- Publishing a release (for Calcite committers)
- Add release notes and announce the release
- Publishing the web site (for Calcite committers)
Building from a source distribution
Prerequisites are Java (JDK 8 or later) and Gradle (version 8.5) on your path.
(The source distribution does not include the Gradle wrapper; therefore you need to install Gradle manually.)
Unpack the source distribution .tar.gz
file,
cd
to the root directory of the unpacked source,
then build using Gradle:
Running tests describes how to run more or fewer
tests (but you should use the gradle
command rather than
./gradlew
).
Building from Git
Prerequisites are Git, and Java (JDK 8 or later) on your path.
Create a local copy of the GitHub repository,
cd
to its root directory,
then build using Gradle:
Running tests describes how to run more or fewer tests.
Running tests
The test suite will run by default when you build, unless you specify
-x test
You can use ./gradlew assemble
to build the artifacts and skip all tests and verifications.
To run tests in docker:
Prerequisites are Docker and Docker Compose.
Contributing
See the developers guide.
Getting started
See the developers guide.
Advanced topics for developers
The following sections might be of interest if you are adding features to particular parts of the code base. You don’t need to understand these topics if you are just building from source and running tests.
Advanced topics for committers
The following sections are of interest to Calcite committers and in particular release managers.
Set up PGP signing keys (for Calcite committers)
Follow instructions here to
create a key pair. (On Mac OS X, I did brew install gpg
and
gpg --gen-key
.)
Add your public key to the
KEYS
file by following instructions in the KEYS
file.
(The KEYS
file is not present in the git repo or in a release tar
ball because that would be
redundant.)
Run a GPG agent
By default, Gradle plugins which require you to unlock a GPG secret key
will prompt you in the terminal. To prevent you from having to enter
this password numerous times, it is highly recommended to install and
run gpg-agent
.
This can be started automatically via an ~/.xsession
on Linux or some
scripting in your shell’s configuration script of choice (e.g. ~/.bashrc
or ~/.zshrc
)
Also, ensure that default-cache-ttl 6000
is set in ~/.gnupg/gpg-agent.conf
to guarantee that your credentials will be cached for the duration of the build.
Set up Nexus repository credentials (for Calcite committers)
Gradle provides multiple ways to configure project properties.
For instance, you could update $HOME/.gradle/gradle.properties
.
Note: the build script would print the missing properties, so you can try running it and let it complain on the missing ones.
The following options are used:
When
asflike-release-environment
is used, the credentials are taken from asfTest...
(e.g. asfTestNexusUsername=test
)
Note: if you want to uses gpg-agent
, you need to pass useGpgCmd
property, and specify the key id
via signing.gnupg.keyName
.
Making a snapshot (for Calcite committers)
Before you start:
- Set up signing keys as described above.
- Make sure you are using JDK 8 (not 9 or 10).
Making a release candidate (for Calcite committers)
Before you start:
- Set up signing keys as described above.
- Make sure you are using JDK 8 (not 9 or 10).
- Check that
README
,site/_docs/howto.md
,site/_docs/docker_images.md
have the correct version number. - Check that
site/_docs/howto.md
has the correct Gradle version. - Check that
NOTICE
has the current copyright year. - Check that
calcite.avatica.version
has the proper value in/gradle.properties
. - Add release notes to
site/_docs/history.md
. If release notes already exist for the version to be released, but are commented out, remove the comments ({% comment %}
and{% endcomment %}
). Include the commit history, names of people who contributed to the release, and say which versions of Java, Guava and operating systems the release is tested against. - Generate a report of vulnerabilities that occur among dependencies,
using
./gradlew dependencyCheckUpdate dependencyCheckAggregate
. - Make sure that every “resolved” JIRA case (including duplicates) has a fix version assigned (most likely the version we are just about to release)
The release candidate process does not add commits,
so there’s no harm if it fails. It might leave -rc
tag behind
which can be removed if required.
You can perform a dry-run release with a help of vlsi/asflike-release-environment. That performs the same steps, however it pushes changes to the mock Nexus, Git, and SVN servers.
If any of the steps fail, fix the problem, and start again from the top.
Prepare a release candidate directly in your environment
Pick a release candidate index (starting from 0) and ensure it does not interfere with previous candidates for the version.
Prepare a release candidate in Docker
-
You will need to have Docker and Docker Compose installed.
-
The script expects you to mount your
~/.gnupg
directory into the/.gnupg
directory in the container. Once mounted into the container, the script will make a copy of the contents and move it to a different location, so that it will not modify the contents of your original~/.gnupg
directory during the build. -
Start the asflike-release-environment to prepare a staging environment for a dry-run.
Checking the artifacts
- In the
release/build/distributions
directory should be these 3 files, among others:- apache-calcite-avatica-X.Y.Z-src.tar.gz
- apache-calcite-avatica-X.Y.Z-src.tar.gz.asc
- apache-calcite-avatica-X.Y.Z-src.tar.gz.sha512
- Note that the file names start
apache-calcite-avatica-
. - In the source distro
.tar.gz
(currently there is no binary distro), check that all files belong to a directory calledapache-calcite-avatica-X.Y.Z-src
. - That directory must contain files
NOTICE
,LICENSE
,README
,README.md
- Check that the version in
README
is correct - Check that
LICENSE
is identical to the file checked into git
- Check that the version in
- Make sure that the following files do not occur in the source
distros:
KEYS
,gradlew
,gradlew.bat
,gradle-wrapper.jar
,gradle-wrapper.properties
- For each .jar (for example
core/build/libs/avatica-core-X.Y.Z.jar
andserver/build/libs/avatica-server-X.Y.Z-sources.jar
), verify that theMETA-INF
directory contains the correct contents forLICENSE
andNOTICE
per the source/classes contained. Refer to the ASF licensing documentation on what is required. - Check PGP, per this
Verify the staged artifacts in the Nexus repository:
- Go to https://repository.apache.org/ and login
- Under
Build Promotion
, clickStaging Repositories
- In the
Staging Repositories
tab there should be a line with profileorg.apache.calcite
- Navigate through the artifact tree and make sure the .jar, .pom, .asc files are present
Cleaning up after a failed release attempt (for Calcite committers)
If something is not correct, you can fix it, commit it, and prepare the next candidate. The release candidate tags might be kept for a while.
Validate a release
Get approval for a release via Apache voting process (for Calcite committers)
Release vote on dev list.
Note: the draft mail is printed as the final step of prepareVote
task,
and you can find the draft in /build/prepareVote/mail.txt
After vote finishes, send out the result:
Use the Apache URL shortener to generate shortened URLs for the vote proposal and result emails. Examples: s.apache.org/calcite-1.2-vote and s.apache.org/calcite-1.2-result.
Publishing a release (for Calcite committers)
After a successful release vote, we need to push the release out to mirrors, and other tasks.
Choose a release date. This is based on the time when you expect to announce the release. This is usually a day after the vote closes. Remember that UTC date changes at 4pm Pacific time.
In JIRA, search for all issues resolved in this release, and do a bulk update changing their status to “Closed”, with a change comment “Resolved in release X.Y.Z (YYYY-MM-DD)” (fill in release number and date appropriately). Uncheck “Send mail for this update”.
Tip: Push the git tag only after the staged nexus artifacts are promoted in the repository. This is because pushing the tag triggers Docker Hub to start building the docker images immediately and the build will pull in the promoted artifacts. If the artifacts are not yet available, the build on Docker Hub will fail. It’s best to continue with the following steps after you have confirmed that the nexus artifacts were promoted properly.
Publishing directly in your environment
If there are more than 2 releases in SVN (see https://dist.apache.org/repos/dist/release/calcite), clear out the oldest ones:
The old releases will remain available in the release archive.
Publishing a release using docker
This assumes that a rc release was tagged and pushed to the git repository.
Add release notes and announce the release
Add a release note by copying
site/_posts/2016-11-01-release-1.9.0.md,
update the version number in gradle.properties
,
generate the javadoc and copy to site/target/avatica/javadocAggregate
,
publish the site,
and check that it appears in the contents in news.
After 24 hours, announce the release by sending an email to announce@apache.org. You can use the 1.8.0 announcement as a template. Be sure to include a brief description of the project.
Publishing the web site (for Calcite committers)
See instructions in site/README.md.