You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2023/01/06 01:57:08 UTC

[shardingsphere] branch master updated: Add cluster zookeeper for example genterator (#23340)

This is an automated email from the ASF dual-hosted git repository.

sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 6834e4a1127 Add cluster zookeeper for example genterator (#23340)
6834e4a1127 is described below

commit 6834e4a1127e759a25448f929bbc6657c922963c
Author: Guocheng Tang <to...@apache.org>
AuthorDate: Fri Jan 6 09:57:01 2023 +0800

    Add cluster zookeeper for example genterator (#23340)
    
    * add cluster mode
    
    * remove repository check for test
    
    * remove upload action
    
    * add zookeeper
    
    * add cluster zookeeper Dependency
    
    * add repository check
    
    * revert example upload
---
 .github/workflows/nightly-build-example.yml                        | 7 ++++++-
 .../src/main/resources/template/jdbc/java/config/Configuration.ftl | 2 ++
 .../src/main/resources/template/jdbc/pom.ftl                       | 7 +++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/nightly-build-example.yml b/.github/workflows/nightly-build-example.yml
index b6dd26e9866..645244d4615 100644
--- a/.github/workflows/nightly-build-example.yml
+++ b/.github/workflows/nightly-build-example.yml
@@ -58,7 +58,7 @@ jobs:
       matrix:
         feature: [ sharding, readwrite-splitting, encrypt, shadow, mask ]
         framework: [ jdbc, spring-boot-starter-jdbc, spring-boot-starter-jpa, spring-boot-starter-mybatis, spring-namespace-jdbc, spring-namespace-jpa, spring-namespace-mybatis ]
-        mode: [ standalone ]
+        mode: [ standalone, cluster-zookeeper ]
         transaction: [ local ]
         product: [ jdbc ]
         exclude: 
@@ -74,6 +74,11 @@ jobs:
         ports:
           - 3306:3306
         options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
+      zookeeper:
+        image: zookeeper:3.6.3
+        ports:
+          - 2181:2181
+        options: --health-cmd="echo ruok | nc localhost 2181" --health-interval=10s --health-timeout=5s --health-retries=3
     steps:
       - uses: actions/checkout@v3
       - uses: actions/setup-java@v3
diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/java/config/Configuration.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/java/config/Configuration.ftl
index 7151eb436e9..318b86c809b 100644
--- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/java/config/Configuration.ftl
+++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/java/config/Configuration.ftl
@@ -25,6 +25,8 @@ import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
 import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
 <#if mode=="standalone">
 import org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepositoryConfiguration;
+<#else>
+import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 </#if>
 <#if feature?contains("sharding")>
 import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
diff --git a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl
index d63c0eb1601..99f96b4fbd9 100644
--- a/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl
+++ b/examples/shardingsphere-example-generator/src/main/resources/template/jdbc/pom.ftl
@@ -31,6 +31,13 @@
             <artifactId>shardingsphere-jdbc-core</artifactId>
             <version>${r'${project.version}'}</version>
         </dependency>
+    <#if mode=="cluster-zookeeper">
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-cluster-mode-repository-zookeeper</artifactId>
+            <version>${r'${project.version}'}</version>
+        </dependency>
+    </#if>
     <#if transaction?contains("xa")>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>