Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jackjii79 committed Jan 26, 2024
1 parent 696dc9e commit c8d6a1f
Show file tree
Hide file tree
Showing 59 changed files with 2,517 additions and 825 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down Expand Up @@ -63,8 +63,7 @@ jobs:
- if: matrix.language == 'java'
name: Build Java
uses: gradle/gradle-build-action@v2
with:
arguments: assemble
run: ./gradlew --init-script init.gradle assemble

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
4 changes: 2 additions & 2 deletions .github/workflows/snyk-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: snyk/actions/setup@master
- uses: actions/setup-java@v3
with:
java-version: "8"
java-version: "17"
distribution: 'adopt'

- name: Snyk scan for Java dependencies
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
- uses: snyk/actions/setup@master
- uses: actions/setup-java@v3
with:
java-version: "8"
java-version: "17"
distribution: 'adopt'

- name: Snyk scan for Java dependencies - ${{ matrix.depsfiles }}
Expand Down
22 changes: 11 additions & 11 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import ai.h2o.ci.Utils

JAVA_IMAGE = 'harbor.h2o.ai/dockerhub-proxy/library/openjdk:8u222-jdk-slim'
JAVA_IMAGE = 'harbor.h2o.ai/dockerhub-proxy/library/openjdk:17-jdk-slim'
NODE_LABEL = 'docker'
DOCKERHUB_CREDS = 'dockerhub'
HARBOR_URL = "http://harbor.h2o.ai/"
Expand Down Expand Up @@ -43,9 +43,9 @@ pipeline {
description: 'Whether to also push distribution ZIP archive to S3.',
)
booleanParam(
name: 'PUSH_TO_VORVAN',
defaultValue: false,
description: 'Whether to also push Docker images to h2o.ai maintained gcr.io repo Vorvan.',
name: 'PUSH_TO_VORVAN',
defaultValue: false,
description: 'Whether to also push Docker images to h2o.ai maintained gcr.io repo Vorvan.',
)
}

