Skip to content

Commit

Permalink
Merge branch 'main' into nexcalmart/nginx-unprivileged
Browse files Browse the repository at this point in the history
  • Loading branch information
nexcalmart authored Dec 4, 2023
2 parents 1219c7f + 8b463fa commit 59db2bb
Show file tree
Hide file tree
Showing 769 changed files with 11,789 additions and 20,312 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ secrets
updated_configurations
!airbyte-integrations/connector-templates/**/secrets

# include airbyte-data
!airbyte-data/src/main/java/io/airbyte/data

# Test logs
acceptance_tests_logs

Expand Down
23 changes: 0 additions & 23 deletions airbyte-analytics/build.gradle

This file was deleted.

23 changes: 23 additions & 0 deletions airbyte-analytics/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plugins {
id("io.airbyte.gradle.jvm.lib")
id("io.airbyte.gradle.publish")
}

dependencies {
api(libs.segment.java.analytics)
api(libs.micronaut.http)

implementation(libs.bundles.jackson)
implementation(libs.guava)

implementation(project(":airbyte-commons"))
implementation(project(":airbyte-config:config-models"))
implementation(project(":airbyte-config:config-persistence"))
implementation(project(":airbyte-data"))
implementation(project(":airbyte-json-validation"))

testRuntimeOnly(libs.junit.jupiter.engine)
testImplementation(libs.bundles.junit)
testImplementation(libs.assertj.core)
testImplementation(libs.junit.pioneer)
}
86 changes: 0 additions & 86 deletions airbyte-api-server/build.gradle

This file was deleted.

93 changes: 93 additions & 0 deletions airbyte-api-server/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import java.util.Properties

plugins {
id("io.airbyte.gradle.jvm.app")
id("io.airbyte.gradle.jvm.lib")
id("io.airbyte.gradle.publish")
id("io.airbyte.gradle.docker")
kotlin("jvm")
kotlin("kapt")
}

dependencies {
implementation("org.apache.logging.log4j:log4j-slf4j2-impl")

kapt(platform(libs.micronaut.bom))
kapt(libs.bundles.micronaut.annotation.processor)

kaptTest(platform(libs.micronaut.bom))
kaptTest(libs.bundles.micronaut.test.annotation.processor)

annotationProcessor(platform(libs.micronaut.bom))
annotationProcessor(libs.bundles.micronaut.annotation.processor)
annotationProcessor(libs.micronaut.jaxrs.processor)

implementation(project(":airbyte-analytics"))
implementation(project(":airbyte-api"))
implementation(project(":airbyte-commons"))
implementation(project(":airbyte-config:config-models"))
implementation("com.cronutils:cron-utils:9.2.1")
implementation(libs.bundles.jackson)

implementation(platform(libs.micronaut.bom))
implementation(libs.bundles.micronaut)
implementation(libs.bundles.micronaut.data.jdbc)
implementation(libs.micronaut.jaxrs.server)
implementation(libs.micronaut.problem.json)
implementation(libs.micronaut.security)

implementation(libs.sentry.java)
implementation(libs.swagger.annotations)
implementation(libs.javax.ws.rs.api)

runtimeOnly(libs.javax.databind)

testImplementation(libs.bundles.micronaut.test)
testAnnotationProcessor(platform(libs.micronaut.bom))
testAnnotationProcessor(libs.bundles.micronaut.test.annotation.processor)

testImplementation(project(":airbyte-test-utils"))
testImplementation(libs.bundles.micronaut.test)
testImplementation(libs.postgresql)
testImplementation(libs.platform.testcontainers.postgresql)
testImplementation(libs.mockwebserver)
testImplementation(libs.mockito.inline)

implementation(libs.airbyte.protocol)
}

kapt {
correctErrorTypes = true
}

val env = Properties().apply {
load(rootProject.file(".env.dev").inputStream())
}

airbyte {
application {
mainClass = "io.airbyte.api.server.ApplicationKt"
defaultJvmArgs = listOf("-XX:+ExitOnOutOfMemoryError", "-XX:MaxRAMPercentage=75.0")

@Suppress("UNCHECKED_CAST")
localEnvVars.putAll(env.toMutableMap() as Map<String, String>)
localEnvVars.putAll(mapOf(
"AIRBYTE_ROLE" to (System.getenv("AIRBYTE_ROLE") ?: "undefined"),
"AIRBYTE_VERSION" to env["VERSION"].toString(),
"MICRONAUT_ENVIRONMENTS" to "control-plane",
"SERVICE_NAME" to project.name,
"TRACKING_STRATEGY" to env["TRACKING_STRATEGY"].toString(),
))
}
docker {
imageName = "airbyte-api-server"
}
}

tasks.named<Test>("test") {
environment(mapOf(
"AIRBYTE_VERSION" to env["VERSION"],
"MICRONAUT_ENVIRONMENTS" to "test",
"SERVICE_NAME" to project.name,
))
}
29 changes: 24 additions & 5 deletions airbyte-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ import dev.failsafe.okhttp.FailsafeCall'''
}
apiClientFile.write(apiClientFileText)

// Update domain clients to use Failesafe

updateDomainClientsWithFailsafe('build/generated/api/client2/src/main/kotlin/io/airbyte/api/client2/generated')
}
}
Expand Down Expand Up @@ -267,8 +267,11 @@ def genWorkloadApiClient = tasks.register("genWorkloadApiClient", GenerateTask)
doLast {
// Delete file generated by the client2 task
def dir = file('build/generated/workloadapi/client/src/main/kotlin/org').deleteDir()
// Update domain clients to use Failsafe
updateDomainClientsWithFailsafe('build/generated/workloadapi/client/src/main/kotlin/io/airbyte/workload/api/client/generated')

def generatedDomainClientsPath = 'build/generated/workloadapi/client/src/main/kotlin/io/airbyte/workload/api/client/generated'
updateDomainClientsWithFailsafe(generatedDomainClientsPath)
// the kotlin client (as opposed to the java client) doesn't include the response body in the exception message.
updateDomainClientsToIncludeHttpResponseBodyOnClientException(generatedDomainClientsPath)
}

dependsOn(':airbyte-workload-api-server:compileKotlin', 'genApiClient2')
Expand Down Expand Up @@ -333,7 +336,7 @@ sourceSets {
"$buildDir/generated/api/client/src/main/java",
"$buildDir/generated/api/client2/src/main/kotlin",
"$buildDir/generated/workloadapi/client/src/main/kotlin"
"$projectDir/src/main/java"
"$projectDir/src/main/java"
}
resources {
srcDir "$projectDir/src/main/openapi/"
Expand Down Expand Up @@ -373,7 +376,23 @@ private def updateDomainClientsWithFailsafe(def clientPath) {
def newImports = "import dev.failsafe.RetryPolicy"
domainClientFileText = domainClientFileText.replaceFirst('import ', newImports + '\nimport ')
}

domainClient.write(domainClientFileText)
}
}
}
}

private def updateDomainClientsToIncludeHttpResponseBodyOnClientException(def clientPath) {
def dir = file(clientPath)
dir.eachFile { domainClient ->
if (domainClient.name.endsWith('.kt')) {
def domainClientFileText = domainClient.text

domainClientFileText = domainClientFileText.replace(
'throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)',
'throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()} ${localVarError.body ?: ""}", localVarError.statusCode, localVarResponse)')

domainClient.write(domainClientFileText)
}
}
}
Loading

0 comments on commit 59db2bb

Please sign in to comment.