Skip to content
This repository was archived by the owner on Nov 10, 2022. It is now read-only.

Commit 428c145

Browse files
authored
Publish renamed java packages to maven central (via Sonatype) (feast-dev#2225)
* new artifact names Signed-off-by: pyalex <[email protected]> * clean up dependencies Signed-off-by: pyalex <[email protected]> * better names & cleaner structure Signed-off-by: pyalex <[email protected]> * return assertion import Signed-off-by: pyalex <[email protected]> * bump version Signed-off-by: pyalex <[email protected]>
1 parent f5912c8 commit 428c145

File tree

29 files changed

+172
-745
lines changed

29 files changed

+172
-745
lines changed

.github/workflows/release.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,39 @@ jobs:
144144
python3 setup.py sdist bdist_wheel
145145
python3 -m twine upload --verbose dist/*
146146
147-
# TODO(adchia): publish java sdk once maven repo is updated
148-
# See https://github.com/feast-dev/feast-java/blob/master/.github/workflows/release.yml#L104
147+
publish-java-sdk:
148+
container: maven:3.6-jdk-11
149+
runs-on: ubuntu-latest
150+
needs: get-version
151+
steps:
152+
- uses: actions/checkout@v2
153+
with:
154+
submodules: 'true'
155+
- name: Set up JDK 11
156+
uses: actions/setup-java@v1
157+
with:
158+
java-version: '11'
159+
java-package: jdk
160+
architecture: x64
161+
- uses: actions/setup-python@v2
162+
with:
163+
python-version: '3.7'
164+
architecture: 'x64'
165+
- uses: actions/cache@v2
166+
with:
167+
path: ~/.m2/repository
168+
key: ${{ runner.os }}-it-maven-${{ hashFiles('**/pom.xml') }}
169+
restore-keys: |
170+
${{ runner.os }}-it-maven-
171+
- name: Publish java sdk
172+
env:
173+
VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }}
174+
GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
175+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
176+
MAVEN_SETTINGS: ${{ secrets.MAVEN_SETTINGS }}
177+
run: |
178+
echo -n "$GPG_PUBLIC_KEY" > /root/public-key
179+
echo -n "$GPG_PRIVATE_KEY" > /root/private-key
180+
mkdir -p /root/.m2/
181+
echo -n "$MAVEN_SETTINGS" > /root/.m2/settings.xml
182+
infra/scripts/publish-java-sdk.sh --revision ${VERSION_WITHOUT_PREFIX} --gpg-key-import-dir /root

infra/scripts/publish-java-sdk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ gpg --import --batch --yes $GPG_KEY_IMPORT_DIR/private-key
6969
echo "============================================================"
7070
echo "Deploying Java SDK with revision: $REVISION"
7171
echo "============================================================"
72-
mvn -f java/pom.xml --projects datatypes/java,sdk/java -Drevision=$REVISION --batch-mode clean deploy
72+
mvn -f java/pom.xml --projects .,datatypes/java,sdk/java -Drevision=$REVISION --batch-mode clean deploy

java/common/pom.xml

Lines changed: 16 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@
3333
<dependencies>
3434
<dependency>
3535
<groupId>dev.feast</groupId>
36-
<artifactId>datatypes-java</artifactId>
36+
<artifactId>feast-datatypes</artifactId>
3737
<version>${project.version}</version>
3838
<scope>compile</scope>
3939
</dependency>
4040
<dependency>
4141
<groupId>com.google.protobuf</groupId>
4242
<artifactId>protobuf-java-util</artifactId>
43+
<version>${protobuf.version}</version>
4344
</dependency>
4445

4546
<dependency>
@@ -52,75 +53,34 @@
5253
<dependency>
5354
<groupId>org.projectlombok</groupId>
5455
<artifactId>lombok</artifactId>
56+
<version>${lombok.version}</version>
5557
</dependency>
5658
<dependency>
5759
<groupId>com.google.auto.value</groupId>
5860
<artifactId>auto-value-annotations</artifactId>
61+
<version>${auto.value.version}</version>
5962
</dependency>
6063

