Skip to content

Commit ec6b26b

Browse files
davidheryantofeast-ci-bot
authored andcommitted
Java SDK release script (feast-dev#406)
* Use back revision variable in pom.xml So user or CI system can easily override revision from external sources such as Git tag name * Add flatten maven plugin This plugin is useful during deployment so the final pom is resolved without parent dependency, i.e. we do not necessarily need to upload parent library * Increase versions for maven source,javadoc,spotless plugins So it has newer features and more fixes * Add gpg-plugin needed to sign releases * Use oss configure for flatten plugin, add developers info in pom.xml (required for releasing library * Add publish-java-sdk script * Add more logs to publish-java-sdk.sh * Add ProwJob publish-java-sdk * Use GPG_KEY_IMPORT_DIR variable * Update revision in pom.xml to 0.4.2-SNAPSHOT
1 parent 3230bf5 commit ec6b26b

File tree

8 files changed

+202
-22
lines changed

8 files changed

+202
-22
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,8 @@ dmypy.json
174174
.pyre/
175175
.vscode
176176

177-
sdk/python/docs/html
177+
# .flattened-pom.xml is generated by flatten-maven-plugin.
178+
# This pom should not be committed because it is only used during release / deployment.
179+
.flattened-pom.xml
180+
181+
sdk/python/docs/html

.prow/config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,34 @@ postsubmits:
169169
# https://github.com/semver/semver/issues/232
170170
- ^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$
171171

172+
- name: publish-java-sdk
173+
decorate: true
174+
spec:
175+
containers:
176+
- image: maven:3.6-jdk-8
177+
command:
178+
- bash
179+
- -c
180+
- .prow/scripts/publish-java-sdk.sh --revision ${PULL_BASE_REF:1}
181+
volumeMounts:
182+
- name: gpg-keys
183+
mountPath: /etc/gpg
184+
readOnly: true
185+
- name: maven-settings
186+
mountPath: /root/.m2/settings.xml
187+
subPath: settings.xml
188+
readOnly: true
189+
volumes:
190+
- name: gpg-keys
191+
secret:
192+
secretName: gpg-keys
193+
- name: maven-settings
194+
secret:
195+
secretName: maven-settings
196+
branches:
197+
# Filter on tags with semantic versioning, prefixed with "v"
198+
- ^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$
199+
172200
- name: publish-docker-images
173201
decorate: true
174202
spec:
@@ -278,4 +306,5 @@ postsubmits:
278306
secret:
279307
secretName: feast-service-account
280308
branches:
309+
# Filter on tags with semantic versioning, prefixed with "v"
281310
- ^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$

.prow/scripts/publish-java-sdk.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -o pipefail
5+
6+
GPG_KEY_IMPORT_DIR=/etc/gpg
7+
8+
usage()
9+
{
10+
echo "usage: publish-java-sdk.sh
11+
12+
--revision Value for the revision e.g. '0.2.3'
13+
--gpg-key-import-dir Directory containing existing GPG keys to import.
14+
The directory should contain these 2 files:
15+
- public-key
16+
- private-key
17+
The default value is '/etc/gpg'
18+
19+
This script assumes the GPG private key is protected by a passphrase.
20+
The passphrase can be specified in \$HOME/.m2/settings.xml. In the same xml
21+
file, credentials to upload releases to Sonatype must also be provided.
22+
23+
# Example settings: ~/.m2/settings.xml
24+
<settings>
25+
<servers>
26+
<server>
27+
<id>ossrh</id>
28+
<username>SONATYPE_USER</username>
29+
<password>SONATYPE_PASSWORD</password>
30+
</server>
31+
</servers>
32+
<profiles>
33+
<profile>
34+
<id>ossrh</id>
35+
<properties>
36+
<gpg.passphrase>GPG_PASSPHRASE</gpg.passphrase>
37+
</properties>
38+
</profile>
39+
</profiles>
40+
</settings>
41+
"
42+
}
43+
44+
while [ "$1" != "" ]; do
45+
case "$1" in
46+
--revision ) REVISION="$2"; shift;;
47+
--gpg-key-import-dir ) GPG_KEY_IMPORT_DIR="$2"; shift;;
48+
-h | --help ) usage; exit;;
49+
* ) usage; exit 1
50+
esac
51+
shift
52+
done
53+
54+
if [ -z $REVISION ]; then usage; exit 1; fi
55+
56+
echo "============================================================"
57+
echo "Checking Maven and GPG versions"
58+
echo "============================================================"
59+
mvn --version
60+
echo ""
61+
gpg --version
62+
63+
echo "============================================================"
64+
echo "Importing GPG keys"
65+
echo "============================================================"
66+
gpg --import --batch --yes $GPG_KEY_IMPORT_DIR/public-key
67+
gpg --import --batch --yes $GPG_KEY_IMPORT_DIR/private-key
68+
69+
echo "============================================================"
70+
echo "Deploying Java SDK with revision: $REVISION"
71+
echo "============================================================"
72+
mvn --projects sdk/java -Drevision=$REVISION --batch-mode clean deploy

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>dev.feast</groupId>
2525
<artifactId>feast-parent</artifactId>
26-
<version>0.3.6-SNAPSHOT</version>
26+
<version>${revision}</version>
2727
</parent>
2828

