未验证 提交 702d50ae 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #7061 from taosdata/test/jenkins-m

[TD-5536]update  local jenkins
def pre_test(){ def pre_test(){
sh '''
sudo rmtaos||echo 'no taosd installed'
'''
sh '''
cd ${WKC}
git reset --hard
git checkout $BRANCH_NAME
git pull
git submodule update
cd ${WK}
git reset --hard
git checkout $BRANCH_NAME
git pull
export TZ=Asia/Harbin
date
rm -rf ${WK}/debug
mkdir debug
cd debug
cmake -DMEMORY_SANITIZER=true .. > /dev/null
make > /dev/null
make install > /dev/null
pip3 install ${WKC}/src/connector/python
'''
return 1
}
def pre_test_p(){
sh ''' sh '''
sudo rmtaos||echo 'no taosd installed' sudo rmtaos||echo 'no taosd installed'
''' '''
...@@ -39,7 +66,7 @@ pipeline { ...@@ -39,7 +66,7 @@ pipeline {
stage('pytest') { stage('pytest') {
agent{label 'slad1'} agent{label 'slad1'}
steps { steps {
pre_test() pre_test_p()
sh ''' sh '''
cd ${WKC}/tests cd ${WKC}/tests
find pytest -name '*'sql|xargs rm -rf find pytest -name '*'sql|xargs rm -rf
...@@ -48,7 +75,7 @@ pipeline { ...@@ -48,7 +75,7 @@ pipeline {
} }
} }
stage('test_b1') { stage('test_b1') {
agent{label 'master'} agent{label 'slad2'}
steps { steps {
pre_test() pre_test()
...@@ -62,7 +89,7 @@ pipeline { ...@@ -62,7 +89,7 @@ pipeline {
} }
stage('test_crash_gen') { stage('test_crash_gen') {
agent{label "slad2"} agent{label "slad3"}
steps { steps {
pre_test() pre_test()
sh ''' sh '''
...@@ -92,7 +119,7 @@ pipeline { ...@@ -92,7 +119,7 @@ pipeline {
} }
sh''' sh'''
systemctl start taosd nohup taosd >/dev/null &
sleep 10 sleep 10
''' '''
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
...@@ -110,16 +137,8 @@ pipeline { ...@@ -110,16 +137,8 @@ pipeline {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh ''' sh '''
cd ${WKC}/tests/examples/JDBC/JDBCDemo/ cd ${WKC}/tests/examples/JDBC/JDBCDemo/
mvn clean package assembly:single -DskipTests >/dev/null mvn clean package >/dev/null
java -jar target/JDBCDemo-SNAPSHOT-jar-with-dependencies.jar -host 127.0.0.1 java -jar target/JdbcRestfulDemo-jar-with-dependencies.jar
'''
}
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh '''
cd ${WKC}/src/connector/jdbc
mvn clean package -Dmaven.test.skip=true >/dev/null
cd ${WKC}/tests/examples/JDBC/JDBCDemo/
java --class-path=../../../../src/connector/jdbc/target:$JAVA_HOME/jre/lib/ext -jar target/JDBCDemo-SNAPSHOT-jar-with-dependencies.jar -host 127.0.0.1
''' '''
} }
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
...@@ -136,7 +155,7 @@ pipeline { ...@@ -136,7 +155,7 @@ pipeline {
''' '''
} }
sh ''' sh '''
systemctl stop taosd pkill -9 taosd
cd ${WKC}/tests cd ${WKC}/tests
./test-all.sh b2 ./test-all.sh b2
date date
...@@ -149,7 +168,7 @@ pipeline { ...@@ -149,7 +168,7 @@ pipeline {
} }
stage('test_valgrind') { stage('test_valgrind') {
agent{label "slad3"} agent{label "slad4"}
steps { steps {
pre_test() pre_test()
...@@ -228,11 +247,11 @@ pipeline { ...@@ -228,11 +247,11 @@ pipeline {
} }
} }
post { post {
success { success {
emailext ( emailext (
subject: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS",
body: '''<!DOCTYPE html> body: """<!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
...@@ -248,29 +267,29 @@ pipeline { ...@@ -248,29 +267,29 @@ pipeline {
<td> <td>
<ul> <ul>
<div style="font-size:18px"> <div style="font-size:18px">
<li>构建名称>>分支:${PROJECT_NAME}</li> <li>构建名称>>分支:${env.BRANCH_NAME}</li>
<li>构建结果:<span style="color:green"> Successful </span></li> <li>构建结果:<span style="color:green"> Successful </span></li>
<li>构建编号:${BUILD_NUMBER}</li> <li>构建编号:${BUILD_NUMBER}</li>
<li>触发用户:${CAUSE}</li> <li>触发用户:${env.CHANGE_AUTHOR}</li>
<li>变更概要:${CHANGES}</li> <li>提交信息:${env.CHANGE_TITLE}</li>
<li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li> <li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
<li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li> <li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
<li>变更集:${JELLY_SCRIPT}</li>
</div> </div>
</ul> </ul>
</td> </td>
</tr> </tr>
</table></font> </table></font>
</body> </body>
</html>''', </html>""",
to: "yqliu@taosdata.com,pxiao@taosdata.com", to: "yqliu@taosdata.com,pxiao@taosdata.com",
from: "support@taosdata.com" from: "support@taosdata.com"
) )
} }
failure { failure {
emailext ( emailext (
subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' FAIL",
body: '''<!DOCTYPE html> body: """<!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
...@@ -286,21 +305,21 @@ pipeline { ...@@ -286,21 +305,21 @@ pipeline {
<td> <td>
<ul> <ul>
<div style="font-size:18px"> <div style="font-size:18px">
<li>构建名称>>分支:${PROJECT_NAME}</li> <li>构建名称>>分支:${env.BRANCH_NAME}</li>
<li>构建结果:<span style="color:green"> Successful </span></li> <li>构建结果:<span style="color:red"> Failure </span></li>
<li>构建编号:${BUILD_NUMBER}</li> <li>构建编号:${BUILD_NUMBER}</li>
<li>触发用户:${CAUSE}</li> <li>触发用户:${env.CHANGE_AUTHOR}</li>
<li>变更概要:${CHANGES}</li> <li>提交信息:${env.CHANGE_TITLE}</li>
<li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li> <li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
<li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li> <li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
<li>变更集:${JELLY_SCRIPT}</li>
</div> </div>
</ul> </ul>
</td> </td>
</tr> </tr>
</table></font> </table></font>
</body> </body>
</html>''', </html>""",
to: "yqliu@taosdata.com,pxiao@taosdata.com", to: "yqliu@taosdata.com,pxiao@taosdata.com",
from: "support@taosdata.com" from: "support@taosdata.com"
) )
......
def pre_test(){ def pre_test(){
sh '''
sudo rmtaos||echo 'no taosd installed'
'''
sh '''
cd ${WKC}
git reset --hard
git checkout $BRANCH_NAME
git pull
git submodule update
cd ${WK}
git reset --hard
git checkout $BRANCH_NAME
git pull
export TZ=Asia/Harbin
date
rm -rf ${WK}/debug
mkdir debug
cd debug
cmake -DMEMORY_SANITIZER=true .. > /dev/null
make > /dev/null
make install > /dev/null
pip3 install ${WKC}/src/connector/python/ || echo 0
'''
return 1
}
def pre_test_p(){
sh ''' sh '''
sudo rmtaos||echo 'no taosd installed' sudo rmtaos||echo 'no taosd installed'
''' '''
...@@ -39,7 +66,7 @@ pipeline { ...@@ -39,7 +66,7 @@ pipeline {
stage('pytest') { stage('pytest') {
agent{label 'slam1'} agent{label 'slam1'}
steps { steps {
pre_test() pre_test_p()
sh ''' sh '''
cd ${WKC}/tests cd ${WKC}/tests
find pytest -name '*'sql|xargs rm -rf find pytest -name '*'sql|xargs rm -rf
...@@ -92,7 +119,7 @@ pipeline { ...@@ -92,7 +119,7 @@ pipeline {
} }
sh''' sh'''
systemctl start taosd nohup taosd >/dev/null &
sleep 10 sleep 10
''' '''
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
...@@ -136,7 +163,7 @@ pipeline { ...@@ -136,7 +163,7 @@ pipeline {
''' '''
} }
sh ''' sh '''
systemctl stop taosd pkill -9 taosd
cd ${WKC}/tests cd ${WKC}/tests
./test-all.sh b2 ./test-all.sh b2
date date
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册