From 6a84d56092ee23c5eea4649f91a53c7db20cd793 Mon Sep 17 00:00:00 2001 From: "ahmed.toumi-ext" Date: Wed, 6 Dec 2023 20:51:51 +0100 Subject: [PATCH 1/3] 36 : issue#36 - add a gradle task to generate manifest.json to be complient with confulent hub cli --- .gitignore | 1 + build.gradle | 47 ++++++++++++++++++++++++++++++-------- doc/distribution-readme.md | 3 ++- manifest.json.template | 44 +++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 10 deletions(-) create mode 100644 manifest.json.template diff --git a/.gitignore b/.gitignore index 0e26c64..d27f667 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ src/integrationTest/resources/pubsubplus-connector-kafka*/ # Local testing solace.properties +manifest.json \ No newline at end of file diff --git a/build.gradle b/build.gradle index c72c894..09789d2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,8 @@ import com.github.spotbugs.snom.SpotBugsTask import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository +import groovy.json.JsonOutput +import groovy.text.GStringTemplateEngine +import jdk.nashorn.internal.ir.debug.JSONWriter plugins { id 'java-library' @@ -76,6 +79,31 @@ spotbugs { reportLevel 'high' // Decrease to medium once medium errors are fixed } +// Generate manifest.json file to be compliant with Confluent Hub client +tasks.register("genarateKafkaConnectManifestFile") { + + def manifestJsonTemplate = new File('manifest.json.template') + def bindMap = [ + "FEATURE_CONFLUENT_CONTROL_CENTER_INTEGRATION_ENABLED": false, + "FEATURE_KAFKA_CONNECT_API_ENABLED": true, + "FEATURE_SINGLE_MESSAGE_TRANSFORMS_ENABLED": true, + "COMPONENT_NAME": project.name, + "RELEASE_DATE": new Date().format("yyyy-MM-dd"), + "VERSION": project.version + ] + + def manifestJson = JsonOutput.unescaped( + new GStringTemplateEngine() + .createTemplate(manifestJsonTemplate) + .make(bindMap) + .toString() + ) + + new File(project.projectDir.toString() + "/manifest.json").write JsonOutput.prettyPrint(JsonOutput.toJson(manifestJson)) +} + +tasks.genarateKafkaConnectManifestFile.dependsOn assemble + spotbugsIntegrationTest { enabled = false } @@ -116,13 +144,13 @@ project.integrationTest { maxRetries = 3 } afterSuite { desc, result -> - if (!desc.parent) - println("${result.resultType} " + - "(${result.testCount} tests, " + - "${result.successfulTestCount} successes, " + - "${result.failedTestCount} failures, " + - "${result.skippedTestCount} skipped)") - } + if (!desc.parent) + println("${result.resultType} " + + "(${result.testCount} tests, " + + "${result.successfulTestCount} successes, " + + "${result.failedTestCount} failures, " + + "${result.skippedTestCount} skipped)") + } } project.test { @@ -167,7 +195,7 @@ task('pmdMainSarif') { } Provider reportsDir = project.getLayout() - .file(project.getProviders().provider({a -> extension.getReportsDir()}) as Provider) + .file(project.getProviders().provider({ a -> extension.getReportsDir() }) as Provider) formatter(type: 'sarif', toFile: new File(reportsDir.get().getAsFile(), 'main.sarif')) formatter(type: 'html', toFile: new File(reportsDir.get().getAsFile(), 'main.html')) @@ -230,6 +258,7 @@ distributions { from('doc/distribution-readme.md') { into 'doc' } from('LICENSE') { into 'doc' } from('THIRD-PARTY-LICENSES') { into 'doc' } + from('manifest.json') { into '' } into('lib') { from jar from(project.configurations.runtimeClasspath) @@ -310,7 +339,7 @@ signing { tasks.withType(Sign) { onlyIf { - gradle.taskGraph.allTasks.any {task -> + gradle.taskGraph.allTasks.any { task -> task.name.startsWith("publish") && task.name.contains('Sonatype') } } diff --git a/doc/distribution-readme.md b/doc/distribution-readme.md index 582ac26..3d7f4b2 100644 --- a/doc/distribution-readme.md +++ b/doc/distribution-readme.md @@ -8,4 +8,5 @@ Package directory contents: - doc: this readme and license information - lib: Sink Connector jar file and dependencies -- etc: sample configuration properties and JSON file +- etc: sample configuration properties and JSON file +- manifest.json: manifest file for kafka-connect to be installable via confluent-hub client diff --git a/manifest.json.template b/manifest.json.template new file mode 100644 index 0000000..83c3f07 --- /dev/null +++ b/manifest.json.template @@ -0,0 +1,44 @@ +{ + "author": "Solace", + "component_types": [ + "sink" + ], + "description": "The PubSub+ Kafka Sink Connector consumes Kafka topic records and streams them to the PubSub+ Event Mesh as topic and/or queue data events.", + "documentationUrl": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink", + "features": { + "confluent_control_center_integration": $FEATURE_CONFLUENT_CONTROL_CENTER_INTEGRATION_ENABLED, + "kafka_connect_api": $FEATURE_KAFKA_CONNECT_API_ENABLED, + "single_message_transforms": $FEATURE_SINGLE_MESSAGE_TRANSFORMS_ENABLED, + "supported_encodings": [ + "any" + ] + }, + "license": [ + { + "name": "he Apache Software License, Version 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + } + ], + "name": "$COMPONENT_NAME", + "owner": { + "name": "Solace", + "type": "organization", + "url": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink", + "username": "SolaceProducts" + }, + "release_date": "$RELEASE_DATE", + "source_url": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink", + "support": { + "provider_name": "Solace", + "summary": "", + "url": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink/issues" + }, + "tags": [ + "solace", + "kafka", + "sink", + "connector" + ], + "title": "Solace PubSub+ Connector for Kafka: Sink", + "version": "$VERSION" +} \ No newline at end of file From 5e93385f6b221de00f4f66db8e5510c9a8e23f91 Mon Sep 17 00:00:00 2001 From: Jeffrey Douangpaseuth <11084623+Nephery@users.noreply.github.com> Date: Wed, 13 Dec 2023 13:03:39 -0500 Subject: [PATCH 2/3] cleanup manifest gen --- .gitignore | 1 - build.gradle | 34 +++++-------------- .../template/manifest/manifest.json | 23 ++++++------- 3 files changed, 19 insertions(+), 39 deletions(-) rename manifest.json.template => src/template/manifest/manifest.json (53%) diff --git a/.gitignore b/.gitignore index d27f667..0e26c64 100644 --- a/.gitignore +++ b/.gitignore @@ -49,4 +49,3 @@ src/integrationTest/resources/pubsubplus-connector-kafka*/ # Local testing solace.properties -manifest.json \ No newline at end of file diff --git a/build.gradle b/build.gradle index 09789d2..9265db0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,5 @@ import com.github.spotbugs.snom.SpotBugsTask import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository -import groovy.json.JsonOutput -import groovy.text.GStringTemplateEngine -import jdk.nashorn.internal.ir.debug.JSONWriter plugins { id 'java-library' @@ -80,30 +77,15 @@ spotbugs { } // Generate manifest.json file to be compliant with Confluent Hub client -tasks.register("genarateKafkaConnectManifestFile") { - - def manifestJsonTemplate = new File('manifest.json.template') - def bindMap = [ - "FEATURE_CONFLUENT_CONTROL_CENTER_INTEGRATION_ENABLED": false, - "FEATURE_KAFKA_CONNECT_API_ENABLED": true, - "FEATURE_SINGLE_MESSAGE_TRANSFORMS_ENABLED": true, - "COMPONENT_NAME": project.name, - "RELEASE_DATE": new Date().format("yyyy-MM-dd"), - "VERSION": project.version - ] - - def manifestJson = JsonOutput.unescaped( - new GStringTemplateEngine() - .createTemplate(manifestJsonTemplate) - .make(bindMap) - .toString() - ) - - new File(project.projectDir.toString() + "/manifest.json").write JsonOutput.prettyPrint(JsonOutput.toJson(manifestJson)) +tasks.register('generateConfluentConnectManifest', Copy) { + def templateContext = [ + "project": project.properties + ] + from 'src/template/manifest' + into "${buildDir}/generated/manifest" + expand templateContext } -tasks.genarateKafkaConnectManifestFile.dependsOn assemble - spotbugsIntegrationTest { enabled = false } @@ -258,7 +240,7 @@ distributions { from('doc/distribution-readme.md') { into 'doc' } from('LICENSE') { into 'doc' } from('THIRD-PARTY-LICENSES') { into 'doc' } - from('manifest.json') { into '' } + from(generateConfluentConnectManifest) {into ''} into('lib') { from jar from(project.configurations.runtimeClasspath) diff --git a/manifest.json.template b/src/template/manifest/manifest.json similarity index 53% rename from manifest.json.template rename to src/template/manifest/manifest.json index 83c3f07..dec38fc 100644 --- a/manifest.json.template +++ b/src/template/manifest/manifest.json @@ -1,32 +1,31 @@ { - "author": "Solace", "component_types": [ "sink" ], "description": "The PubSub+ Kafka Sink Connector consumes Kafka topic records and streams them to the PubSub+ Event Mesh as topic and/or queue data events.", - "documentationUrl": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink", + "documentation_url": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink", "features": { - "confluent_control_center_integration": $FEATURE_CONFLUENT_CONTROL_CENTER_INTEGRATION_ENABLED, - "kafka_connect_api": $FEATURE_KAFKA_CONNECT_API_ENABLED, - "single_message_transforms": $FEATURE_SINGLE_MESSAGE_TRANSFORMS_ENABLED, + "confluent_control_center_integration": false, + "kafka_connect_api": true, + "single_message_transforms": true, "supported_encodings": [ "any" ] }, "license": [ { - "name": "he Apache Software License, Version 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.txt" + "name": "Apache License, Version 2.0", + "url": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink/blob/master/LICENSE" } ], - "name": "$COMPONENT_NAME", + "name": "${project.name}", "owner": { "name": "Solace", "type": "organization", - "url": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink", - "username": "SolaceProducts" + "url": "https://solace.community", + "username": "solace" }, - "release_date": "$RELEASE_DATE", + "release_date": "${new Date().format('yyyy-MM-dd')}", "source_url": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink", "support": { "provider_name": "Solace", @@ -40,5 +39,5 @@ "connector" ], "title": "Solace PubSub+ Connector for Kafka: Sink", - "version": "$VERSION" + "version": "${project.version}" } \ No newline at end of file From e43473a60cedf5485bb6a6e7523c8acb002ba42f Mon Sep 17 00:00:00 2001 From: Jeffrey Douangpaseuth <11084623+Nephery@users.noreply.github.com> Date: Wed, 13 Dec 2023 13:18:39 -0500 Subject: [PATCH 3/3] prepare for 3.0.1 release --- README.md | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 009ba60..a164b3a 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ In this case the IP address is one of the nodes running the distributed mode wor { "class": "com.solace.connector.kafka.connect.sink.SolaceSinkConnector", "type": "sink", - "version": "3.0.0" + "version": "3.0.1" }, ``` diff --git a/gradle.properties b/gradle.properties index f4bdd6f..67e1778 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ group=com.solace.connector.kafka.connect -version=3.0.0 \ No newline at end of file +version=3.0.1 \ No newline at end of file