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
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,3 +16,4 @@
|
||||
/local.properties
|
||||
*.pyc
|
||||
/gwt-unitCache
|
||||
*.asc
|
||||
|
@@ -142,34 +142,12 @@ Install {extension,plugin,gwt}-api to the local maven repository:
|
||||
buck build api_install
|
||||
----
|
||||
|
||||
Deploy {extension,plugin,gwt}-api to the remote maven repository:
|
||||
|
||||
----
|
||||
buck build api_deploy
|
||||
----
|
||||
|
||||
Install gerrit.war to the local maven repository:
|
||||
|
||||
----
|
||||
buck build war_install
|
||||
----
|
||||
|
||||
Deploy gerrit.war to the remote maven repository:
|
||||
|
||||
----
|
||||
buck build war_deploy
|
||||
----
|
||||
|
||||
The type of the repo is induced from the Gerrit version name, i.e.
|
||||
|
||||
* `2.9-SNAPSHOT`: snapshot repo
|
||||
* `2.9`: release repo
|
||||
|
||||
Deploying to the remote repository still depends on Maven, and the credentials
|
||||
for the repository need to be
|
||||
link:dev-release-deploy-config.html#deploy-configuration-settings-xml[
|
||||
configured in Maven's settings.xml file].
|
||||
|
||||
=== Plugins
|
||||
|
||||
To build all core plugins:
|
||||
|
@@ -1,6 +1,48 @@
|
||||
= Deploy Gerrit Artifacts
|
||||
|
||||
Gerrit Artifacts are stored on
|
||||
[[deploy-configuration-setting-maven-central]]
|
||||
== Deploy Configuration settings for Maven Central
|
||||
|
||||
Gerrit Extension API Jar and the Gerrit Plugin API artifacts are stored on
|
||||
Maven Central.
|
||||
|
||||
Prerequisites: Set up the Sonatype account (see link:https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-2.Signup[Sonatype
|
||||
Maven Repository Usage Guide]) and put Sonatype user and password in
|
||||
~/.m2/settings.xml:
|
||||
|
||||
----
|
||||
<server>
|
||||
<id>sonatype-nexus-staging</id>
|
||||
<username>USER</username>
|
||||
<password>PASSWORD</password>
|
||||
</server>
|
||||
----
|
||||
|
||||
PGP key must be generated and published, see
|
||||
link:https://docs.sonatype.org/display/Repository/How+To+Generate+PGP+Signatures+With+Maven[How
|
||||
To Generate PGP Signatures With Maven] for details. PGP passphrase can also be
|
||||
put in ~/.m2/settings.xml:
|
||||
|
||||
----
|
||||
<settings>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>gpg</id>
|
||||
<properties>
|
||||
<gpg.executable>gpg2</gpg.executable>
|
||||
<gpg.passphrase>mypassphrase</gpg.passphrase>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
<activeProfiles>
|
||||
<activeProfile>gpg</activeProfile>
|
||||
</activeProfiles>
|
||||
</settings>
|
||||
----
|
||||
|
||||
It can also be included in the key chain on OS X.
|
||||
|
||||
Gerrit Subproject Artifacts are stored on
|
||||
link:https://developers.google.com/storage/[Google Cloud Storage].
|
||||
Via the link:https://code.google.com/apis/console/?noredirect[API Console] the
|
||||
Gerrit maintainers have access to the `Gerrit Code Review` project.
|
||||
|
@@ -144,26 +144,34 @@ for the Subproject in `/lib/BUCK` to the released version.
|
||||
link:dev-release-deploy-config.html#deploy-configuration-settings-xml[
|
||||
configuration needed for deployment]
|
||||
|
||||
* Push the Jars to the storage bucket:
|
||||
* Push the Jars to the Maven Central:
|
||||
+
|
||||
----
|
||||
buck build api_deploy
|
||||
----
|
||||
|
||||
* Make sure you have done the
|
||||
link:dev-release-deploy-config.html#deploy-configuration-setting-maven-central[
|
||||
configuration needed for deployment]
|
||||
|
||||
|
||||
* Troubleshooting: to see the commands that are execured in Buck build process
|
||||
environment variable VERBOSE can be set:
|
||||
+
|
||||
----
|
||||
VERBOSE=1 buck build api_deploy
|
||||
----
|
||||
|
||||
[[publish-gerrit-war]]
|
||||
==== Publish the Gerrit WAR (with Core Plugins)
|
||||
|
||||
* The WAR file to upload is `buck-out/gen/release.war`
|
||||
* Upload WAR to the storage bucket via `https://cloud.google.com/console` (manual via web browser)
|
||||
* Push the WAR file to the Maven storage bucket:
|
||||
* Push the WAR to the Maven Central:
|
||||
+
|
||||
----
|
||||
buck build war_deploy
|
||||
----
|
||||
|
||||
|
||||
|
||||
[[push-stable]]
|
||||
==== Push the Stable Branch
|
||||
|
||||
|
59
gerrit-war/pom.xml
Normal file
59
gerrit-war/pom.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.google.gerrit</groupId>
|
||||
<artifactId>gerrit-war</artifactId>
|
||||
<version>2.9-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<name>Gerrit Code Review - WAR</name>
|
||||
<description>Gerrit WAR</description>
|
||||
<url>http://code.google.com/p/gerrit/</url>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<scm>
|
||||
<url>https://gerrit.googlesource.com/gerrit</url>
|
||||
<connection>https://gerrit.googlesource.com/gerrit</connection>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Dave Borowitz</name>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>David Pursehouse</name>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Edwin Kempin</name>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Martin Fick</name>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Saša Živkov</name>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Shawn Pearce</name>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<mailingLists>
|
||||
<mailingList>
|
||||
<name>Repo and Gerrit Discussion</name>
|
||||
<post>repo-discuss@googlegroups.com</post>
|
||||
<subscribe>https://groups.google.com/forum/#!forum/repo-discuss</subscribe>
|
||||
<unsubscribe>https://groups.google.com/forum/#!forum/repo-discuss</unsubscribe>
|
||||
<archive>https://groups.google.com/forum/#!forum/repo-discuss</archive>
|
||||
</mailingList>
|
||||
</mailingLists>
|
||||
|
||||
<issueManagement>
|
||||
<url>http://code.google.com/p/gerrit/issues/list</url>
|
||||
<system>Google Code Issue Tracker</system>
|
||||
</issueManagement>
|
||||
</project>
|
@@ -1,11 +1,13 @@
|
||||
include_defs('//VERSION')
|
||||
include_defs('//tools/maven/package.defs')
|
||||
|
||||
TYPE = 'snapshot' if GERRIT_VERSION.endswith('-SNAPSHOT') else 'release'
|
||||
URL = 'https://oss.sonatype.org/content/repositories/snapshots' \
|
||||
if GERRIT_VERSION.endswith('-SNAPSHOT') else \
|
||||
'https://oss.sonatype.org/service/local/staging/deploy/maven2'
|
||||
|
||||
maven_package(
|
||||
repository = 'gerrit-api-repository',
|
||||
url = 'gs://gerrit-api/%s' % TYPE,
|
||||
repository = 'sonatype-nexus-staging',
|
||||
url = URL,
|
||||
version = GERRIT_VERSION,
|
||||
jar = {
|
||||
'gerrit-extension-api': '//gerrit-extension-api:extension-api',
|
||||
|
@@ -1,29 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.google.gerrit</groupId>
|
||||
<artifactId>Gerrit-Code-Review-Maven</artifactId>
|
||||
<version>1</version>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>gerrit-api-repository</id>
|
||||
<name>Gerrit API Repository</name>
|
||||
<url>gs://gerrit-api</url>
|
||||
<uniqueVersion>true</uniqueVersion>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>com.googlesource.gerrit</groupId>
|
||||
<artifactId>gs-maven-wagon</artifactId>
|
||||
<version>3.3</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>gerrit-maven-repository</id>
|
||||
<url>https://gerrit-maven.storage.googleapis.com/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</project>
|
@@ -1,6 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.google.gerrit</groupId>
|
||||
<artifactId>Gerrit-Code-Review-Maven</artifactId>
|
||||
<version>1</version>
|
||||
</project>
|
@@ -15,14 +15,11 @@
|
||||
|
||||
from __future__ import print_function
|
||||
from optparse import OptionParser
|
||||
from os import path
|
||||
from os import path, environ
|
||||
|
||||
from sys import stderr
|
||||
from tools.util import check_output
|
||||
|
||||
def mvn(action):
|
||||
return ['mvn', '--file', path.join(self, 'fake_pom_%s.xml' % action)]
|
||||
|
||||
opts = OptionParser()
|
||||
opts.add_option('--repository', help='maven repository id')
|
||||
opts.add_option('--url', help='maven repository url')
|
||||
@@ -36,33 +33,38 @@ if not args.v:
|
||||
print('version is empty', file=stderr)
|
||||
exit(1)
|
||||
|
||||
common = [
|
||||
'-DgroupId=com.google.gerrit',
|
||||
'-Dversion=%s' % args.v,
|
||||
]
|
||||
|
||||
self = path.dirname(path.abspath(__file__))
|
||||
root = path.abspath(__file__)
|
||||
for _ in range(0, 3):
|
||||
root = path.dirname(root)
|
||||
|
||||
if 'install' == args.a:
|
||||
cmd = mvn(args.a) + ['install:install-file'] + common
|
||||
cmd = [
|
||||
'mvn',
|
||||
'install:install-file',
|
||||
'-Dversion=%s' % args.v,
|
||||
]
|
||||
elif 'deploy' == args.a:
|
||||
cmd = mvn(args.a) + [
|
||||
'deploy:deploy-file',
|
||||
cmd = [
|
||||
'mvn',
|
||||
'gpg:sign-and-deploy-file',
|
||||
'-DrepositoryId=%s' % args.repository,
|
||||
'-Durl=%s' % args.url,
|
||||
] + common
|
||||
]
|
||||
else:
|
||||
print("unknown action -a %s" % args.a, file=stderr)
|
||||
exit(1)
|
||||
|
||||
for spec in args.s:
|
||||
artifact, packaging_type, src = spec.split(':')
|
||||
exe = cmd + [
|
||||
'-DpomFile=%s' % path.join(root, '%s/pom.xml' % artifact),
|
||||
'-Dpackaging=%s' % packaging_type,
|
||||
'-Dfile=%s' % src,
|
||||
]
|
||||
try:
|
||||
check_output(cmd + [
|
||||
'-DartifactId=%s' % artifact,
|
||||
'-Dpackaging=%s' % packaging_type,
|
||||
'-Dfile=%s' % src,
|
||||
])
|
||||
if environ.get('VERBOSE'):
|
||||
print(' '.join(exe), file=stderr)
|
||||
check_output(exe)
|
||||
except Exception as e:
|
||||
print('%s command failed: %s' % (args.a, e), file=stderr)
|
||||
exit(1)
|
||||
|
@@ -32,7 +32,8 @@ pattern = re.compile(r'(\s*)<version>[-.\w]+</version>')
|
||||
|
||||
for project in ['gerrit-extension-api', 'gerrit-plugin-api',
|
||||
'gerrit-plugin-archetype', 'gerrit-plugin-gwt-archetype',
|
||||
'gerrit-plugin-gwtui', 'gerrit-plugin-js-archetype']:
|
||||
'gerrit-plugin-gwtui', 'gerrit-plugin-js-archetype',
|
||||
'gerrit-war']:
|
||||
pom = os.path.join(project, 'pom.xml')
|
||||
try:
|
||||
outxml = ""
|
||||
|
Reference in New Issue
Block a user