Skip to content

Commit

Permalink
Merge master to branch
Browse files Browse the repository at this point in the history
  • Loading branch information
lazebnyi committed Nov 12, 2024
2 parents b331b99 + a6fe0dc commit 5ed7af1
Show file tree
Hide file tree
Showing 2,082 changed files with 296,236 additions and 73,121 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/community_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ jobs:
uses: ./.github/actions/run-airbyte-ci
with:
context: "pull_request"
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_CACHE_4 }}
docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
gcp_gsm_credentials: ${{ secrets.GCP_GSM_CREDENTIALS }}
Expand Down Expand Up @@ -237,7 +236,6 @@ jobs:
uses: ./.github/actions/run-airbyte-ci
with:
context: "pull_request"
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_CACHE_4 }}
docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
gcp_gsm_credentials: ${{ secrets.GCP_GSM_CREDENTIALS }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/connectors_up_to_date.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ jobs:
sentry_dsn: ${{ secrets.SENTRY_AIRBYTE_CI_DSN }}
s3_build_cache_access_key_id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }}
s3_build_cache_secret_key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }}
subcommand: 'connectors --concurrency=10 --language=python --language=low-code --support-level=community --support-level=certified --metadata-query="\"source-declarative-manifest\" not in data.dockerRepository" --metadata-query="\"-rc.\" not in data.dockerImageTag" up-to-date --ignore-connector=source-declarative-manifest --create-prs --auto-merge'
subcommand: 'connectors --concurrency=10 --language=python --language=low-code --support-level=community --support-level=certified --metadata-query="\"source-declarative-manifest\" not in data.dockerRepository" --metadata-query="\"-rc.\" not in data.dockerImageTag" up-to-date --create-prs --auto-merge'
2 changes: 1 addition & 1 deletion .github/workflows/connectors_version_increment_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
name: Connectors Version Increment Check
runs-on: connector-test-large
if: github.event.pull_request.head.repo.fork != true
timeout-minutes: 12
timeout-minutes: 22
steps:
- name: Checkout Airbyte
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/live_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
uses: ./.github/actions/run-airbyte-ci
with:
context: "manual"
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_CACHE_4 }}
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_CACHE_3 }}
docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
gcp_gsm_credentials: ${{ secrets.GCP_GSM_CREDENTIALS }}
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/publish-bulk-cdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,6 @@ jobs:
gradle-distribution-sha-256-sum-warning: false
arguments: --scan :airbyte-cdk:bulk:bulkCdkBuild

- name: Integration test Bulk CDK
uses: burrunan/gradle-cache-action@v1
env:
CI: true
with:
read-only: true
job-id: bulk-cdk-publish
concurrent: true
gradle-distribution-sha-256-sum-warning: false
arguments: --scan :airbyte-cdk:bulk:bulkCdkIntegrationTest

- name: Publish Poms and Jars to CloudRepo
uses: burrunan/gradle-cache-action@v1
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_connectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: ./.github/actions/run-airbyte-ci
with:
context: "master"
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_CACHE_3 }}
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_CACHE_4 }}
docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
gcp_gsm_credentials: ${{ secrets.GCP_GSM_CREDENTIALS }}
Expand All @@ -53,7 +53,7 @@ jobs:
uses: ./.github/actions/run-airbyte-ci
with:
context: "manual"
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_CACHE_3 }}
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_CACHE_4 }}
docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
gcp_gsm_credentials: ${{ secrets.GCP_GSM_CREDENTIALS }}
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/python-cdk-pdoc-generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Python CDK: Generate Docs"

on:
push:
branches:
- main
pull_request: {}

jobs:
preview_docs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Poetry
uses: Gr1N/setup-poetry@v9
with:
poetry-version: "1.7.1"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"

- name: Install dependencies
run: cd airbyte-cdk/python && poetry install --all-extras

