Jenkinsfile 10.5 KB
Newer Older
L
liuyq-617 已提交
1
def pre_test(){
L
fix  
liuyq-617 已提交
2
   
L
liuyq-617 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
    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(){
   
L
fix  
liuyq-617 已提交
30 31 32
    sh '''
    sudo rmtaos||echo 'no taosd installed'
    '''
L
liuyq-617 已提交
33 34 35
    sh '''
    cd ${WKC}
    git reset --hard
L
liuyq-617 已提交
36
    git checkout $BRANCH_NAME
L
liuyq-617 已提交
37
    git pull
38
    git submodule update
L
liuyq-617 已提交
39
    cd ${WK}
40
    git reset --hard
L
liuyq-617 已提交
41
    git checkout $BRANCH_NAME
42
    git pull
L
liuyq-617 已提交
43 44 45 46 47 48 49 50
    export TZ=Asia/Harbin
    date
    rm -rf ${WK}/debug
    mkdir debug
    cd debug
    cmake .. > /dev/null
    make > /dev/null
    make install > /dev/null
51
    pip3 install ${WKC}/src/connector/python
L
liuyq-617 已提交
52 53 54 55 56 57
    '''
    return 1
}
pipeline {
  agent none
  environment{
L
liuyq-617 已提交
58
    
L
liuyq-617 已提交
59 60
      WK = '/data/lib/jenkins/workspace/TDinternal'
      WKC= '/data/lib/jenkins/workspace/TDinternal/community'
L
liuyq-617 已提交
61
  }
L
liuyq-617 已提交
62

L
liuyq-617 已提交
63 64 65
  stages {
      stage('Parallel test stage') {
      parallel {
66
        stage('pytest') {
L
liuyq-617 已提交
67
          agent{label 'slad1'}
L
liuyq-617 已提交
68
          steps {
L
liuyq-617 已提交
69
            pre_test_p()
L
liuyq-617 已提交
70 71
            sh '''
            cd ${WKC}/tests
L
liuyq-617 已提交
72
            find pytest -name '*'sql|xargs rm -rf
73
            ./test-all.sh pytest
L
liuyq-617 已提交
74 75 76 77
            date'''
          }
        }
        stage('test_b1') {
L
liuyq-617 已提交
78
          agent{label 'slad2'}
L
liuyq-617 已提交
79 80
          steps {
            pre_test()
L
liuyq-617 已提交
81
            
L
liuyq-617 已提交
82 83 84
            sh '''
            cd ${WKC}/tests
            ./test-all.sh b1
P
Ping Xiao 已提交
85
            date'''
86 87
            
            
L
liuyq-617 已提交
88 89
          }
        }
L
liuyq-617 已提交
90

L
liuyq-617 已提交
91
        stage('test_crash_gen') {
L
liuyq-617 已提交
92
          agent{label "slad3"}
L
liuyq-617 已提交
93 94
          steps {
            pre_test()
95 96 97
            sh '''
            cd ${WKC}/tests/pytest
            '''
L
liuyq-617 已提交
98 99 100 101 102 103 104 105 106
            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 已提交
107 108
                rm -rf /var/lib/taos/*
                rm -rf /var/log/taos/*
L
liuyq-617 已提交
109 110 111
                ./handle_crash_gen_val_log.sh
                '''
            }
R
root 已提交
112 113 114 115 116 117 118 119 120
            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
                '''
            }
            
121
            sh'''
L
liuyq-617 已提交
122
            nohup taosd >/dev/null & 
L
liuyq-617 已提交
123
            sleep 10
L
liuyq-617 已提交
124
            '''
125 126
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
L
liuyq-617 已提交
127
                cd ${WKC}/tests/gotest
128 129 130 131 132
                bash batchtest.sh
                '''
            }
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
L
liuyq-617 已提交
133
                cd ${WKC}/tests/examples/python/PYTHONConnectorChecker
134 135 136 137 138
                python3 PythonChecker.py
                '''
            }
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
L
liuyq-617 已提交
139
                cd ${WKC}/tests/examples/JDBC/JDBCDemo/
L
liuyq-617 已提交
140 141
                mvn clean package >/dev/null 
                java -jar target/JdbcRestfulDemo-jar-with-dependencies.jar
L
liuyq-617 已提交
142 143
                '''
            }
144 145 146 147 148 149 150
            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
                '''
            }
151 152 153 154 155 156
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${JENKINS_HOME}/workspace/C#NET/src/CheckC#
                dotnet run
                '''
            }
L
liuyq-617 已提交
157
            sh '''
L
liuyq-617 已提交
158
            pkill -9 taosd 
L
liuyq-617 已提交
159 160 161 162
            cd ${WKC}/tests
            ./test-all.sh b2
            date
            '''
163 164 165 166
            sh '''
            cd ${WKC}/tests
            ./test-all.sh full unit
            date'''
L
liuyq-617 已提交
167 168 169 170
          }
        }

        stage('test_valgrind') {
L
liuyq-617 已提交
171
          agent{label "slad4"}
L
liuyq-617 已提交
172 173 174 175 176 177 178 179 180 181 182 183 184

          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 '''
185 186 187 188
            cd ${WKC}/tests
            ./test-all.sh full jdbc
            date'''
            sh '''
L
liuyq-617 已提交
189 190 191
            cd ${WKC}/tests/pytest
            ./valgrind-test.sh 2>&1 > mem-error-out.log
            ./handle_val_log.sh
L
liuyq-617 已提交
192
          
L
liuyq-617 已提交
193 194 195 196
            date
            cd ${WKC}/tests
            ./test-all.sh b3
            date'''
197 198 199 200 201
            sh '''
            date
            cd ${WKC}/tests
            ./test-all.sh full example
            date'''
L
liuyq-617 已提交
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 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
       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 已提交
246 247
      }
    }
L
liuyq-617 已提交
248

L
liuyq-617 已提交
249
  }
L
liuyq-617 已提交
250
  post {  
251 252
        success {
            emailext (
L
liuyq-617 已提交
253 254
                subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS",
                body: """<!DOCTYPE html>
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
                <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">
L
liuyq-617 已提交
270
                                    <li>构建名称>>分支:${env.BRANCH_NAME}</li>
271 272
                                    <li>构建结果:<span style="color:green"> Successful </span></li>
                                    <li>构建编号:${BUILD_NUMBER}</li>
L
liuyq-617 已提交
273 274
                                    <li>触发用户:${env.CHANGE_AUTHOR}</li>
                                    <li>提交信息:${env.CHANGE_TITLE}</li>
275 276
                                    <li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
                                    <li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
L
liuyq-617 已提交
277
                                    
278 279 280 281 282 283
                                </div>
                                </ul>
                            </td>
                        </tr>
                    </table></font>
                </body>
L
liuyq-617 已提交
284
                </html>""",
285 286 287 288 289 290
                to: "yqliu@taosdata.com,pxiao@taosdata.com",
                from: "support@taosdata.com"
            )
        }
        failure {
            emailext (
L
liuyq-617 已提交
291 292
                subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' FAIL",
                body: """<!DOCTYPE html>
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
                <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">
L
liuyq-617 已提交
308 309
                                    <li>构建名称>>分支:${env.BRANCH_NAME}</li>
                                    <li>构建结果:<span style="color:red"> Failure </span></li>
310
                                    <li>构建编号:${BUILD_NUMBER}</li>
L
liuyq-617 已提交
311 312
                                    <li>触发用户:${env.CHANGE_AUTHOR}</li>
                                    <li>提交信息:${env.CHANGE_TITLE}</li>
313 314
                                    <li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
                                    <li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
L
liuyq-617 已提交
315
                                    
316 317 318 319 320 321
                                </div>
                                </ul>
                            </td>
                        </tr>
                    </table></font>
                </body>
L
liuyq-617 已提交
322
                </html>""",
323 324 325 326 327 328
                to: "yqliu@taosdata.com,pxiao@taosdata.com",
                from: "support@taosdata.com"
            )
        }
    }
}