6164
<!-- JSON -->
6265
<dependency>
6366
<groupId>com.google.code.gson</groupId>
6467
<artifactId>gson</artifactId>
68+
<version>${gson.version}</version>
6569
</dependency>
6670
<dependency>
6771
<groupId>io.gsonfire</groupId>
6872
<artifactId>gson-fire</artifactId>
73+
<version>${gson.fire.version}</version>
6974
</dependency>
7075
<dependency>
7176
<groupId>com.fasterxml.jackson.core</groupId>
7277
<artifactId>jackson-databind</artifactId>
78+
<version>2.10.1</version>
7379
</dependency>
7480
<dependency>
7581
<groupId>com.fasterxml.jackson.datatype</groupId>
7682
<artifactId>jackson-datatype-jsr310</artifactId>
77-
</dependency>
78-
79-
<!-- Spring -->
80-
<dependency>
81-
<groupId>org.springframework</groupId>
82-
<artifactId>spring-context-support</artifactId>
83-
</dependency>
84-
<dependency>
85-
<groupId>net.devh</groupId>
86-
<artifactId>grpc-server-spring-boot-starter</artifactId>
87-
<exclusions>
88-
<exclusion>
89-
<groupId>org.springframework.boot</groupId>
90-
<artifactId>spring-boot-starter-logging</artifactId>
91-
</exclusion>
92-
</exclusions>
93-
</dependency>
94-
<dependency>
95-
<groupId>org.springframework.boot</groupId>
96-
<artifactId>spring-boot-starter-data-jpa</artifactId>
97-
</dependency>
98-
<dependency>
99-
<groupId>org.springframework.boot</groupId>
100-
<artifactId>spring-boot-starter-web</artifactId>
101-
</dependency>
102-
<dependency>
103-
<groupId>org.hibernate.validator</groupId>
104-
<artifactId>hibernate-validator</artifactId>
105-
<version>6.1.5.Final</version>
106-
</dependency>
107-
108-
<!-- Security -->
109-
<dependency>
110-
<groupId>org.springframework.security</groupId>
111-
<artifactId>spring-security-core</artifactId>
112-
</dependency>
113-
<dependency>
114-
<groupId>org.springframework.security</groupId>
115-
<artifactId>spring-security-config</artifactId>
116-
</dependency>
117-
<dependency>
118-
<groupId>org.springframework.security</groupId>
119-
<artifactId>spring-security-oauth2-resource-server</artifactId>
120-
</dependency>
121-
<dependency>
122-
<groupId>org.springframework.security</groupId>
123-
<artifactId>spring-security-oauth2-jose</artifactId>
83+
<version>2.10.1</version>
12484
</dependency>
12585

12686
<!-- Logging -->
@@ -134,7 +94,6 @@
13494
<version>0.3.1</version>
13595
</dependency>
13696

137-
<!-- Bean Validation API support -->
13897
<dependency>
13998
<groupId>javax.xml.bind</groupId>
14099
<artifactId>jaxb-api</artifactId>
@@ -156,35 +115,20 @@
156115
<groupId>org.hamcrest</groupId>
157116
<artifactId>hamcrest-library</artifactId>
158117
<scope>test</scope>
118+
<version>${hamcrest.version}</version>
159119
</dependency>
160120

161121
<dependency>
162122
<groupId>junit</groupId>
163123
<artifactId>junit</artifactId>
164124
<version>4.13.2</version>
165125
</dependency>
166-
<dependency>
167-
<groupId>org.springframework</groupId>
168-
<artifactId>spring-test</artifactId>
169-
<scope>test</scope>
170-
</dependency>
171126
<dependency>
172127
<groupId>org.mockito</groupId>
173128
<artifactId>mockito-core</artifactId>
174129
<version>${mockito.version}</version>
175130
<scope>test</scope>
176131
</dependency>
177-
<dependency>
178-
<groupId>org.springframework.boot</groupId>
179-
<artifactId>spring-boot-starter-test</artifactId>
180-
<scope>test</scope>
181-
<exclusions>
182-
<exclusion>
183-
<groupId>org.junit.vintage</groupId>
184-
<artifactId>junit-vintage-engine</artifactId>
185-
</exclusion>
186-
</exclusions>
187-
</dependency>
188132
</dependencies>
189133
<build>
190134
<plugins>
@@ -206,6 +150,13 @@
206150
<argLine>-Xms2048m -Xmx2048m -Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
207151
</configuration>
208152
</plugin>
153+
<plugin>
154+
<groupId>org.sonatype.plugins</groupId>
155+
<artifactId>nexus-staging-maven-plugin</artifactId>
156+
<configuration>
157+
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
158+
</configuration>
159+
</plugin>
209160
</plugins>
210161
</build>
211162
</project>

