From 4715506c5dd8f19ff5172e08d76ed3a431d78fc7 Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Wed, 4 Dec 2024 15:21:19 +0530 Subject: [PATCH 01/11] [Automated] Update the toml files --- ballerina/Ballerina.toml | 6 +++--- ballerina/Dependencies.toml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 4cdbd651..63a9dfe8 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -2,7 +2,7 @@ distribution = "2201.8.0" org = "ballerinax" name = "asb" -version = "3.8.2" +version = "3.8.3-SNAPSHOT" license= ["Apache-2.0"] authors = ["Ballerina"] keywords = ["IT Operations/Message Brokers", "Cost/Paid", "Vendor/Microsoft"] @@ -19,8 +19,8 @@ graalvmCompatible = true groupId = "org.ballerinax" artifactId = "asb-native" module = "asb-native" -version = "3.8.2" -path = "../native/build/libs/asb-native-3.8.2.jar" +version = "3.8.3-SNAPSHOT" +path = "../native/build/libs/asb-native-3.8.3-SNAPSHOT.jar" [[platform.java17.dependency]] groupId = "com.fasterxml.jackson.core" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 9de70df5..045b9b8a 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -10,7 +10,7 @@ distribution-version = "2201.8.0" [[package]] org = "ballerina" name = "io" -version = "1.6.1" +version = "1.6.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} @@ -127,7 +127,7 @@ modules = [ [[package]] org = "ballerinax" name = "asb" -version = "3.8.2" +version = "3.8.3-SNAPSHOT" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.runtime"}, From 6bbc5a1356686faa28375930becae39b522d5325 Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Wed, 4 Dec 2024 15:28:06 +0530 Subject: [PATCH 02/11] [Automated] Update the toml files --- ballerina/Dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 045b9b8a..0d1a4881 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -10,7 +10,7 @@ distribution-version = "2201.8.0" [[package]] org = "ballerina" name = "io" -version = "1.6.0" +version = "1.6.2" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} From 27a2514d8c7d38627704f1118cdf7cb84a5a393d Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Wed, 4 Dec 2024 15:28:24 +0530 Subject: [PATCH 03/11] Update gradle plugin version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5af7a11d..5d7f4d43 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ spotbugsPluginVersion=5.0.14 shadowJarPluginVersion=8.1.1 downloadPluginVersion=5.4.0 releasePluginVersion=2.8.0 -ballerinaGradlePluginVersion=2.2.4 +ballerinaGradlePluginVersion=3.0.0 ballerinaLangVersion=2201.8.0 azureServiceBusVersion=7.14.3 From 6a42fd44c5a29c903fb7b133749ef85b35e21bd0 Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Fri, 6 Dec 2024 19:27:12 +0530 Subject: [PATCH 04/11] [Automated] Update the toml files --- ballerina/Dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 0d1a4881..f543e790 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -10,7 +10,7 @@ distribution-version = "2201.8.0" [[package]] org = "ballerina" name = "io" -version = "1.6.2" +version = "1.6.3" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} From bd020a3ce78399917fde5f736c85d4b21f7a66a3 Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Fri, 6 Dec 2024 19:51:01 +0530 Subject: [PATCH 05/11] Fix ASB listener example code --- examples/listner/create_listner.bal | 32 +++++++++++++---------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/examples/listner/create_listner.bal b/examples/listner/create_listner.bal index 2021bee9..8ec26536 100644 --- a/examples/listner/create_listner.bal +++ b/examples/listner/create_listner.bal @@ -19,27 +19,23 @@ import ballerinax/asb; configurable string connectionString = ?; -// Listner Configurations -asb:ListenerConfig configuration = { - connectionString: connectionString -}; +listener asb:Listener asbListener = check new ({ + connectionString, + entityConfig: { + queueName: "test-queue" + }, + prefetchCount: 10, + autoComplete: false +}); -listener asb:Listener asbListener = new (configuration); +service asb:Service on asbListener { -@asb:ServiceConfig { - queueName: "test-queue", - peekLockModeEnabled: true, - maxConcurrency: 1, - prefetchCount: 10, - maxAutoLockRenewDuration: 300 -} -service asb:MessageService on asbListener { - isolated remote function onMessage(asb:Message message, asb:Caller caller) returns asb:Error? { + isolated remote function onMessage(asb:Message message, asb:Caller caller) returns error? { log:printInfo("Message received from queue: " + message.toBalString()); - _ = check caller.complete(message); + return caller->complete(); } - isolated remote function onError(asb:ErrorContext context, error 'error) returns asb:Error? { - log:printInfo("Error received from queue: " + context.toBalString()); + isolated remote function onError(asb:MessageRetrievalError 'error) returns error? { + log:printError("Error occurred while retrieving messages from the queue", 'error); } -}; +} From 2c84c7bd85c18a0b17e0159d6034fd8f989b7426 Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Fri, 6 Dec 2024 19:51:30 +0530 Subject: [PATCH 06/11] Enable examples build for the package --- examples/build.gradle | 27 +++++++++++++++++++++++---- settings.gradle | 2 ++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/examples/build.gradle b/examples/build.gradle index 35f5660f..22ca5fa6 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -16,18 +16,37 @@ * under the License. */ +import org.apache.tools.ant.taskdefs.condition.Os + apply plugin: 'java-library' description = 'Ballerina - Azure Service Bus Examples' +def packageName = "asb" def filePath = project.fileTree("${project.projectDir}") def examples = filePath.matching { include("**/*.bal") exclude("**/deprecated/**/*.bal") } +def executeBalCommand(String command, String dir) { + try { + exec { + workingDir dir + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + commandLine 'cmd', '/c', "bal.bat ${command} && exit %%ERRORLEVEL%%" + } else { + commandLine 'sh', '-c', "bal ${command}" + } + } + } catch (Exception e) { + println("bal command failed. " + e.message) + throw e + } +} + task testExamples { - dependsOn ":${project.packageName}-ballerina:build" + dependsOn ":${packageName}-ballerina:build" doLast { examples.each { example -> executeBalCommand ("run ${example}", "${project.rootDir}") } @@ -35,10 +54,10 @@ task testExamples { } task buildExamples { - dependsOn ":${project.packageName}-ballerina:build" + dependsOn ":${packageName}-ballerina:build" gradle.taskGraph.whenReady { graph -> - if (graph.hasTask(":${project.packageName}-examples:test")) { + if (graph.hasTask(":${packageName}-examples:test")) { buildExamples.enabled = false } else { testExamples.enabled = false @@ -50,5 +69,5 @@ task buildExamples { } } -// test.dependsOn testExamples +test.dependsOn testExamples build.dependsOn buildExamples diff --git a/settings.gradle b/settings.gradle index 5918178b..1be0a3c2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -47,10 +47,12 @@ rootProject.name = "ballerinax-${projectName}" include ":checkstyle" include ":${projectName}-native" include ":${projectName}-ballerina" +include ":${projectName}-examples" project(':checkstyle').projectDir = file("build-config${File.separator}checkstyle") project(":${projectName}-native").projectDir = file('native') project(":${projectName}-ballerina").projectDir = file('ballerina') +project(":${projectName}-examples").projectDir = file('examples') gradleEnterprise { buildScan { From 35891c27985691e89aef6a02de643249cc0d596a Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Fri, 6 Dec 2024 19:55:21 +0530 Subject: [PATCH 07/11] Update examples build configuration --- examples/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/build.gradle b/examples/build.gradle index 22ca5fa6..81127e71 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -18,7 +18,7 @@ import org.apache.tools.ant.taskdefs.condition.Os -apply plugin: 'java-library' +apply plugin: 'java' description = 'Ballerina - Azure Service Bus Examples' From a48a98e6092ddd37e692da4bf1ccf1eebc1675c7 Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Fri, 6 Dec 2024 20:00:26 +0530 Subject: [PATCH 08/11] Update ASB trivy scan workflow --- .github/workflows/trivy-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml index c02c8ff4..d0cbae49 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -9,5 +9,5 @@ jobs: call_workflow: name: Run Trivy Scan Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-connector-template.yml@main secrets: inherit From 0df7729e932633e1af2271caa81f77fc9247a4f1 Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Mon, 9 Dec 2024 10:39:51 +0530 Subject: [PATCH 09/11] Update workflow branch --- .github/workflows/build-with-bal-test-graalvm.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/daily-build.yml | 2 +- .github/workflows/dev-stg-release.yml | 2 +- .github/workflows/pull-request.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/trivy-scan.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-with-bal-test-graalvm.yml b/.github/workflows/build-with-bal-test-graalvm.yml index 7973b4c2..be7d6cc5 100644 --- a/.github/workflows/build-with-bal-test-graalvm.yml +++ b/.github/workflows/build-with-bal-test-graalvm.yml @@ -13,5 +13,5 @@ jobs: call_workflow_template: name: Run Workflow Template if: ${{ github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'ballerina-platform') }} - uses: ballerina-platform/ballerina-library/.github/workflows/build-with-bal-test-graalvm-connector-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/build-with-bal-test-graalvm-connector-template.yml@10.x-workflow-update secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbaba019..45a785fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: call_workflow: name: Run Connector Build Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/build-connector-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/build-connector-template.yml@10.x-workflow-update secrets: inherit with: repo-name: module-ballerinax-azure-service-bus diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index 846c5218..107ea566 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -8,7 +8,7 @@ jobs: call_workflow: name: Run Daily Build Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/daily-build-connector-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/daily-build-connector-template.yml@10.x-workflow-update secrets: inherit with: repo-name: module-ballerinax-azure-service-bus diff --git a/.github/workflows/dev-stg-release.yml b/.github/workflows/dev-stg-release.yml index b85c07cf..e9d13146 100644 --- a/.github/workflows/dev-stg-release.yml +++ b/.github/workflows/dev-stg-release.yml @@ -15,7 +15,7 @@ jobs: call_workflow: name: Run Dev\Stage Central Publish Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/dev-stage-central-publish-connector-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/dev-stage-central-publish-connector-template.yml@10.x-workflow-update secrets: inherit with: environment: ${{ github.event.inputs.environment }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4d40baf4..f4229a29 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -10,7 +10,7 @@ jobs: call_workflow: name: Run PR Build Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/pr-build-connector-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/pr-build-connector-template.yml@10.x-workflow-update secrets: inherit with: additional-test-flags: ${{ github.event.pull_request.head.repo.full_name != github.repository && '-x test' || ''}} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa1ec1ab..b53fa00b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: call_workflow: name: Run Release Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/release-package-connector-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/release-package-connector-template.yml@10.x-workflow-update secrets: inherit with: package-name: asb diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml index d0cbae49..5de07d62 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -9,5 +9,5 @@ jobs: call_workflow: name: Run Trivy Scan Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} - uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-connector-template.yml@main + uses: ballerina-platform/ballerina-library/.github/workflows/trivy-scan-connector-template.yml@10.x-workflow-update secrets: inherit From d0cc77a0b049cc233ea3f0b52e45ff2b8328f912 Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Mon, 9 Dec 2024 11:00:29 +0530 Subject: [PATCH 10/11] Fix example builds with offline-flag --- examples/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/build.gradle b/examples/build.gradle index 81127e71..f79f6016 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -65,6 +65,8 @@ task buildExamples { } doLast { // TODO: Enabled --offline due to a bug in pulling incorrect versions from the central repository. + executeBalCommand ("pack", "${project.rootDir}/ballerina") + executeBalCommand ("push --repository=local", "${project.rootDir}/ballerina") examples.each { example -> executeBalCommand ("build --offline ${example}", "${project.rootDir}") } } } From 78f8d3e9bb58172ee94908cd0cc61061aae5a894 Mon Sep 17 00:00:00 2001 From: Ayesh Almeida Date: Mon, 9 Dec 2024 11:20:10 +0530 Subject: [PATCH 11/11] Remove example tests for ASB --- examples/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/build.gradle b/examples/build.gradle index f79f6016..cc683df2 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -71,5 +71,5 @@ task buildExamples { } } -test.dependsOn testExamples +// test.dependsOn testExamples build.dependsOn buildExamples