2929
<name>Feast Core</name>

ingestion/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>dev.feast</groupId>
2525
<artifactId>feast-parent</artifactId>
26-
<version>0.3.6-SNAPSHOT</version>
26+
<version>${revision}</version>
2727
</parent>
2828

2929
<name>Feast Ingestion</name>

pom.xml

Lines changed: 92 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<groupId>dev.feast</groupId>
2626
<artifactId>feast-parent</artifactId>
27-
<version>0.3.6-SNAPSHOT</version>
27+
<version>${revision}</version>
2828
<packaging>pom</packaging>
2929

3030
<modules>
@@ -35,6 +35,7 @@
3535
</modules>
3636

3737
<properties>
38+
<revision>0.4.2-SNAPSHOT</revision>
3839
<github.url>https://github.com/gojek/feast</github.url>
3940

4041
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -47,7 +48,6 @@
4748
<org.apache.beam.version>2.16.0</org.apache.beam.version>
4849
<com.google.cloud.version>1.91.0</com.google.cloud.version>
4950
<io.prometheus.version>0.8.0</io.prometheus.version>
50-
5151
<byte-buddy.version>1.9.10</byte-buddy.version>
5252
<hamcrest.version>1.3</hamcrest.version>
5353
<kafka.version>2.3.0</kafka.version>
@@ -58,9 +58,18 @@
5858

5959
<organization>
6060
<name>Gojek</name>
61-
<url>https://www.gojek.io/</url>
61+
<url>https://www.gojek.com</url>
6262
</organization>
6363

64+
<developers>
65+
<developer>
66+
<name>Feast Authors</name>
67+
<url>${github.url}</url>
68+
<organization>Gojek</organization>
69+
<organizationUrl>https://www.gojek.com</organizationUrl>
70+
</developer>
71+
</developers>
72+
6473
<licenses>
6574
<license>
6675
<name>Apache License, Version 2.0</name>
@@ -81,11 +90,16 @@
8190
<url>${github.url}/issues</url>
8291
</issueManagement>
8392

93+
<!-- Release Java library on Sonatype https://central.sonatype.org/pages/apache-maven.html -->
8494
<distributionManagement>
8595
<snapshotRepository>
8696
<id>ossrh</id>
8797
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
8898
</snapshotRepository>
99+
<repository>
100+
<id>ossrh</id>
101+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
102+
</repository>
89103
</distributionManagement>
90104

91105
<dependencyManagement>
@@ -274,21 +288,10 @@
274288
</extensions>
275289

