Jenkinsfile 10.6 KB
Newer Older
L
liuyq-617 已提交
1
def pre_test(){
L
fix  
liuyq-617 已提交
2 3 4 5
   
    sh '''
    sudo rmtaos||echo 'no taosd installed'
    '''
L
liuyq-617 已提交
6 7 8
    sh '''
    cd ${WKC}
    git reset --hard
L
liuyq-617 已提交
9
    git checkout $BRANCH_NAME
L
liuyq-617 已提交
10
    git pull
11
    git submodule update
L
liuyq-617 已提交
12
    cd ${WK}
13
    git reset --hard
L
liuyq-617 已提交
14
    git checkout $BRANCH_NAME
15
    git pull
L
liuyq-617 已提交
16 17 18 19 20 21 22 23
    export TZ=Asia/Harbin
    date
    rm -rf ${WK}/debug
    mkdir debug
    cd debug
    cmake .. > /dev/null
    make > /dev/null
    make install > /dev/null
24
    pip3 install ${WKC}/src/connector/python/linux/python3/
L
liuyq-617 已提交
25 26 27 28 29 30
    '''
    return 1
}
pipeline {
  agent none
  environment{
L
liuyq-617 已提交
31
    
L
liuyq-617 已提交
32 33 34
      WK = '/var/lib/jenkins/workspace/TDinternal'
      WKC= '/var/lib/jenkins/workspace/TDinternal/community'
  }
L
liuyq-617 已提交
35

L
liuyq-617 已提交
36 37 38
  stages {
      stage('Parallel test stage') {
      parallel {
39
        stage('pytest') {
L
liuyq-617 已提交
40
          agent{label 'slad1'}
L
liuyq-617 已提交
41 42 43 44
          steps {
            pre_test()
            sh '''
            cd ${WKC}/tests
L
liuyq-617 已提交
45
            find pytest -name '*'sql|xargs rm -rf
46
            ./test-all.sh pytest
L
liuyq-617 已提交
47 48 49 50 51 52 53
            date'''
          }
        }
        stage('test_b1') {
          agent{label 'master'}
          steps {
            pre_test()
L
liuyq-617 已提交
54
            
L
liuyq-617 已提交
55 56 57
            sh '''
            cd ${WKC}/tests
            ./test-all.sh b1
P
Ping Xiao 已提交
58
            date'''
59 60
            
            
L
liuyq-617 已提交
61 62
          }
        }
L
liuyq-617 已提交
63

L
liuyq-617 已提交
64
        stage('test_crash_gen') {
L
liuyq-617 已提交
65
          agent{label "slad2"}
L
liuyq-617 已提交
66 67
          steps {
            pre_test()
68 69 70
            sh '''
            cd ${WKC}/tests/pytest
            '''
L
liuyq-617 已提交
71 72 73 74 75 76 77 78 79
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WKC}/tests/pytest
                ./crash_gen.sh -a -p -t 4 -s 2000
                '''
            }
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WKC}/tests/pytest
R
root 已提交
80 81
                rm -rf /var/lib/taos/*
                rm -rf /var/log/taos/*
L
liuyq-617 已提交
82 83 84
                ./handle_crash_gen_val_log.sh
                '''
            }
R
root 已提交
85 86 87 88 89 90 91 92 93
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WKC}/tests/pytest
                rm -rf /var/lib/taos/*
                rm -rf /var/log/taos/*
                ./handle_taosd_val_log.sh
                '''
            }
            
94
            sh'''
L
liuyq-617 已提交
95 96
            systemctl start taosd 
            sleep 10
L
liuyq-617 已提交
97
            '''
98 99
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
L
liuyq-617 已提交
100
                cd ${WKC}/tests/gotest
101 102 103 104 105
                bash batchtest.sh
                '''
            }
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
L
liuyq-617 已提交
106
                cd ${WKC}/tests/examples/python/PYTHONConnectorChecker
107 108 109 110 111
                python3 PythonChecker.py
                '''
            }
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
L
liuyq-617 已提交
112 113
                cd ${WKC}/tests/examples/JDBC/JDBCDemo/
                mvn clean package assembly:single -DskipTests >/dev/null 
114
                java -jar target/JDBCDemo-SNAPSHOT-jar-with-dependencies.jar -host 127.0.0.1
115 116
                '''
            }
L
liuyq-617 已提交
117 118 119 120 121 122 123 124
            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
                '''
            }
125 126 127 128 129 130 131
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cp -rf ${WKC}/tests/examples/nodejs ${JENKINS_HOME}/workspace/
                cd ${JENKINS_HOME}/workspace/nodejs
                node nodejsChecker.js host=localhost
                '''
            }
132 133 134 135 136 137
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${JENKINS_HOME}/workspace/C#NET/src/CheckC#
                dotnet run
                '''
            }
L
liuyq-617 已提交
138 139 140 141 142 143
            sh '''
            systemctl stop taosd 
            cd ${WKC}/tests
            ./test-all.sh b2
            date
            '''
144 145 146 147
            sh '''
            cd ${WKC}/tests
            ./test-all.sh full unit
            date'''
L
liuyq-617 已提交
148 149 150 151
          }
        }

        stage('test_valgrind') {
L
liuyq-617 已提交
152
          agent{label "slad3"}
L
liuyq-617 已提交
153 154 155 156 157 158 159 160 161 162 163 164 165

          steps {
            pre_test()
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WKC}/tests/pytest
                nohup taosd >/dev/null &
                sleep 10
                python3 concurrent_inquiry.py -c 1
                
                '''
            }
            sh '''
166 167 168 169
            cd ${WKC}/tests
            ./test-all.sh full jdbc
            date'''
            sh '''
L
liuyq-617 已提交
170 171 172
            cd ${WKC}/tests/pytest
            ./valgrind-test.sh 2>&1 > mem-error-out.log
            ./handle_val_log.sh
L
liuyq-617 已提交
173
          
L
liuyq-617 已提交
174 175 176 177
            date
            cd ${WKC}/tests
            ./test-all.sh b3
            date'''
178 179 180 181 182
            sh '''
            date
            cd ${WKC}/tests
            ./test-all.sh full example
            date'''
L
liuyq-617 已提交
183 184 185
          }
        }
       
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
       stage('arm64_build'){
                agent{label 'arm64'}
                steps{
                    sh '''
                    cd ${WK}
                    git fetch
                    git checkout develop
                    git pull
                    cd ${WKC}
                    git fetch
                    git checkout develop
                    git pull
                    git submodule update                    
                    cd ${WKC}/packaging
                    ./release.sh -v cluster -c aarch64 -n 2.0.0.0 -m 2.0.0.0
                    
                    '''
                }
            }
            stage('arm32_build'){
                agent{label 'arm32'}
                steps{
                    catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                        sh '''
                        cd ${WK}
                        git fetch
                        git checkout develop
                        git pull
                        cd ${WKC}
                        git fetch
                        git checkout develop
                        git pull
                        git submodule update
                        cd ${WKC}/packaging
                        ./release.sh -v cluster -c aarch32 -n 2.0.0.0 -m 2.0.0.0
                        
                        '''
                    }
                    
                }
            }
L
liuyq-617 已提交
227 228
      }
    }
L
liuyq-617 已提交
229

L
liuyq-617 已提交
230
  }
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
  post {             
        success {
            emailext (
                subject: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
                body: '''<!DOCTYPE html>
                <html>
                <head>
                <meta charset="UTF-8">
                </head>
                <body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4" offset="0">
                    <table width="95%" cellpadding="0" cellspacing="0" style="font-size: 16pt; font-family: Tahoma, Arial, Helvetica, sans-serif">
                        <tr>
                            <td><br />
                                <b><font color="#0B610B"><font size="6">构建信息</font></font></b>
                                <hr size="2" width="100%" align="center" /></td>
                        </tr>
                        <tr>
                            <td>
                                <ul>
                                <div style="font-size:18px">
                                    <li>构建名称>>分支:${PROJECT_NAME}</li>
                                    <li>构建结果:<span style="color:green"> Successful </span></li>
                                    <li>构建编号:${BUILD_NUMBER}</li>
                                    <li>触发用户:${CAUSE}</li>
                                    <li>变更概要:${CHANGES}</li>
                                    <li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
                                    <li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
                                    <li>变更集:${JELLY_SCRIPT}</li>
                                </div>
                                </ul>
                            </td>
                        </tr>
                    </table></font>
                </body>
                </html>''',
                to: "yqliu@taosdata.com,pxiao@taosdata.com",
                from: "support@taosdata.com"
            )
        }
        failure {
            emailext (
                subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
                body: '''<!DOCTYPE html>
                <html>
                <head>
                <meta charset="UTF-8">
                </head>
                <body leftmargin="8" marginwidth="0" topmargin="8" marginheight="4" offset="0">
                    <table width="95%" cellpadding="0" cellspacing="0" style="font-size: 16pt; font-family: Tahoma, Arial, Helvetica, sans-serif">
                        <tr>
                            <td><br />
                                <b><font color="#0B610B"><font size="6">构建信息</font></font></b>
                                <hr size="2" width="100%" align="center" /></td>
                        </tr>
                        <tr>
                            <td>
                                <ul>
                                <div style="font-size:18px">
                                    <li>构建名称>>分支:${PROJECT_NAME}</li>
                                    <li>构建结果:<span style="color:green"> Successful </span></li>
                                    <li>构建编号:${BUILD_NUMBER}</li>
                                    <li>触发用户:${CAUSE}</li>
                                    <li>变更概要:${CHANGES}</li>
                                    <li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
                                    <li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
                                    <li>变更集:${JELLY_SCRIPT}</li>
                                </div>
                                </ul>
                            </td>
                        </tr>
                    </table></font>
                </body>
                </html>''',
                to: "yqliu@taosdata.com,pxiao@taosdata.com",
                from: "support@taosdata.com"
            )
        }
    }
}