Jenkinsfile 20.9 KB
Newer Older
L
liuyq-617 已提交
1
import hudson.model.Result
L
liuyq-617 已提交
2
import hudson.model.*;
L
liuyq-617 已提交
3
import jenkins.model.CauseOfInterruption
4 5 6
node {
}

L
liuyq-617 已提交
7 8 9
def skipbuild = 0
def win_stop = 0
def scope = []
L
liuyq-617 已提交
10
def mod = [0,1,2,3,4]
L
liuyq-617 已提交
11
def sim_mod = [0,1,2,3]
L
liuyq-617 已提交
12

L
recover  
liuyq-617 已提交
13 14 15 16 17
def abortPreviousBuilds() {
  def currentJobName = env.JOB_NAME
  def currentBuildNumber = env.BUILD_NUMBER.toInteger()
  def jobs = Jenkins.instance.getItemByFullName(currentJobName)
  def builds = jobs.getBuilds()
18

L
recover  
liuyq-617 已提交
19 20 21 22
  for (build in builds) {
    if (!build.isBuilding()) {
      continue;
    }
L
liuyq-617 已提交
23

L
recover  
liuyq-617 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37
    if (currentBuildNumber == build.getNumber().toInteger()) {
      continue;
    }

    build.doKill()    //doTerm(),doKill(),doTerm()
  }
}
//  abort previous build
abortPreviousBuilds()
def abort_previous(){
  def buildNumber = env.BUILD_NUMBER as int
  if (buildNumber > 1) milestone(buildNumber - 1)
  milestone(buildNumber)
}
38
def pre_test(){
L
liuyq-617 已提交
39
    sh'hostname'
L
liuyq-617 已提交
40 41 42
    sh '''
    sudo rmtaos || echo "taosd has not installed"
    '''
L
liuyq-617 已提交
43
    sh '''
44 45
    kill -9 $(pidof taosd) ||echo "no taosd running"
    kill -9 $(pidof taosadapter) ||echo "no taosadapter running"
L
fix  
liuyq-617 已提交
46
    killall -9 gdb || echo "no gdb running"
L
liuyq-617 已提交
47
    killall -9 python3.8 || echo "no python program running"
48
    cd ${WKC}
L
liuyq-617 已提交
49
    [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md"
50
    git reset --hard HEAD~10 >/dev/null
L
fix  
liuyq-617 已提交
51 52 53
    '''
    script {
      if (env.CHANGE_TARGET == 'master') {
L
fix  
liuyq-617 已提交
54
        sh '''
55 56
        cd ${WKC}
        git checkout master
L
fix  
liuyq-617 已提交
57
        '''
L
fix  
liuyq-617 已提交
58
        }
59
      else if(env.CHANGE_TARGET == '2.0'){
L
fix  
liuyq-617 已提交
60
        sh '''
61 62
        cd ${WKC}
        git checkout 2.0
L
fix  
liuyq-617 已提交
63
        '''
64
      }
65 66
      else{
        sh '''
67 68
        cd ${WKC}
        git checkout develop
69 70
        '''
      }
L
fix  
liuyq-617 已提交
71 72
    }
    sh'''
L
fix  
liuyq-617 已提交
73
    cd ${WKC}
74
    git remote prune origin
75 76
    [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md"
    git pull >/dev/null
L
liuyq-617 已提交
77
    git fetch origin +refs/pull/${CHANGE_ID}/merge
78
    git checkout -qf FETCH_HEAD
79
    git clean -dfx
80
    git submodule update --init --recursive
81 82
    cd ${WK}
    git reset --hard HEAD~10
L
fix  
liuyq-617 已提交
83
    '''
84 85 86 87 88 89 90 91 92 93 94 95
    script {
      if (env.CHANGE_TARGET == 'master') {
        sh '''
        cd ${WK}
        git checkout master
        '''
        }
      else if(env.CHANGE_TARGET == '2.0'){
        sh '''
        cd ${WK}
        git checkout 2.0
        '''
96
      }
97 98 99 100 101
      else{
        sh '''
        cd ${WK}
        git checkout develop
        '''
102
      }
103
    }
L
fix  
liuyq-617 已提交
104
    sh '''
105
    cd ${WK}
106 107
    git pull >/dev/null

108 109
    export TZ=Asia/Harbin
    date
110
    git clean -dfx
111 112
    mkdir debug
    cd debug
113
    cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true > /dev/null
114 115 116
    make > /dev/null
    make install > /dev/null
    cd ${WKC}/tests
117
    pip3 install ${WKC}/src/connector/python/
L
update  
liuyq-617 已提交
118 119 120 121 122 123
    '''
    return 1
}
def pre_test_noinstall(){
    sh'hostname'
    sh'''
124
    cd ${WKC}
L
liuyq-617 已提交
125
    [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md"
126
    git reset --hard HEAD~10 >/dev/null
L
update  
liuyq-617 已提交
127 128 129 130
    '''
    script {
      if (env.CHANGE_TARGET == 'master') {
        sh '''
131 132
        cd ${WKC}
        git checkout master
L
update  
liuyq-617 已提交
133 134 135 136
        '''
        }
      else if(env.CHANGE_TARGET == '2.0'){
        sh '''
137 138
        cd ${WKC}
        git checkout 2.0
L
update  
liuyq-617 已提交
139
        '''
140
      }
L
update  
liuyq-617 已提交
141 142
      else{
        sh '''
143 144
        cd ${WKC}
        git checkout develop
L
update  
liuyq-617 已提交
145 146 147 148 149
        '''
      }
    }
    sh'''
    cd ${WKC}
150
    git remote prune origin
151 152
    [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md"
    git pull >/dev/null
L
update  
liuyq-617 已提交
153 154
    git fetch origin +refs/pull/${CHANGE_ID}/merge
    git checkout -qf FETCH_HEAD
155
    git clean -dfx
L
update  
liuyq-617 已提交
156
    git submodule update --init --recursive
157 158
    cd ${WK}
    git reset --hard HEAD~10
L
update  
liuyq-617 已提交
159
    '''
160 161 162 163 164 165 166 167 168 169 170 171
    script {
      if (env.CHANGE_TARGET == 'master') {
        sh '''
        cd ${WK}
        git checkout master
        '''
        }
      else if(env.CHANGE_TARGET == '2.0'){
        sh '''
        cd ${WK}
        git checkout 2.0
        '''
172
      }
173 174 175 176 177
      else{
        sh '''
        cd ${WK}
        git checkout develop
        '''
178
      }
179
    }
L
update  
liuyq-617 已提交
180
    sh '''
181
    cd ${WK}
182 183
    git pull >/dev/null

L
update  
liuyq-617 已提交
184 185
    export TZ=Asia/Harbin
    date
186
    git clean -dfx
L
update  
liuyq-617 已提交
187 188
    mkdir debug
    cd debug
189
    cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=false > /dev/null
190
    make
L
liuyq-617 已提交
191
    '''
192 193
    return 1
}
L
liuyq-617 已提交
194 195 196
def pre_test_mac(){
    sh'hostname'
    sh'''
197
    cd ${WKC}
L
liuyq-617 已提交
198
    [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md"
199
    git reset --hard HEAD~10 >/dev/null
L
liuyq-617 已提交
200 201 202 203
    '''
    script {
      if (env.CHANGE_TARGET == 'master') {
        sh '''
204 205
        cd ${WKC}
        git checkout master
L
liuyq-617 已提交
206 207 208 209
        '''
        }
      else if(env.CHANGE_TARGET == '2.0'){
        sh '''
210 211
        cd ${WKC}
        git checkout 2.0
L
liuyq-617 已提交
212
        '''
213
      }
L
liuyq-617 已提交
214 215
      else{
        sh '''
216 217
        cd ${WKC}
        git checkout develop
L
liuyq-617 已提交
218 219 220 221 222
        '''
      }
    }
    sh'''
    cd ${WKC}
223
    git remote prune origin
224 225
    [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md"
    git pull >/dev/null
L
liuyq-617 已提交
226 227
    git fetch origin +refs/pull/${CHANGE_ID}/merge
    git checkout -qf FETCH_HEAD
228
    git clean -dfx
L
liuyq-617 已提交
229
    git submodule update --init --recursive
230 231
    cd ${WK}
    git reset --hard HEAD~10
L
liuyq-617 已提交
232
    '''
233 234 235 236 237 238 239 240 241 242 243 244
    script {
      if (env.CHANGE_TARGET == 'master') {
        sh '''
        cd ${WK}
        git checkout master
        '''
        }
      else if(env.CHANGE_TARGET == '2.0'){
        sh '''
        cd ${WK}
        git checkout 2.0
        '''
245
      }
246 247 248 249 250
      else{
        sh '''
        cd ${WK}
        git checkout develop
        '''
251
      }
252
    }
L
liuyq-617 已提交
253
    sh '''
254
    cd ${WK}
255 256
    git pull >/dev/null

L
liuyq-617 已提交
257 258
    export TZ=Asia/Harbin
    date
259
    git clean -dfx
L
liuyq-617 已提交
260 261
    mkdir debug
    cd debug
262
    cmake .. -DBUILD_TOOLS=false > /dev/null
263 264
    go env -w GOPROXY=https://goproxy.cn,direct
    go env -w GO111MODULE=on
L
liuyq-617 已提交
265 266 267 268
    cmake --build .
    '''
    return 1
}
269 270
def pre_test_win(){
    bat '''
L
update  
liuyq-617 已提交
271
    taskkill /f /t /im python.exe
272 273
    cd C:\\
    rd /s /Q C:\\TDengine
274 275 276
    cd C:\\workspace\\TDinternal
    rd /s /Q C:\\workspace\\TDinternal\\debug
    cd C:\\workspace\\TDinternal\\community
277
    git reset --hard HEAD~10
278 279 280 281
    '''
    script {
      if (env.CHANGE_TARGET == 'master') {
        bat '''
282 283
        cd C:\\workspace\\TDinternal\\community
        git checkout master
284 285 286 287
        '''
        }
      else if(env.CHANGE_TARGET == '2.0'){
        bat '''
288 289
        cd C:\\workspace\\TDinternal\\community
        git checkout 2.0
290
        '''
291
      }
292 293
      else{
        bat '''
294 295
        cd C:\\workspace\\TDinternal\\community
        git checkout develop
296 297 298 299 300
        '''
      }
    }
    bat'''
    cd C:\\workspace\\TDinternal\\community
301 302
    git remote prune origin
    git pull
L
liuyq-617 已提交
303
    git fetch origin +refs/pull/%CHANGE_ID%/merge
304
    git checkout -qf FETCH_HEAD
305
    git clean -dfx
306
    git submodule update --init --recursive
307 308
    cd C:\\workspace\\TDinternal
    git reset --hard HEAD~10
309
    '''
310 311 312 313 314 315 316 317 318 319 320 321
    script {
      if (env.CHANGE_TARGET == 'master') {
        bat '''
        cd C:\\workspace\\TDinternal
        git checkout master
        '''
        }
      else if(env.CHANGE_TARGET == '2.0'){
        bat '''
        cd C:\\workspace\\TDinternal
        git checkout 2.0
        '''
322
      }
323 324 325 326 327
      else{
        bat '''
        cd C:\\workspace\\TDinternal
        git checkout develop
        '''
328
      }
329
    }
330 331
    bat '''
    cd C:\\workspace\\TDinternal
332
    git pull
333

334
    date
335
    git clean -dfx
336 337
    mkdir debug
    cd debug
L
liuyq-617 已提交
338
    call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" amd64
339
    cmake ../ -G "NMake Makefiles"
L
liuyq-617 已提交
340
    set CL=/MP nmake nmake || exit 8
L
update  
liuyq-617 已提交
341
    nmake install || exit 8
L
liuyq-617 已提交
342
    xcopy /e/y/i/f C:\\workspace\\TDinternal\\debug\\build\\lib\\taos.dll C:\\Windows\\System32 || exit 8
343 344
    cd C:\\workspace\\TDinternal\\community\\src\\connector\\python
    python -m pip install .
345

346 347 348
    '''
    return 1
}
Y
Yiqing Liu 已提交
349
pipeline {
L
liuyq-617 已提交
350
  agent none
351
  options { skipDefaultCheckout() }
L
liuyq-617 已提交
352 353 354 355
  environment{
      WK = '/var/lib/jenkins/workspace/TDinternal'
      WKC= '/var/lib/jenkins/workspace/TDinternal/community'
  }
Y
Yiqing Liu 已提交
356
  stages {
L
change  
liuyq-617 已提交
357
      stage('pre_build'){
L
liuyq-617 已提交
358
          agent{label 'catalina'}
359
          options { skipDefaultCheckout() }
L
liuyq-617 已提交
360 361 362
          when {
              changeRequest()
          }
363
          steps {
L
change  
liuyq-617 已提交
364 365 366
            script{
              abort_previous()
              abortPreviousBuilds()
L
liuyq-617 已提交
367
              println env.CHANGE_BRANCH
L
liuyq-617 已提交
368
              if(env.CHANGE_FORK){
369
                scope = ['connector','query','insert','other','tools','taosAdapter']
L
liuyq-617 已提交
370 371 372
              }
              else{
                sh'''
L
liuyq-617 已提交
373
                  cd ${WKC}
374
                  git reset --hard HEAD~10
L
liuyq-617 已提交
375 376 377
                  git fetch
                  git checkout ${CHANGE_BRANCH}
                  git pull
L
liuyq-617 已提交
378
                '''
L
liuyq-617 已提交
379 380 381
                dir('/var/lib/jenkins/workspace/TDinternal/community'){
                  gitlog = sh(script: "git log -1 --pretty=%B ", returnStdout:true)
                  println gitlog
L
liuyq-617 已提交
382
                  if (!(gitlog =~ /\((.*?)\)/)){
L
liuyq-617 已提交
383
                    autoCancelled = true
384
                    error('Please fill in the scope information correctly.\neg. [TD-xxxx]<fix>(query,insert):xxxxxxxxxxxxxxxxxx ')
L
liuyq-617 已提交
385
                  }
L
liuyq-617 已提交
386
                  temp = (gitlog =~ /\((.*?)\)/)
L
liuyq-617 已提交
387 388
                  temp = temp[0].remove(1)
                  scope = temp.split(",")
L
liuyq-617 已提交
389
                  scope = ['connector','query','insert','other','tools','taosAdapter']
L
liuyq-617 已提交
390
                  Collections.shuffle mod
L
liuyq-617 已提交
391
                  Collections.shuffle sim_mod
L
liuyq-617 已提交
392
                }
393

L
liuyq-617 已提交
394 395
              }
            }    
396 397
          }
      }
L
change  
liuyq-617 已提交
398
      stage('Parallel test stage') {
L
liuyq-617 已提交
399
        //only build pr
400
        options { skipDefaultCheckout() }
L
liuyq-617 已提交
401
        when {
L
liuyq-617 已提交
402
          allOf{
L
liuyq-617 已提交
403
              changeRequest()
404
              not{ expression { env.CHANGE_BRANCH =~ /docs\// }}
L
liuyq-617 已提交
405
            }
L
liuyq-617 已提交
406
          }
Y
Yiqing Liu 已提交
407
      parallel {
L
liuyq-617 已提交
408
        stage('python_1') {
L
liuyq-617 已提交
409
          agent{label " slave1 || slave11 "}
L
liuyq-617 已提交
410
          steps {
411
            pre_test()
C
cpwu 已提交
412
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
413 414 415 416 417
              script{
                scope.each {
                  sh """
                    date
                    cd ${WKC}/tests
L
liuyq-617 已提交
418
                    ./test-CI.sh ${it} 5 ${mod[0]}
L
liuyq-617 已提交
419 420 421 422
                    date"""
                  }
                }
            }            
L
liuyq-617 已提交
423 424
          }
        }
L
liuyq-617 已提交
425
        stage('python_2') {
L
liuyq-617 已提交
426
          agent{label " slave2 || slave12 "}
L
liuyq-617 已提交
427 428
          steps {
            pre_test()
C
cpwu 已提交
429
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
430 431 432 433 434
                 script{
                  scope.each {
                    sh """
                      date
                      cd ${WKC}/tests
L
liuyq-617 已提交
435
                      ./test-CI.sh ${it} 5 ${mod[1]} 
L
liuyq-617 已提交
436 437 438
                      date"""
                    }
                }
L
liuyq-617 已提交
439
            }
L
liuyq-617 已提交
440 441
          }
        }
L
liuyq-617 已提交
442
        stage('python_3') {
L
liuyq-617 已提交
443
          agent{label " slave3 || slave13 "}
444
          steps {
445
            timeout(time: 105, unit: 'MINUTES'){
L
liuyq-617 已提交
446
              pre_test()
L
liuyq-617 已提交
447 448 449 450 451
              script{
              scope.each {
                sh """
                  date
                  cd ${WKC}/tests
L
liuyq-617 已提交
452
                  ./test-CI.sh ${it} 5 ${mod[2]}
L
liuyq-617 已提交
453 454
                  date"""
                }
455
              }
L
liuyq-617 已提交
456
            }
Y
Yiqing Liu 已提交
457 458
          }
        }
L
liuyq-617 已提交
459
        stage('python_4') {
L
liuyq-617 已提交
460
          agent{label " slave4 || slave14 "}
461
          steps {
C
cpwu 已提交
462
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
463
              pre_test()
L
liuyq-617 已提交
464 465 466 467 468
              script{
              scope.each {
                sh """
                  date
                  cd ${WKC}/tests
L
liuyq-617 已提交
469
                  ./test-CI.sh ${it} 5 ${mod[3]}
L
liuyq-617 已提交
470 471 472 473
                  date"""
                }
              }
          
L
liuyq-617 已提交
474 475 476
            }
          }
        }
L
liuyq-617 已提交
477
        stage('python_5') {
L
liuyq-617 已提交
478
          agent{label " slave5 || slave15 "}
479
          steps {
C
cpwu 已提交
480
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
481
              pre_test()
L
liuyq-617 已提交
482 483 484 485 486
              script{
              scope.each {
                sh """
                  date
                  cd ${WKC}/tests
L
liuyq-617 已提交
487
                  ./test-CI.sh ${it} 5 ${mod[4]}
L
liuyq-617 已提交
488 489 490 491
                  date"""
                }
              }
          
L
liuyq-617 已提交
492 493
            }
          }
494
        }
L
liuyq-617 已提交
495 496 497 498 499 500 501 502 503 504
        stage('sim_1') {
          agent{label " slave6 || slave16 "}
          steps {
            pre_test()
            timeout(time: 100, unit: 'MINUTES'){
                  sh """
                    date
                    cd ${WKC}/tests
                    ./test-CI.sh sim 4 ${sim_mod[0]}
                    date"""
L
liuyq-617 已提交
505 506
              }
          }            
L
liuyq-617 已提交
507 508 509 510 511 512
        }
        stage('sim_2') {
          agent{label " slave7 || slave17 "}
          steps {
            pre_test()
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
513 514 515 516 517
              sh """
                date
                cd ${WKC}/tests
                ./test-CI.sh sim 4 ${sim_mod[1]} 
                date"""
L
liuyq-617 已提交
518 519 520 521 522 523 524 525
            }
          }
        }
        stage('sim_3') {
          agent{label " slave8 || slave18 "}
          steps {
            timeout(time: 105, unit: 'MINUTES'){
              pre_test()
L
liuyq-617 已提交
526 527 528 529 530
              sh """
                date
                cd ${WKC}/tests
                ./test-CI.sh sim 4 ${sim_mod[2]}
                date"""
L
liuyq-617 已提交
531 532 533 534 535 536 537 538
            }
          }
        }
        stage('sim_4') {
          agent{label " slave9 || slave19 "}
          steps {
            timeout(time: 100, unit: 'MINUTES'){
              pre_test()
L
liuyq-617 已提交
539 540 541 542 543
              sh """
                date
                cd ${WKC}/tests
                ./test-CI.sh sim 4 ${sim_mod[3]}
                date"""
L
liuyq-617 已提交
544 545
              }
            }
L
liuyq-617 已提交
546
          
L
liuyq-617 已提交
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587
        }
        stage('other') {
          agent{label " slave10 || slave20 "}
          steps {
            timeout(time: 100, unit: 'MINUTES'){
              pre_test()
              timeout(time: 60, unit: 'MINUTES'){
                sh '''
                cd ${WKC}/tests/pytest
                ./crash_gen.sh -a -p -t 4 -s 2000
                '''
              }
              timeout(time: 60, unit: 'MINUTES'){
                sh '''
                cd ${WKC}/tests/pytest
                rm -rf /var/lib/taos/*
                rm -rf /var/log/taos/*
                ./handle_crash_gen_val_log.sh
                '''
                sh '''
                cd ${WKC}/tests/pytest
                rm -rf /var/lib/taos/*
                rm -rf /var/log/taos/*
                ./handle_taosd_val_log.sh
                '''
              }
              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WKC}/tests/pytest
                ./valgrind-test.sh 2>&1 > mem-error-out.log
                ./handle_val_log.sh
                '''
              } 
              sh '''
                cd ${WKC}/tests
                ./test-all.sh full unit
                date
              '''
            }
          }
        }
L
liuyq-617 已提交
588 589
        stage('centos7') {
          agent{label " centos7 "}
590 591
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
592 593 594 595
            }
        }
        stage('ubuntu:trusty') {
          agent{label " trusty "}
596 597
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
598 599 600 601
            }
        }
        stage('ubuntu:xenial') {
          agent{label " xenial "}
602 603
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
604 605 606 607
            }
        }
        stage('ubuntu:bionic') {
          agent{label " bionic "}
608 609
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
610 611
            }
        }
L
liuyq-617 已提交
612 613
        stage('Mac_build') {
          agent{label " catalina "}
614 615
          steps {
              pre_test_mac()
L
liuyq-617 已提交
616 617
            }
        }
L
liuyq-617 已提交
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
        stage('arm64centos7') {
          agent{label " arm64centos7 "}
          steps {     
              pre_test_noinstall()    
            }
        }
        stage('arm64centos8') {
          agent{label " arm64centos8 "}
          steps {     
              pre_test_noinstall()    
            }
        }
        stage('arm32bionic') {
          agent{label " arm32bionic "}
          steps {     
              pre_test_noinstall()    
            }
        }
        stage('arm64bionic') {
          agent{label " arm64bionic "}
          steps {     
              pre_test_noinstall()    
            }
        }
        stage('arm64focal') {
          agent{label " arm64focal "}
          steps {     
              pre_test_noinstall()    
            }
        }
        stage('build'){
          agent{label " wintest "}
          steps {
            pre_test()
            script{             
                while(win_stop == 0){
                  sleep(1)
                  }
              }
            }
        }
        stage('test'){
          agent{label "win"}
          steps{
            
            catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
                pre_test_win()
                timeout(time: 20, unit: 'MINUTES'){
                bat'''
                cd C:\\workspace\\TDinternal\\community\\tests\\pytest
                .\\test-all.bat wintest
                '''
                }
            }     
            script{
              win_stop=1
            }
          }
        }
Y
Yiqing Liu 已提交
677 678
    }
  }
L
liuyq-617 已提交
679
  }
680
  post {
681 682
        success {
            emailext (
683 684
                subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS",
                body: """<!DOCTYPE html>
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699
                <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">
700
                                    <li>构建名称>>分支:${env.BRANCH_NAME}</li>
701 702
                                    <li>构建结果:<span style="color:green"> Successful </span></li>
                                    <li>构建编号:${BUILD_NUMBER}</li>
703
                                    <li>触发用户:${env.CHANGE_AUTHOR}</li>
L
fix  
liuyq-617 已提交
704
                                    <li>提交信息:${env.CHANGE_TITLE}</li>
705 706 707 708 709 710 711 712
                                    <li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
                                    <li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
                                </div>
                                </ul>
                            </td>
                        </tr>
                    </table></font>
                </body>
713
                </html>""",
L
liuyq-617 已提交
714
                to: "${env.CHANGE_AUTHOR_EMAIL}",
715 716 717 718 719
                from: "support@taosdata.com"
            )
        }
        failure {
            emailext (
720 721
                subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' FAIL",
                body: """<!DOCTYPE html>
722 723 724 725 726 727 728 729 730 731 732 733 734 735 736
                <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">
737
                                    <li>构建名称>>分支:${env.BRANCH_NAME}</li>
L
liuyq-617 已提交
738
                                    <li>构建结果:<span style="color:red"> Failure </span></li>
739
                                    <li>构建编号:${BUILD_NUMBER}</li>
740
                                    <li>触发用户:${env.CHANGE_AUTHOR}</li>
L
fix  
liuyq-617 已提交
741
                                    <li>提交信息:${env.CHANGE_TITLE}</li>
742 743 744 745 746 747 748 749
                                    <li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
                                    <li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
                                </div>
                                </ul>
                            </td>
                        </tr>
                    </table></font>
                </body>
750
                </html>""",
L
liuyq-617 已提交
751
                to: "${env.CHANGE_AUTHOR_EMAIL}",
752 753 754
                from: "support@taosdata.com"
            )
        }
755
    }
X
xiaolei li 已提交
756
}
L
liuyq-617 已提交
757