276290
<plugins>
277-
<plugin>
278-
<groupId>org.sonatype.plugins</groupId>
279-
<artifactId>nexus-staging-maven-plugin</artifactId>
280-
<version>1.6.7</version>
281-
<extensions>true</extensions>
282-
<configuration>
283-
<serverId>ossrh</serverId>
284-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
285-
<autoReleaseAfterClose>false</autoReleaseAfterClose>
286-
</configuration>
287-
</plugin>
288291
<plugin>
289292
<groupId>org.apache.maven.plugins</groupId>
290293
<artifactId>maven-source-plugin</artifactId>
291-
<version>2.2.1</version>
294+
<version>3.2.1</version>
292295
<executions>
293296
<execution>
294297
<id>attach-sources</id>
@@ -301,7 +304,7 @@
301304
<plugin>
302305
<groupId>org.apache.maven.plugins</groupId>
303306
<artifactId>maven-javadoc-plugin</artifactId>
304-
<version>2.9.1</version>
307+
<version>3.1.1</version>
305308
<executions>
306309
<execution>
307310
<id>attach-javadocs</id>
@@ -314,7 +317,7 @@
314317
<plugin>
315318
<groupId>com.diffplug.spotless</groupId>
316319
<artifactId>spotless-maven-plugin</artifactId>
317-
<version>1.26.0</version>
320+
<version>1.26.1</version>
318321
<configuration>
319322
<java>
320323
<licenseHeader>
@@ -429,6 +432,78 @@
429432
<skip>true</skip>
430433
</configuration>
431434
</plugin>
435+
<!-- nexus-staging-maven-plugin configures Maven to deploy to OSSRH Nexus Repository Manager -->
436+
<plugin>
437+
<groupId>org.sonatype.plugins</groupId>
438+
<artifactId>nexus-staging-maven-plugin</artifactId>
439+
<version>1.6.8</version>
440+
<extensions>true</extensions>
441+
<configuration>
442+
<serverId>ossrh</serverId>
443+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
444+
<!-- autoReleaseAfterClose is true as the release should be automated via continuous integration -->
445+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
446+
</configuration>
447+
</plugin>
448+
<!--
449+
flatten-maven-plugin is used to flatten the generated POM during deployment. This is
450+
required when releasing a project with a parent dependency where the version
451+
is using ${revision} variable. This plugin will resolve and flatten the relationship.
452+
https://www.mojohaus.org/flatten-maven-plugin/index.html
453+
-->
454+
<plugin>
455+
<groupId>org.codehaus.mojo</groupId>
456+
<artifactId>flatten-maven-plugin</artifactId>
457+
<version>1.1.0</version>
458+
<configuration>
459+
<flattenMode>oss</flattenMode>
460+
</configuration>
461+
<executions>
462+
<execution>
463+
<id>flatten</id>
464+
<phase>process-resources</phase>
465+
<goals>
466+
<goal>flatten</goal>
467+
</goals>
468+
</execution>
469+
<execution>
470+
<id>flatten.clean</id>
471+
<phase>clean</phase>
472+
<goals>
473+
<goal>clean</goal>
474+
</goals>
475+
</execution>
476+
</executions>
477+
</plugin>
478+
<!-- maven-gpg-plugin is used to sign Maven components. This is required when releasing libraries to Maven Central -->
479+
<plugin>
480+
<groupId>org.apache.maven.plugins</groupId>
481+
<artifactId>maven-gpg-plugin</artifactId>
482+
<version>1.6</version>
483+
<executions>
484+
<execution>
485+
<id>sign-artifacts</id>
486+
<phase>verify</phase>
487+
<goals>
488+
<goal>sign</goal>
489+
</goals>
490+
<!--
491+
This configuration helps with performing GPG operations non-interactively.
492+
For example when releasing via continuous integration.
493+
It is assumed that the GPG command used is version 2.x.
494+
-->
495+
<configuration>
496+
<gpgArguments>
497+
<arg>--pinentry-mode</arg>
498+
<arg>loopback</arg>
499+
</gpgArguments>
500+
<!-- Setting to allow retrieval of GPG passphrase from ~/.m2/settings.xml, refer to https://maven.apache.org/plugins/maven-gpg-plugin/usage.html -->
501+
<!--suppress MavenModelInspection -->
502+
<passphrase>${gpg.passphrase}</passphrase>
503+
</configuration>
504+
</execution>
505+
</executions>
506+
</plugin>
432507
</plugins>
433508

434509
<pluginManagement>

sdk/java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<groupId>dev.feast</groupId>
1313
<artifactId>feast-parent</artifactId>
14-
<version>0.3.6-SNAPSHOT</version>
14+
<version>${revision}</version>
1515
<relativePath>../..</relativePath>
1616
</parent>
1717

serving/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<parent>
2424
<groupId>dev.feast</groupId>
2525
<artifactId>feast-parent</artifactId>
26-
<version>0.3.6-SNAPSHOT</version>
26+
<version>${revision}</version>
2727
</parent>
2828

2929
<artifactId>feast-serving</artifactId>

0 commit comments

Comments
 (0)