Expand Down Expand Up @@ -76,7 +76,7 @@ pipeline {
script {
versionText = getVersion()
echo "Version: ${versionText}"
sh "./gradlew check"
sh "./gradlew --init-script init.gradle check"
}
}
}
Expand All @@ -100,7 +100,7 @@ pipeline {
steps {
timeout(time: 60, unit: 'MINUTES') {
script {
sh "./gradlew distributionZip"
sh "./gradlew --init-script init.gradle distributionZip"
if (isReleaseVersion(versionText)) {
utilsLib.appendBuildDescription("Release ${versionText}")
}
Expand Down Expand Up @@ -169,7 +169,7 @@ pipeline {
def imageTags = isMasterBranch() || isReleaseBranch() ? "${versionText},${gitCommitHash}" : "${gitCommitHash}"
withDockerCredentials(DOCKERHUB_CREDS, "FROM_") {
withDockerCredentials("harbor.h2o.ai", "TO_") {
sh "./gradlew jib \
sh "./gradlew --init-script init.gradle jib \
-Djib.to.auth.username=${TO_DOCKER_USERNAME} \
-Djib.to.auth.password=${TO_DOCKER_PASSWORD} \
-Djib.from.auth.username=${FROM_DOCKER_USERNAME} \
Expand Down Expand Up @@ -205,7 +205,7 @@ pipeline {
def imageTags = isMasterBranch() || isReleaseBranch() ? "${versionText},${gitCommitHash}" : "${gitCommitHash}"
withDockerCredentials(DOCKERHUB_CREDS, "FROM_") {
withDockerCredentials(DOCKERHUB_CREDS, "TO_") {
sh "./gradlew jib \
sh "./gradlew --init-script init.gradle jib \
-Djib.to.auth.username=${TO_DOCKER_USERNAME} \
-Djib.to.auth.password=${TO_DOCKER_PASSWORD} \
-Djib.from.auth.username=${FROM_DOCKER_USERNAME} \
Expand Down Expand Up @@ -242,7 +242,7 @@ pipeline {
withGCRCredentials(VORVAN_CRED) {
def gcrCreds = readFile("${GCR_JSON_KEY}")
withEnv(['TO_DOCKER_USERNAME=_json_key', "TO_DOCKER_PASSWORD=${gcrCreds}"]) {
sh "./gradlew jib \
sh "./gradlew --init-script init.gradle jib \
-Djib.from.auth.username=${FROM_DOCKER_USERNAME} \
-Djib.from.auth.password=${FROM_DOCKER_PASSWORD} \
-Djib.to.tags=${imageTags} \
Expand All @@ -264,8 +264,8 @@ pipeline {
*/
def getVersion() {
def version = sh(
script: "./gradlew -q -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false printVersion",
returnStdout: true).trim()
script: "./gradlew --init-script init.gradle -q -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false printVersion",
returnStdout: true).trim().tokenize("\n").last()
if (!version) {
error "Version must be set"
}
Expand Down
8 changes: 8 additions & 0 deletions aws-lambda-scorer/lambda-template/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
id 'org.springframework.boot'
}

apply from: project(":").file('gradle/java.gradle')

dependencies {
Expand All @@ -16,6 +20,10 @@ dependencies {
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine'
}

bootJar {
enabled=false
}

test {
useJUnitPlatform()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public final class MojoScorer {
private static final Object pipelineLock = new Object();
private static MojoPipeline pipeline;

private final ScoreRequestToMojoFrameConverter requestConverter
= new ScoreRequestToMojoFrameConverter();
private final MojoFrameToScoreResponseConverter responseConverter
= new MojoFrameToScoreResponseConverter();
private final ScoreRequestToMojoFrameConverter requestConverter =
new ScoreRequestToMojoFrameConverter();
private final MojoFrameToScoreResponseConverter responseConverter =
new MojoFrameToScoreResponseConverter();
private final RequestChecker requestChecker = new RequestChecker(new SampleRequestBuilder());

/** Processes a single {@link ScoreRequest} in the given AWS Lambda {@link Context}. */
Expand Down
4 changes: 2 additions & 2 deletions aws-sagemaker-hosted-scorer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ dependencies {
implementation group: 'io.springfox', name: 'springfox-boot-starter', version: springFoxVersion
implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '9.0.63'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: '9.0.63'
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: tomcatVersion
implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: tomcatVersion
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public MojoScorer mojoScorer(
ScoreRequestTransformer scoreRequestTransformer,
CsvToMojoFrameConverter csvConverter) {
return new MojoScorer(
requestConverter,
responseConverter,
contributionRequestConverter,
contributionResponseConverter,
modelInfoConverter,
scoreRequestTransformer,
csvConverter);
requestConverter,
responseConverter,
contributionRequestConverter,
contributionResponseConverter,
modelInfoConverter,
scoreRequestTransformer,
csvConverter);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -25,10 +24,9 @@
@Controller
public class ModelsApiController implements ModelApi {

private static final String UNIMPLEMENTED_MESSAGE
= "Shapley values are not implemented yet";
private static final List<CapabilityType> SUPPORTED_CAPABILITIES
= Arrays.asList(CapabilityType.SCORE);
private static final String UNIMPLEMENTED_MESSAGE = "Shapley values are not implemented yet";
private static final List<CapabilityType> SUPPORTED_CAPABILITIES =
Arrays.asList(CapabilityType.SCORE);
private static final Logger log = LoggerFactory.getLogger(ModelsApiController.class);

private final MojoScorer scorer;
Expand Down Expand Up @@ -101,8 +99,7 @@ public ResponseEntity<ScoreResponse> getScoreByFile(String file) {
}

@Override
public ResponseEntity<ContributionResponse> getContribution(
ContributionRequest request) {
public ResponseEntity<ContributionResponse> getContribution(ContributionRequest request) {
// TODO: to be implemented in the future
log.info(" Unsupported operation: " + UNIMPLEMENTED_MESSAGE);
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).build();
Expand Down
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ buildscript {
dependencies {
classpath group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin',
version: springBootPluginVersion
classpath group: 'gradle.plugin.org.hidetake', name: 'gradle-swagger-generator-plugin',
version: swaggerGradlePluginVersion
classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow',
classpath group: 'gradle.plugin.com.github.johnrengelman', name: 'shadow',
version: shadowJarVersion
// classpath group: 'com.diffplug.spotless', name: 'spotless-plugin-gradle', version: spotlessPluginVersion
classpath group: 'net.ltgt.gradle', name: 'gradle-errorprone-plugin',
version: errorpronePluginVersion
classpath group: 'com.google.cloud.tools.jib', name: 'com.google.cloud.tools.jib.gradle.plugin',
version: jibPluginVersion
classpath group: 'org.openapitools', name: 'openapi-generator-gradle-plugin',
version: openApiGeneratorGradlePluginVersion
}
}

Expand Down
3 changes: 3 additions & 0 deletions common/jdbc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ dependencies {
implementation group: 'org.apache.spark', name: 'spark-sql_2.12'
implementation group: 'org.apache.spark', name: 'spark-mllib_2.12'
implementation group: 'com.typesafe', name:'config'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36'
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.13'
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.0.13'

testImplementation group: 'org.scalatest', name: 'scalatest_2.12', version: '3.0.5'
testRuntimeOnly group:'org.scala-lang.modules', name: 'scala-xml_2.12', version: '1.1.1'
Expand Down
59 changes: 36 additions & 23 deletions common/rest-java-model/build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,48 @@
plugins {
id 'org.hidetake.swagger.generator'
id 'org.springframework.boot'
id 'org.openapi.generator'
}
apply from: project(":").file('gradle/java.gradle')

dependencies {
implementation group: 'com.google.code.gson', name: 'gson'
implementation group: 'javax.annotation', name: 'javax.annotation-api'
implementation group: 'io.swagger.core.v3', name: 'swagger-annotations'
swaggerCodegen group: 'io.swagger.codegen.v3', name: 'swagger-codegen-cli'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.openapitools', name: 'jackson-databind-nullable'
}

swaggerSources {
model {
inputFile = file('../swagger/v1/swagger.yaml')
code {
language = 'java'
configFile = file('../swagger/v1/swagger_codegen.json')
components = [models: true]
dependsOn validation
}
}
modelV1Exp {
inputFile = file('../swagger/v1exp/swagger.yaml')
code {
language = 'java'
configFile = file('../swagger/v1exp/swagger_codegen.json')
components = [models: true]
dependsOn validation
openApiValidate {
inputSpec = "$rootDir/common/swagger/v1openapi3/swagger.json"
recommend = true
}

openApiGenerate {
generatorName = 'spring'
packageName = "ai.h2o.mojos.deploy.common.rest"
invokerPackage = "ai.h2o.mojos.deploy.common.rest"
inputSpec = "$rootDir/common/swagger/v1openapi3/swagger.json"
outputDir = "$buildDir/gen"
globalProperties.set([
"skipFormModel": "false",
])
configOptions.set([
"useSpringBoot3": "true",
"interfaceOnly": "true",
"basePackage": "ai.h2o.mojos.deploy.common.rest",
"modelPackage": "ai.h2o.mojos.deploy.common.rest.model",
])
}

bootJar {
enabled=false
}

compileJava.dependsOn tasks.openApiValidate, tasks.openApiGenerate
sourceSets {
main {
java {
srcDir("$buildDir/gen/src/main/java")
}
}
}

compileJava.dependsOn swaggerSources.model.code, swaggerSources.modelV1Exp.code
sourceSets.main.java.srcDirs "${swaggerSources.model.code.outputDir}/src/main/java", "${swaggerSources.modelV1Exp.code.outputDir}/src/main/java"
41 changes: 27 additions & 14 deletions common/rest-jdbc-spring-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
plugins {
id 'org.springframework.boot'
id 'org.hidetake.swagger.generator'
id 'org.openapi.generator'
}
apply from: project(":").file('gradle/java.gradle')

dependencies {
implementation group: 'io.swagger.core.v3', name: 'swagger-annotations'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
swaggerCodegen group: 'io.swagger.codegen.v3', name: 'swagger-codegen-cli'
implementation group: 'org.openapitools', name: 'jackson-databind-nullable'
}

swaggerSources {
api {
inputFile = file('../swagger/v1/jdbc-swagger.yaml')
code {
language = 'spring'
configFile = file('../swagger/v1/jdbc_swagger_codegen.json')
components = [models: true, apis: true]
dependsOn validation
}
}
openApiValidate {
inputSpec = "$rootDir/common/swagger/v1/jdbc_swagger.json"
recommend = true
}

openApiGenerate {
generatorName = 'spring'
inputSpec = "$rootDir/common/swagger/v1/jdbc_swagger.json"
outputDir = "$buildDir/gen"
configOptions.set([
"useSpringBoot3": "true",
"interfaceOnly": "true",
"basePackage": "ai.h2o.mojos.deploy.common.rest.jdbc",
"configPackage": "ai.h2o.mojos.deploy.common.rest.jdbc.config",
"apiPackage": "ai.h2o.mojos.deploy.common.rest.jdbc.api",
"modelPackage": "ai.h2o.mojos.deploy.common.rest.jdbc.model",
])
}

jar {
Expand All @@ -32,5 +39,11 @@ bootJar {
enabled=false
}

compileJava.dependsOn swaggerSources.api.code
sourceSets.main.java.srcDir "${swaggerSources.api.code.outputDir}/src/main/java"
compileJava.dependsOn tasks.openApiValidate, tasks.openApiGenerate
sourceSets {
main {
java {
srcDir("$buildDir/gen/src/main/java")
}
}
}
Loading

0 comments on commit c8d6a1f

Please sign in to comment.