java/common/src/main/java/feast/common/logging/AuditLogger.java

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,23 @@
3232
import org.slf4j.Marker;
3333
import org.slf4j.MarkerFactory;
3434
import org.slf4j.event.Level;
35-
import org.springframework.beans.factory.annotation.Autowired;
36-
import org.springframework.boot.info.BuildProperties;
37-
import org.springframework.stereotype.Component;
3835

3936
@Slf4j
40-
@Component
4137
public class AuditLogger {
4238
private static final String FLUENTD_DESTINATION = "fluentd";
4339
private static final Marker AUDIT_MARKER = MarkerFactory.getMarker("AUDIT_MARK");
4440
private static FluentLogger fluentLogger;
4541
private static AuditLogProperties properties;
46-
private static BuildProperties buildProperties;
42+
private static String artifact;
43+
private static String version;
4744

48-
@Autowired
49-
public AuditLogger(LoggingProperties loggingProperties, BuildProperties buildProperties) {
45+
public AuditLogger(LoggingProperties loggingProperties, String artifact, String version) {
5046
// Spring runs this constructor when creating the AuditLogger bean,
5147
// which allows us to populate the AuditLogger class with dependencies.
5248
// This allows us to use the dependencies in the AuditLogger's static methods
5349
AuditLogger.properties = loggingProperties.getAudit();
54-
AuditLogger.buildProperties = buildProperties;
50+
AuditLogger.artifact = artifact;
51+
AuditLogger.version = version;
5552
if (AuditLogger.properties.getMessageLogging() != null
5653
&& AuditLogger.properties.getMessageLogging().isEnabled()) {
5754
AuditLogger.fluentLogger =
@@ -69,12 +66,7 @@ public AuditLogger(LoggingProperties loggingProperties, BuildProperties buildPro
6966
* @param entryBuilder with all fields set except instance.
7067
*/
7168
public static void logMessage(Level level, MessageAuditLogEntry.Builder entryBuilder) {
72-
log(
73-
level,
74-
entryBuilder
75-
.setComponent(buildProperties.getArtifact())
76-
.setVersion(buildProperties.getVersion())
77-
.build());
69+
log(level, entryBuilder.setComponent(artifact).setVersion(version).build());
7870
}
7971

8072
/**
@@ -90,10 +82,7 @@ public static void logAction(
9082
log(
9183
level,
9284
ActionAuditLogEntry.of(
93-
buildProperties.getArtifact(),
94-
buildProperties.getArtifact(),
95-
LogResource.of(resourceType, resourceId),
96-
action));
85+
artifact, version, LogResource.of(resourceType, resourceId), action));
9786
}
9887

9988
/**
@@ -109,10 +98,7 @@ public static void logTransition(
10998
log(
11099
level,
111100
TransitionAuditLogEntry.of(
112-
buildProperties.getArtifact(),
113-
buildProperties.getArtifact(),
114-
LogResource.of(resourceType, resourceId),
115-
status));
101+
artifact, version, LogResource.of(resourceType, resourceId), status));
116102
}
117103

118104
/**

java/common/src/main/java/feast/common/logging/interceptors/GrpcMessageInterceptor.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,13 @@
3030
import io.grpc.ServerInterceptor;
3131
import io.grpc.Status;
3232
import org.slf4j.event.Level;
33-
import org.springframework.beans.factory.annotation.Autowired;
34-
import org.springframework.security.core.Authentication;
35-
import org.springframework.security.core.context.SecurityContextHolder;
36-
import org.springframework.stereotype.Component;
3733

3834
/**
3935
* GrpcMessageInterceptor intercepts a GRPC calls to log handling of GRPC messages to the Audit Log.
4036
* Intercepts the incoming and outgoing messages logs them to the audit log, together with method
4137
* name and assumed authenticated identity (if authentication is enabled). NOTE:
4238
* GrpcMessageInterceptor assumes that all service calls are unary (ie single request/response).
4339
*/
44-
@Component
4540
public class GrpcMessageInterceptor implements ServerInterceptor {
4641
private LoggingProperties loggingProperties;
4742

@@ -50,7 +45,6 @@ public class GrpcMessageInterceptor implements ServerInterceptor {
5045
*
5146
* @param loggingProperties properties used to configure logging interceptor.
5247
*/
53-
@Autowired
5448
public GrpcMessageInterceptor(LoggingProperties loggingProperties) {
5549
this.loggingProperties = loggingProperties;
5650
}
@@ -80,9 +74,7 @@ public <ReqT, RespT> Listener<ReqT> interceptCall(
8074
entryBuilder.setMethod(fullMethodName.substring(fullMethodName.indexOf("/") + 1));
8175

8276
// Attempt Extract current authenticated identity.
83-
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
84-
String identity = (authentication != null) ? getIdentity(authentication) : "";
85-
entryBuilder.setIdentity(identity);
77+
entryBuilder.setIdentity("");
8678

8779
// Register forwarding call to intercept outgoing response and log to audit log
8880
call =
@@ -115,13 +107,4 @@ public void onMessage(ReqT message) {
115107
}
116108
};
117109
}
118-
119-
/**
120-
* Extract current authenticated identity from given {@link Authentication}. Extracts subject
121-
* claim if specified in AuthorizationProperties, otherwise returns authentication subject.
122-
*/
123-
private String getIdentity(Authentication authentication) {
124-
// use subject claim as identity if set in security authorization properties
125-
return authentication.getName();
126-
}
127110
}
File renamed without changes.

java/datatypes/java/src/main/proto/feast

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
<maven.compiler.source>11</maven.compiler.source>
3131
<maven.compiler.target>11</maven.compiler.target>
3232
</properties>
33-
<artifactId>datatypes-java</artifactId>
33+
<artifactId>feast-datatypes</artifactId>
3434

3535
<parent>
3636
<groupId>dev.feast</groupId>
3737
<artifactId>feast-parent</artifactId>
3838
<version>${revision}</version>
39-
<relativePath>../..</relativePath>
39+
<relativePath>../</relativePath>
4040
</parent>
4141

4242
<build>
@@ -75,6 +75,13 @@
7575
</execution>
7676
</executions>
7777
</plugin>
78+
<plugin>
79+
<groupId>org.sonatype.plugins</groupId>
80+
<artifactId>nexus-staging-maven-plugin</artifactId>
81+
<configuration>
82+
<skipNexusStagingDeployMojo>false</skipNexusStagingDeployMojo>
83+
</configuration>
84+
</plugin>
7885
</plugins>
7986
</build>
8087

@@ -83,29 +90,34 @@
8390
<dependency>
8491
<groupId>com.google.guava</groupId>
8592
<artifactId>guava</artifactId>
93+
<version>${guava.version}</version>
8694
</dependency>
8795
<dependency>
8896
<groupId>com.google.protobuf</groupId>
8997
<artifactId>protobuf-java</artifactId>
98+
<version>${protobuf.version}</version>
9099
</dependency>
91100

92101
<dependency>
93102
<groupId>io.grpc</groupId>
94103
<artifactId>grpc-core</artifactId>
104+
<version>${grpc.version}</version>
95105
</dependency>
96106
<dependency>
97107
<groupId>io.grpc</groupId>
98108
<artifactId>grpc-protobuf</artifactId>
109+
<version>${grpc.version}</version>
99110
</dependency>
100111
<dependency>
101112
<groupId>io.grpc</groupId>
102113
<artifactId>grpc-services</artifactId>
114+
<version>${grpc.version}</version>
103115
</dependency>
104116
<dependency>
105117
<groupId>io.grpc</groupId>
106118
<artifactId>grpc-stub</artifactId>
119+
<version>${grpc.version}</version>
107120
</dependency>
108-
109121
<dependency>
110122
<groupId>javax.annotation</groupId>
111123
<artifactId>javax.annotation-api</artifactId>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../protos/feast

0 commit comments

Comments
 (0)