- name: Generate documentation
run: |
cd airbyte-cdk/python && poetry run poe docs-generate
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: "docs-generated"
path: "airbyte-cdk/python/docs/generated"
2 changes: 1 addition & 1 deletion .github/workflows/regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
uses: ./.github/actions/run-airbyte-ci
with:
context: "manual"
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_CACHE_4 }}
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN_CACHE_3 }}
docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
gcp_gsm_credentials: ${{ secrets.GCP_GSM_CREDENTIALS }}
Expand Down
4 changes: 0 additions & 4 deletions airbyte-cdk/bulk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ allprojects {
}
}

tasks.register('bulkCdkIntegrationTest').configure {
dependsOn allprojects.collect {it.tasks.matching { it.name == 'integrationTest' }}
}

if (buildNumberFile.exists()) {
tasks.register('bulkCdkBuild').configure {
dependsOn allprojects.collect {it.tasks.named('build')}
Expand Down
4 changes: 4 additions & 0 deletions airbyte-cdk/bulk/core/base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ dependencies {
testFixturesApi 'io.micronaut.test:micronaut-test-junit5:4.5.0'
testFixturesApi 'io.github.deblockt:json-diff:1.1.0'
}

test {
environment "PRESENT", "present-value"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import io.airbyte.cdk.ssh.SshTunnelMethodConfiguration
interface SshTunnelConfiguration {
val realHost: String
val realPort: Int
val sshTunnel: SshTunnelMethodConfiguration
val sshTunnel: SshTunnelMethodConfiguration?
val sshConnectionOptions: SshConnectionOptions
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internal constructor(
/** Creates an open [TunnelSession]. */
fun createTunnelSession(
remote: SshdSocketAddress,
sshTunnel: SshTunnelMethodConfiguration,
sshTunnel: SshTunnelMethodConfiguration?,
connectionOptions: SshConnectionOptions,
): TunnelSession {
if (sshTunnel is SshNoTunnelMethod) {
Expand All @@ -62,7 +62,8 @@ fun createTunnelSession(
log.info { "Creating SSH client session." }
val connectFuture: ConnectFuture =
when (sshTunnel) {
SshNoTunnelMethod -> TODO("unreachable code")
SshNoTunnelMethod,
null -> TODO("unreachable code")
is SshKeyAuthTunnelMethod ->
client.connect(sshTunnel.user.trim(), sshTunnel.host.trim(), sshTunnel.port)
is SshPasswordAuthTunnelMethod ->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
airbyte:
file-transfer:
enabled: ${USE_FILE_TRANSFER:false}
staging-path: ${AIRBYTE_STAGING_DIRECTORY:/staging/files}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2024 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.cdk.initialization

import io.micronaut.context.annotation.Bean
import io.micronaut.context.annotation.Factory
import io.micronaut.context.annotation.Value
import io.micronaut.test.extensions.junit5.annotation.MicronautTest
import jakarta.inject.Inject
import kotlin.test.assertEquals
import org.junit.jupiter.api.Test

@MicronautTest
class TestApplicationYaml {
@Inject lateinit var defaultValueBean: DefaultValueBean

@Test
fun testMainDefaultValue() {
assertEquals("/staging/files", defaultValueBean.stagingFolder)
assertEquals(false, defaultValueBean.fileTransferEnable)
}
}

data class DefaultValueBean(
val stagingFolder: String,
val fileTransferEnable: Boolean,
)

@Factory
class TestFactory {
@Bean
fun defaultValueBean(
@Value("\${airbyte.file-transfer.staging-path}") stagingFolder: String,
@Value("\${airbyte.file-transfer.enabled}") fileTransferEnable: Boolean,
): DefaultValueBean {
return DefaultValueBean(stagingFolder, fileTransferEnable)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package io.airbyte.cdk.read
import io.airbyte.cdk.StreamIdentifier
import io.airbyte.cdk.asProtocolStreamDescriptor
import io.airbyte.cdk.command.OpaqueStateValue
import io.airbyte.cdk.util.Jsons
import io.airbyte.protocol.models.v0.AirbyteGlobalState
import io.airbyte.protocol.models.v0.AirbyteStateMessage
import io.airbyte.protocol.models.v0.AirbyteStateStats
Expand Down Expand Up @@ -199,7 +200,9 @@ class StateManager(
streamStates.add(
AirbyteStreamState()
.withStreamDescriptor(streamID.asProtocolStreamDescriptor())
.withStreamState(streamStateForCheckpoint.opaqueStateValue),
.withStreamState(
streamStateForCheckpoint.opaqueStateValue ?: Jsons.objectNode()
),
)
}
if (!shouldCheckpoint) {
Expand Down Expand Up @@ -233,7 +236,9 @@ class StateManager(
val airbyteStreamState =
AirbyteStreamState()
.withStreamDescriptor(feed.id.asProtocolStreamDescriptor())
.withStreamState(streamStateForCheckpoint.opaqueStateValue)
.withStreamState(
streamStateForCheckpoint.opaqueStateValue ?: Jsons.objectNode()
)
return AirbyteStateMessage()
.withType(AirbyteStateMessage.AirbyteStateType.STREAM)
.withStream(airbyteStreamState)
Expand Down
9 changes: 6 additions & 3 deletions airbyte-cdk/bulk/core/load/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies {
testFixturesImplementation "uk.org.webcompere:system-stubs-jupiter:2.1.7"
}

task integrationTest(type: Test) {
def integrationTestTask = tasks.register('integrationTest', Test) {
description = 'Runs the integration tests.'
group = 'verification'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
Expand All @@ -37,9 +37,12 @@ task integrationTest(type: Test) {
maxParallelForks = project.test.maxParallelForks
maxHeapSize = project.test.maxHeapSize
}
// These tests are lightweight enough to run on every PR.
tasks.named('check').configure {
dependsOn integrationTest
}

configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
}
// These tests are lightweight enough to run on every PR.
rootProject.check.dependsOn(integrationTest)
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import io.airbyte.cdk.load.test.util.NoopDestinationCleaner
import io.airbyte.cdk.load.test.util.NoopExpectedRecordMapper
import io.airbyte.cdk.load.test.util.NoopNameMapper
import io.airbyte.cdk.load.write.BasicFunctionalityIntegrationTest
import io.airbyte.cdk.load.write.Untyped
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test

class MockBasicFunctionalityIntegrationTest :
Expand All @@ -20,13 +22,19 @@ class MockBasicFunctionalityIntegrationTest :
NoopNameMapper,
isStreamSchemaRetroactive = false,
supportsDedup = true,
stringifySchemalessObjects = false,
promoteUnionToObject = false,
preserveUndeclaredFields = true,
commitDataIncrementally = false,
allTypesBehavior = Untyped,
) {
@Test
override fun testBasicWrite() {
super.testBasicWrite()
}

@Test
@Disabled
override fun testMidSyncCheckpointingStreamState() {
super.testMidSyncCheckpointingStreamState()
}
Expand All @@ -46,6 +54,16 @@ class MockBasicFunctionalityIntegrationTest :
super.testTruncateRefresh()
}

@Test
override fun testInterruptedTruncateWithPriorData() {
super.testInterruptedTruncateWithPriorData()
}

@Test
override fun resumeAfterCancelledTruncate() {
super.resumeAfterCancelledTruncate()
}

@Test
override fun testAppend() {
super.testAppend()
Expand All @@ -60,4 +78,19 @@ class MockBasicFunctionalityIntegrationTest :
override fun testDedup() {
super.testDedup()
}

@Test
override fun testContainerTypes() {
super.testContainerTypes()
}

@Test
override fun testUnions() {
super.testUnions()
}

@Test
override fun testAllTypes() {
super.testAllTypes()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ object MockDestinationBackend {
}
}

fun commitFrom(srcFilename: String, dstFilename: String) {
val src = getFile(srcFilename)
insert(dstFilename, *src.toTypedArray())
src.clear()
}

fun commitAndDedupeFrom(
srcFilename: String,
dstFilename: String,
primaryKey: List<List<String>>,
cursor: List<String>,
) {
val src = getFile(srcFilename)
upsert(dstFilename, primaryKey, cursor, *src.toTypedArray())
src.clear()
}

fun readFile(filename: String): List<OutputRecord> {
return getFile(filename)
}
Expand Down
Loading

0 comments on commit 5ed7af1

Please sign in to comment.