@@ -3,6 +3,8 @@ def call(ghprbActualCommit, ghprbPullId, ghprbPullTitle, ghprbPullLink, ghprbPul
33 def TIDB_BRANCH = " release-4.0"
44 def TIKV_BRANCH = " release-4.0"
55 def PD_BRANCH = " release-4.0"
6+ def TIFLASH_BRANCH = " release-4.0"
7+ def TEST_TIFLASH = " true"
68
79 // parse tidb branch
810 def m1 = ghprbCommentBody =~ / tidb\s *=\s *([^\s\\ ]+)(\s |\\ |$)/
@@ -25,6 +27,19 @@ def call(ghprbActualCommit, ghprbPullId, ghprbPullTitle, ghprbPullLink, ghprbPul
2527 }
2628 println " TIKV_BRANCH=${ TIKV_BRANCH} "
2729
30+ // parse tiflash branch
31+ def m4 = ghprbCommentBody =~ / tiflash\s *=\s *([^\s\\ ]+)(\s |\\ |$)/
32+ if (m4) {
33+ TIFLASH_BRANCH = " ${ m4[0][1]} "
34+ }
35+ println " TIFLASH_BRANCH=${ TIFLASH_BRANCH} "
36+
37+ // parse test tiflash
38+ def m5 = ghprbCommentBody =~ / test-flash\s *=\s *([^\s\\ ]+)(\s |\\ |$)/
39+ if (m5) {
40+ TEST_TIFLASH = " ${ m5[0][1]} "
41+ }
42+
2843 catchError {
2944 node (' build' ) {
3045 container(" java" ) {
@@ -55,21 +70,66 @@ def call(ghprbActualCommit, ghprbPullId, ghprbPullTitle, ghprbPullLink, ghprbPul
5570 def pd_sha1 = sh(returnStdout : true , script : " curl ${ FILE_SERVER_URL} /download/refs/pingcap/pd/${ PD_BRANCH} /sha1" ). trim()
5671 sh " curl ${ FILE_SERVER_URL} /download/builds/pingcap/pd/${ pd_sha1} /centos7/pd-server.tar.gz | tar xz"
5772
73+ // tiflash
74+ if (TEST_TIFLASH != " false" ) {
75+ def tiflash_sha1 = sh(returnStdout : true , script : " curl ${ FILE_SERVER_URL} /download/refs/pingcap/tiflash/${ TIFLASH_BRANCH} /sha1" ). trim()
76+ sh " curl ${ FILE_SERVER_URL} /download/builds/pingcap/tiflash/${ TIFLASH_BRANCH} /${ tiflash_sha1} /centos7/tiflash.tar.gz | tar xz"
77+ sh """
78+ cd tiflash
79+ tar -zcvf flash_cluster_manager.tgz flash_cluster_manager/
80+ rm ./flash_cluster_manager.tgz
81+ cd ..
82+ """
83+ stash includes : " tiflash/**" , name : " tiflash_binary"
84+ }
85+
86+ groovy.lang.Closure isv4 = { branch_name ->
87+ if (branch_name. startsWith(" v4" ) || branch_name. startsWith(" release-4" ) || branch_name == " master" ) {
88+ return true
89+ }
90+ return false
91+ }
92+
93+ if (isv4(TIDB_BRANCH ) || isv4(TIKV_BRANCH ) || isv4(PD_BRANCH )) {
94+ sh """
95+ rm /home/jenkins/agent/git/client-java/config/pd.toml
96+ rm /home/jenkins/agent/git/client-java/config/tikv.toml
97+ rm /home/jenkins/agent/git/client-java/config/tidb.toml
98+
99+ mv /home/jenkins/agent/git/client-java/config/pd-4.0.toml /home/jenkins/agent/git/client-java/config/pd.toml
100+ mv /home/jenkins/agent/git/client-java/config/tikv-4.0.toml /home/jenkins/agent/git/client-java/config/tikv.toml
101+ mv /home/jenkins/agent/git/client-java/config/tidb-4.0.toml /home/jenkins/agent/git/client-java/config/tidb.toml
102+ """
103+ }
104+
58105 sh """
59106 killall -9 tidb-server || true
60107 killall -9 tikv-server || true
61108 killall -9 pd-server || true
109+ killall -9 tiflash || true
62110 killall -9 java || true
63111 sleep 10
64- bin/pd-server --name=pd --data-dir=pd --config=../.ci/ config/pd.toml &>pd.log &
112+ bin/pd-server --name=pd --data-dir=pd --config=../config/pd.toml &>pd.log &
65113 sleep 10
66- bin/tikv-server --pd=127.0.0.1:2379 -s tikv --addr=0.0.0.0:20160 --advertise-addr=127.0.0.1:20160 --config=../.ci/ config/tikv.toml &>tikv.log &
114+ bin/tikv-server --pd=127.0.0.1:2379 -s tikv --addr=0.0.0.0:20160 --advertise-addr=127.0.0.1:20160 --config=../config/tikv.toml &>tikv.log &
67115 sleep 10
68116 ps aux | grep '-server' || true
69117 curl -s 127.0.0.1:2379/pd/api/v1/status || true
70- bin/tidb-server --store=tikv --path="127.0.0.1:2379" --config=../.ci/ config/tidb.toml &>tidb.log &
118+ bin/tidb-server --store=tikv --path="127.0.0.1:2379" --config=../config/tidb.toml &>tidb.log &
71119 sleep 60
72120 """
121+
122+ if (TEST_TIFLASH != " false" ) {
123+ sh """
124+ touch tiflash_cmd_line.log
125+ export LD_LIBRARY_PATH=/home/jenkins/agent/git/client-java/_run/tiflash
126+ ls -l \$ LD_LIBRARY_PATH
127+ tiflash/tiflash server config --config-file ../config/tiflash.toml &>tiflash_cmd_line.log &
128+ ps aux | grep 'tiflash'
129+ sleep 60
130+ """
131+ sh " ps aux | grep 'tiflash'"
132+ }
73133 }
74134 }
75135
@@ -87,6 +147,21 @@ def call(ghprbActualCommit, ghprbPullId, ghprbPullTitle, ghprbPullLink, ghprbPul
87147 sh " cat _run/pd.log"
88148 sh " cat _run/tikv.log"
89149 sh " cat _run/tidb.log"
150+ if (TEST_TIFLASH != " false" ) {
151+ sh """
152+ mkdir -p _run/tiflash/
153+ touch _run/tiflash_cmd_line.log
154+ touch _run/tiflash/tiflash_error.log
155+ touch _run/tiflash/tiflash.log
156+ touch _run/tiflash/tiflash_cluster_manager.log
157+ touch _run/tiflash/tiflash_tikv.log
158+ """
159+ sh " cat _run/tiflash_cmd_line.log"
160+ sh " cat _run/tiflash/tiflash_error.log"
161+ sh " cat _run/tiflash/tiflash.log"
162+ sh " cat _run/tiflash/tiflash_cluster_manager.log"
163+ sh " cat _run/tiflash/tiflash_tikv.log"
164+ }
90165 throw err
91166 }
92167 }
0 commit comments