Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish renamed java packages to maven central (via Sonatype) #2225

Merged
merged 5 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,39 @@ jobs:
python3 setup.py sdist bdist_wheel
python3 -m twine upload --verbose dist/*

# TODO(adchia): publish java sdk once maven repo is updated
# See https://github.com/feast-dev/feast-java/blob/master/.github/workflows/release.yml#L104
publish-java-sdk:
container: maven:3.6-jdk-11
runs-on: ubuntu-latest
needs: get-version
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'
java-package: jdk
architecture: x64
- uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-it-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-it-maven-
- name: Publish java sdk
env:
VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }}
GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
MAVEN_SETTINGS: ${{ secrets.MAVEN_SETTINGS }}
run: |
echo -n "$GPG_PUBLIC_KEY" > /root/public-key
echo -n "$GPG_PRIVATE_KEY" > /root/private-key
mkdir -p /root/.m2/
echo -n "$MAVEN_SETTINGS" > /root/.m2/settings.xml
infra/scripts/publish-java-sdk.sh --revision ${VERSION_WITHOUT_PREFIX} --gpg-key-import-dir /root
2 changes: 1 addition & 1 deletion infra/scripts/publish-java-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ gpg --import --batch --yes $GPG_KEY_IMPORT_DIR/private-key
echo "============================================================"
echo "Deploying Java SDK with revision: $REVISION"
echo "============================================================"
mvn -f java/pom.xml --projects datatypes/java,sdk/java -Drevision=$REVISION --batch-mode clean deploy
mvn -f java/pom.xml --projects .,datatypes/java,sdk/java -Drevision=$REVISION --batch-mode clean deploy
81 changes: 16 additions & 65 deletions java/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@
<dependencies>
<dependency>
<groupId>dev.feast</groupId>
<artifactId>datatypes-java</artifactId>
<artifactId>feast-datatypes</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>${protobuf.version}</version>
</dependency>

<dependency>
Expand All @@ -52,75 +53,34 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value-annotations</artifactId>
<version>${auto.value.version}</version>
</dependency>

<!-- JSON -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>io.gsonfire</groupId>
<artifactId>gson-fire</artifactId>
<version>${gson.fire.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>

<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>net.devh</groupId>
<artifactId>grpc-server-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.1.5.Final</version>
</dependency>

<!-- Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-resource-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
<version>2.10.1</version>
</dependency>

<!-- Logging -->
Expand All @@ -134,7 +94,6 @@
<version>0.3.1</version>
</dependency>

<!-- Bean Validation API support -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
Expand All @@ -156,35 +115,20 @@
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
<version>${hamcrest.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
Expand All @@ -206,6 +150,13 @@
<argLine>-Xms2048m -Xmx2048m -Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>
</project>
30 changes: 8 additions & 22 deletions java/common/src/main/java/feast/common/logging/AuditLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,23 @@
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
import org.slf4j.event.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.info.BuildProperties;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class AuditLogger {
private static final String FLUENTD_DESTINATION = "fluentd";
private static final Marker AUDIT_MARKER = MarkerFactory.getMarker("AUDIT_MARK");
private static FluentLogger fluentLogger;
private static AuditLogProperties properties;
private static BuildProperties buildProperties;
private static String artifact;
private static String version;

@Autowired
public AuditLogger(LoggingProperties loggingProperties, BuildProperties buildProperties) {
public AuditLogger(LoggingProperties loggingProperties, String artifact, String version) {
// Spring runs this constructor when creating the AuditLogger bean,
// which allows us to populate the AuditLogger class with dependencies.
// This allows us to use the dependencies in the AuditLogger's static methods
AuditLogger.properties = loggingProperties.getAudit();
AuditLogger.buildProperties = buildProperties;
AuditLogger.artifact = artifact;
AuditLogger.version = version;
if (AuditLogger.properties.getMessageLogging() != null
&& AuditLogger.properties.getMessageLogging().isEnabled()) {
AuditLogger.fluentLogger =
Expand All @@ -69,12 +66,7 @@ public AuditLogger(LoggingProperties loggingProperties, BuildProperties buildPro
* @param entryBuilder with all fields set except instance.
*/
public static void logMessage(Level level, MessageAuditLogEntry.Builder entryBuilder) {
log(
level,
entryBuilder
.setComponent(buildProperties.getArtifact())
.setVersion(buildProperties.getVersion())
.build());
log(level, entryBuilder.setComponent(artifact).setVersion(version).build());
}

/**
Expand All @@ -90,10 +82,7 @@ public static void logAction(
log(
level,
ActionAuditLogEntry.of(
buildProperties.getArtifact(),
buildProperties.getArtifact(),
LogResource.of(resourceType, resourceId),
action));
artifact, version, LogResource.of(resourceType, resourceId), action));
}

/**
Expand All @@ -109,10 +98,7 @@ public static void logTransition(
log(
level,
TransitionAuditLogEntry.of(
buildProperties.getArtifact(),
buildProperties.getArtifact(),
LogResource.of(resourceType, resourceId),
status));
artifact, version, LogResource.of(resourceType, resourceId), status));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,13 @@
import io.grpc.ServerInterceptor;
import io.grpc.Status;
import org.slf4j.event.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

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

Expand All @@ -50,7 +45,6 @@ public class GrpcMessageInterceptor implements ServerInterceptor {
*
* @param loggingProperties properties used to configure logging interceptor.
*/
@Autowired
public GrpcMessageInterceptor(LoggingProperties loggingProperties) {
this.loggingProperties = loggingProperties;
}
Expand Down Expand Up @@ -80,9 +74,7 @@ public <ReqT, RespT> Listener<ReqT> interceptCall(
entryBuilder.setMethod(fullMethodName.substring(fullMethodName.indexOf("/") + 1));

// Attempt Extract current authenticated identity.
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String identity = (authentication != null) ? getIdentity(authentication) : "";
entryBuilder.setIdentity(identity);
entryBuilder.setIdentity("");

// Register forwarding call to intercept outgoing response and log to audit log
call =
Expand Down Expand Up @@ -115,13 +107,4 @@ public void onMessage(ReqT message) {
}
};
}

/**
* Extract current authenticated identity from given {@link Authentication}. Extracts subject
* claim if specified in AuthorizationProperties, otherwise returns authentication subject.
*/
private String getIdentity(Authentication authentication) {
// use subject claim as identity if set in security authorization properties
return authentication.getName();
}
}
File renamed without changes.
1 change: 0 additions & 1 deletion java/datatypes/java/src/main/proto/feast

This file was deleted.

18 changes: 15 additions & 3 deletions java/datatypes/java/pom.xml → java/datatypes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<artifactId>datatypes-java</artifactId>
<artifactId>feast-datatypes</artifactId>

<parent>
<groupId>dev.feast</groupId>
<artifactId>feast-parent</artifactId>
<version>${revision}</version>
<relativePath>../..</relativePath>
<relativePath>../</relativePath>
</parent>

<build>
Expand Down Expand Up @@ -75,6 +75,13 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skipNexusStagingDeployMojo>false</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>

Expand All @@ -83,29 +90,34 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf.version}</version>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-services</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>${grpc.version}</version>
</dependency>

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
Expand Down
1 change: 1 addition & 0 deletions java/datatypes/src/main/proto/feast
Loading