diff --git a/.semaphore/project.yml b/.semaphore/project.yml new file mode 100644 index 00000000..d471c7fe --- /dev/null +++ b/.semaphore/project.yml @@ -0,0 +1,43 @@ +# This file is managed by ServiceBot plugin - Semaphore. The content in this file is created using a common +# template and configurations in service.yml. +# Modifications in this file will be overwritten by generated content in the nightly run. +# For more information, please refer to the page: +# https://confluentinc.atlassian.net/wiki/spaces/Foundations/pages/2871296194/Add+SemaphoreCI +apiVersion: v1alpha +kind: Project +metadata: + name: mongo-kafka + description: "" +spec: + visibility: private + repository: + url: git@github.com:confluentinc/mongo-kafka.git + run_on: + - branches + - pull_requests + pipeline_file: .semaphore/semaphore.yml + integration_type: github_app + status: + pipeline_files: + - path: .semaphore/semaphore.yml + level: pipeline + whitelist: + branches: + - master + - main + - /^\d+\.\d+\.x$/ + - /^gh-readonly-queue.*/ + custom_permissions: true + debug_permissions: + - empty + - default_branch + - non_default_branch + - pull_request + - forked_pull_request + - tag + attach_permissions: + - default_branch + - non_default_branch + - pull_request + - forked_pull_request + - tag \ No newline at end of file diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml new file mode 100644 index 00000000..fe0998a1 --- /dev/null +++ b/.semaphore/semaphore.yml @@ -0,0 +1,88 @@ +# This file is managed by ServiceBot plugin - Semaphore. The content in this file is created using a common +# template and configurations in service.yml. +# Any modifications made to ths file will be overwritten by the generated content in nightly runs. +# For more information, please refer to the page: +# https://confluentinc.atlassian.net/wiki/spaces/Foundations/pages/2871296194/Add+SemaphoreCI +version: v1.0 +name: build-test-release +agent: + machine: + type: s1-prod-ubuntu20-04-amd64-1 + +fail_fast: + cancel: + when: "true" + +execution_time_limit: + hours: 1 + +queue: + - when: "branch != 'master' and branch !~ '[0-9]+\\.[0-9]+\\.x'" + processing: parallel + +global_job_config: + prologue: + commands: + - checkout + - sem-version java 8 + - . cache-maven restore + +blocks: + - name: Test + dependencies: [] + run: + # don't run the tests on non-functional changes... + when: "change_in('/', {exclude: ['/.deployed-versions/', '.github/']})" + task: + jobs: + - name: Test + commands: + - pip install confluent-release-tools -q + - . sem-pint + - mvn -Dcloud -Pjenkins -U -Dmaven.wagon.http.retryHandler.count=10 --batch-mode --no-transfer-progress clean verify install dependency:analyze validate + - . cve-scan + - . cache-maven store + epilogue: + always: + commands: + - . publish-test-results + - artifact push workflow target/test-results + + - name: Release + dependencies: ["Test"] + run: + when: "branch = 'master' or branch =~ '[0-9]+\\.[0-9]+\\.x'" + task: + jobs: + - name: Release + commands: + - mvn -Dcloud -Pjenkins -U -Dmaven.wagon.http.retryHandler.count=10 --batch-mode -DaltDeploymentRepository=confluent-codeartifact-internal::default::https://confluent-519856050701.d.codeartifact.us-west-2.amazonaws.com/maven/maven-snapshots/ + -DrepositoryId=confluent-codeartifact-internal deploy -DskipTests + - name: Release Notes + dependencies: [] + run: + when: "branch =~ '[0-9]+\\.[0-9]+\\.x'" + task: + jobs: + - name: Generate Release Notes + commands: + - git clone --branch master --single-branch git@github.com:confluentinc/connect-releases.git + - ./connect-releases/tasks/release-connect-plugins/generate-connect-changelogs.sh + +after_pipeline: + task: + agent: + machine: + type: s1-prod-ubuntu20-04-arm64-0 + jobs: + - name: Metrics + commands: + - emit-ci-metrics -p -a test-results + - name: Publish Test Results + commands: + - test-results gen-pipeline-report + - name: SonarQube + commands: + - checkout + - sem-version java 11 + - emit-sonarqube-data -a test-results \ No newline at end of file diff --git a/service.yml b/service.yml new file mode 100644 index 00000000..968f921a --- /dev/null +++ b/service.yml @@ -0,0 +1,19 @@ +name: mongo-kafka +lang: java +lang_version: 8 +git: + enable: true +codeowners: + enable: true +semaphore: + enable: true + pipeline_type: cp + cve_scan: true + extra_deploy_args: "-Dcloud -Pjenkins" + extra_build_args: "-Dcloud -Pjenkins" + run_pint_merge: true + generate_connect_changelogs: true +code_artifact: + enable: true + package_paths: + - maven-snapshots/maven/io.confluent/mongo-kafka diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..8321a7ea --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,8 @@ +### service-bot sonarqube plugin managed file +sonar.coverage.exclusions=**/test/**/*,**/tests/**/*,**/mock/**/*,**/mocks/**/*,**/*mock*,**/*test* +sonar.coverage.jacoco.xmlReportPaths=**/jacoco.xml +sonar.exclusions=**/*.pb.*,**/mk-include/**/* +sonar.java.binaries=. +sonar.language=java +sonar.projectKey=mongo-kafka +sonar.sources=. \ No newline at end of file diff --git a/src/integrationTest/java/com/mongodb/kafka/connect/source/MongoSourceTaskIntegrationTest2.java b/src/integrationTest/java/com/mongodb/kafka/connect/source/MongoSourceTaskIntegrationTest2.java index 3dde0ba7..f715cf20 100644 --- a/src/integrationTest/java/com/mongodb/kafka/connect/source/MongoSourceTaskIntegrationTest2.java +++ b/src/integrationTest/java/com/mongodb/kafka/connect/source/MongoSourceTaskIntegrationTest2.java @@ -39,7 +39,6 @@ import org.apache.kafka.clients.producer.RecordMetadata; import org.apache.kafka.connect.source.SourceTaskContext; import org.apache.kafka.connect.storage.OffsetStorageReader; -import org.junit.Ignore; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/src/main/java/com/mongodb/kafka/connect/util/ConnectionValidator.java b/src/main/java/com/mongodb/kafka/connect/util/ConnectionValidator.java index 74c50914..3bfaa435 100644 --- a/src/main/java/com/mongodb/kafka/connect/util/ConnectionValidator.java +++ b/src/main/java/com/mongodb/kafka/connect/util/ConnectionValidator.java @@ -120,7 +120,7 @@ public void clusterDescriptionChanged( MongoClient mongoClient = MongoClients.create(mongoClientSettings); try { - if (connectionString.isSrvProtocol()){ + if (connectionString.isSrvProtocol()) { if (!latch.await(latchTimeout, TimeUnit.MILLISECONDS)) { configValue.addErrorMessage("Unable to connect to the server."); mongoClient.close();