diff --git a/.github/workflows/legacy-test-command.yml b/.github/workflows/legacy-test-command.yml index f71339a21e2fa..6d681585f4347 100644 --- a/.github/workflows/legacy-test-command.yml +++ b/.github/workflows/legacy-test-command.yml @@ -23,6 +23,9 @@ on: description: "Set a specific connector acceptance test version to use. Enter 'dev' to test, build and use a local version of Connector Acceptance Test." required: false default: "latest" + local_cdk: + description: "Run Connector Acceptance Tests against the CDK version on the current branch." + required: false jobs: uuid: name: "Custom UUID of workflow run" @@ -127,7 +130,7 @@ jobs: S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }} uses: Wandalen/wretry.action@v1.0.42 with: - command: ./tools/bin/ci_integration_test.sh ${{ github.event.inputs.connector }} + command: ./tools/bin/ci_integration_test.sh ${{ github.event.inputs.connector }} ${{ github.event.inputs.local_cdk }} attempt_limit: 3 attempt_delay: 10000 # in ms - name: Update Integration Test Credentials after test run for ${{ github.event.inputs.connector }} diff --git a/buildSrc/src/main/groovy/airbyte-docker.gradle b/buildSrc/src/main/groovy/airbyte-docker.gradle index 5d369b2043868..7ced4074047c7 100644 --- a/buildSrc/src/main/groovy/airbyte-docker.gradle +++ b/buildSrc/src/main/groovy/airbyte-docker.gradle @@ -56,6 +56,21 @@ abstract class AirbyteDockerTask extends AirbyteDockerBaseTask { } } +abstract class AirbyteDockerWithLocalCDKLegacyTask extends AirbyteDockerBaseTask { + + @InputFile + File buildScript = project.rootProject.file('airbyte-integrations/scripts/build-connector-image-with-local-cdk.sh') + + @TaskAction + def dockerTask() { + project.exec { + environment "CONNECTOR_TAG", DockerHelpers.getDevTaggedImage(project.projectDir, dockerFile.name) + environment "CONNECTOR_NAME", project.findProperty('connectorAcceptanceTest.connectorName') + commandLine buildScript.absolutePath + } + } +} + /** * AirbyteDockerTaskFactory is a convenience object to avoid passing the current project around. */ @@ -199,6 +214,11 @@ class AirbyteDockerTaskFactory { } } Class taskClass = AirbyteDockerTask + if (project.hasProperty('connectorAcceptanceTest.useLocalCdk') && project.parent.project.name == "connectors") { + // This is only used by the legacy test slash command, for connectors for which + // airbyte-ci isn't supported yet. + taskClass = AirbyteDockerWithLocalCDKLegacyTask + } // Tagged name of the image to be built by this task. def taggedImage = DockerHelpers.getDevTaggedImage(project.projectDir, dockerFileName) diff --git a/tools/bin/ci_integration_test.sh b/tools/bin/ci_integration_test.sh index 7084594acb6a7..a13a8611d92f9 100755 --- a/tools/bin/ci_integration_test.sh +++ b/tools/bin/ci_integration_test.sh @@ -7,6 +7,7 @@ set -e # runs integration tests for an integration name connector="$1" +local_cdk="$2" all_integration_tests=$(./gradlew integrationTest --dry-run | grep 'integrationTest SKIPPED' | cut -d: -f 4) run() { if [[ "$connector" == "all" ]] ; then @@ -35,7 +36,7 @@ else fi if [ -n "$selected_integration_test" ] ; then echo "Running: ./gradlew --no-daemon --scan $integrationTestCommand" - ./gradlew --no-daemon --scan "$integrationTestCommand" + ./gradlew --no-daemon --scan "$integrationTestCommand" -PconnectorAcceptanceTest.useLocalCdk=$local_cdk -PconnectorAcceptanceTest.connectorName=$connector_name else echo "Connector '$connector' not found..." return 1