Jenkinsfile 20.7 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 49
    cd ${WKC}
    git reset --hard HEAD~10 >/dev/null
L
fix  
liuyq-617 已提交
50 51 52
    '''
    script {
      if (env.CHANGE_TARGET == 'master') {
L
fix  
liuyq-617 已提交
53
        sh '''
54 55
        cd ${WKC}
        git checkout master
L
fix  
liuyq-617 已提交
56
        '''
L
fix  
liuyq-617 已提交
57
        }
L
update  
liuyq-617 已提交
58
      else if(env.CHANGE_TARGET == '2.4'){
L
fix  
liuyq-617 已提交
59
        sh '''
60
        cd ${WKC}
L
update  
liuyq-617 已提交
61
        git checkout 2.4
L
fix  
liuyq-617 已提交
62
        '''
63
      }
64 65
      else{
        sh '''
66 67
        cd ${WKC}
        git checkout develop
68 69
        '''
      }
L
fix  
liuyq-617 已提交
70 71
    }
    sh'''
L
fix  
liuyq-617 已提交
72
    cd ${WKC}
73
    git remote prune origin
74 75
    [ -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 已提交
76
    git fetch origin +refs/pull/${CHANGE_ID}/merge
77
    git checkout -qf FETCH_HEAD
78
    git clean -dfx
79
    git submodule update --init --recursive
80 81
    cd ${WK}
    git reset --hard HEAD~10
L
fix  
liuyq-617 已提交
82
    '''
83 84 85 86 87 88 89
    script {
      if (env.CHANGE_TARGET == 'master') {
        sh '''
        cd ${WK}
        git checkout master
        '''
        }
L
update  
liuyq-617 已提交
90
      else if(env.CHANGE_TARGET == '2.4'){
91 92
        sh '''
        cd ${WK}
L
update  
liuyq-617 已提交
93
        git checkout 2.4
94
        '''
95
      }
96 97 98 99 100
      else{
        sh '''
        cd ${WK}
        git checkout develop
        '''
101
      }
102
    }
L
fix  
liuyq-617 已提交
103
    sh '''
104
    cd ${WK}
105 106
    git pull >/dev/null

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

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

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

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

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

L
liuyq-617 已提交
391 392
              }
            }    
393 394
          }
      }
L
change  
liuyq-617 已提交
395
      stage('Parallel test stage') {
L
liuyq-617 已提交
396
        //only build pr
397
        options { skipDefaultCheckout() }
L
liuyq-617 已提交
398
        when {
L
liuyq-617 已提交
399
          allOf{
L
liuyq-617 已提交
400
              changeRequest()
401
              not{ expression { env.CHANGE_BRANCH =~ /docs\// }}
L
liuyq-617 已提交
402
            }
L
liuyq-617 已提交
403
          }
Y
Yiqing Liu 已提交
404
      parallel {
L
liuyq-617 已提交
405
        stage('python_1') {
L
liuyq-617 已提交
406
          agent{label " slave1 || slave11 "}
L
liuyq-617 已提交
407
          steps {
408
            pre_test()
L
liuyq-617 已提交
409
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
410 411 412 413 414
              script{
                scope.each {
                  sh """
                    date
                    cd ${WKC}/tests
L
liuyq-617 已提交
415
                    ./test-CI.sh ${it} 5 ${mod[0]}
L
liuyq-617 已提交
416 417 418 419
                    date"""
                  }
                }
            }            
L
liuyq-617 已提交
420 421
          }
        }
L
liuyq-617 已提交
422
        stage('python_2') {
L
liuyq-617 已提交
423
          agent{label " slave2 || slave12 "}
L
liuyq-617 已提交
424 425
          steps {
            pre_test()
L
liuyq-617 已提交
426
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
427 428 429 430 431
                 script{
                  scope.each {
                    sh """
                      date
                      cd ${WKC}/tests
L
liuyq-617 已提交
432
                      ./test-CI.sh ${it} 5 ${mod[1]} 
L
liuyq-617 已提交
433 434 435
                      date"""
                    }
                }
L
liuyq-617 已提交
436
            }
L
liuyq-617 已提交
437 438
          }
        }
L
liuyq-617 已提交
439
        stage('python_3') {
L
liuyq-617 已提交
440
          agent{label " slave3 || slave13 "}
441
          steps {
442
            timeout(time: 105, unit: 'MINUTES'){
L
liuyq-617 已提交
443
              pre_test()
L
liuyq-617 已提交
444 445 446 447 448
              script{
              scope.each {
                sh """
                  date
                  cd ${WKC}/tests
L
liuyq-617 已提交
449
                  ./test-CI.sh ${it} 5 ${mod[2]}
L
liuyq-617 已提交
450 451
                  date"""
                }
452
              }
L
liuyq-617 已提交
453
            }
Y
Yiqing Liu 已提交
454 455
          }
        }
L
liuyq-617 已提交
456
        stage('python_4') {
L
liuyq-617 已提交
457
          agent{label " slave4 || slave14 "}
458
          steps {
L
liuyq-617 已提交
459
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
460
              pre_test()
L
liuyq-617 已提交
461 462 463 464 465
              script{
              scope.each {
                sh """
                  date
                  cd ${WKC}/tests
L
liuyq-617 已提交
466
                  ./test-CI.sh ${it} 5 ${mod[3]}
L
liuyq-617 已提交
467 468 469 470
                  date"""
                }
              }
          
L
liuyq-617 已提交
471 472 473
            }
          }
        }
L
liuyq-617 已提交
474
        stage('python_5') {
L
liuyq-617 已提交
475
          agent{label " slave5 || slave15 "}
476
          steps {
L
liuyq-617 已提交
477
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
478
              pre_test()
L
liuyq-617 已提交
479 480 481 482 483
              script{
              scope.each {
                sh """
                  date
                  cd ${WKC}/tests
L
liuyq-617 已提交
484
                  ./test-CI.sh ${it} 5 ${mod[4]}
L
liuyq-617 已提交
485 486 487 488
                  date"""
                }
              }
          
L
liuyq-617 已提交
489 490
            }
          }
491
        }
L
liuyq-617 已提交
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 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 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
        stage('sim_1') {
          agent{label " slave6 || slave16 "}
          steps {
            pre_test()
            timeout(time: 100, unit: 'MINUTES'){
              script{
                scope.each {
                  sh """
                    date
                    cd ${WKC}/tests
                    ./test-CI.sh sim 4 ${sim_mod[0]}
                    date"""
                  }
                }
            }            
          }
        }
        stage('sim_2') {
          agent{label " slave7 || slave17 "}
          steps {
            pre_test()
            timeout(time: 100, unit: 'MINUTES'){
                 script{
                  scope.each {
                    sh """
                      date
                      cd ${WKC}/tests
                      ./test-CI.sh sim 4 ${sim_mod[1]} 
                      date"""
                    }
                }
            }
          }
        }
        stage('sim_3') {
          agent{label " slave8 || slave18 "}
          steps {
            timeout(time: 105, unit: 'MINUTES'){
              pre_test()
              script{
              scope.each {
                sh """
                  date
                  cd ${WKC}/tests
                  ./test-CI.sh sim 4 ${sim_mod[2]}
                  date"""
                }
              }
            }
          }
        }
        stage('sim_4') {
          agent{label " slave9 || slave19 "}
          steps {
            timeout(time: 100, unit: 'MINUTES'){
              pre_test()
              script{
              scope.each {
                sh """
                  date
                  cd ${WKC}/tests
                  ./test-CI.sh sim 4 ${sim_mod[3]}
                  date"""
                }
              }
          
            }
          }
        }
        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
              '''
            }
          }
        }
        stage('centos7') {
          agent{label " centos7 "}
          steps {
              pre_test_noinstall()
            }
        }
        stage('ubuntu:trusty') {
          agent{label " trusty "}
          steps {
              pre_test_noinstall()
            }
        }
        stage('ubuntu:xenial') {
          agent{label " xenial "}
          steps {
              pre_test_noinstall()
            }
        }
        stage('ubuntu:bionic') {
          agent{label " bionic "}
          steps {
              pre_test_noinstall()
            }
        }
L
liuyq-617 已提交
625 626
        stage('Mac_build') {
          agent{label " catalina "}
627 628
          steps {
              pre_test_mac()
L
liuyq-617 已提交
629 630
            }
        }
L
liuyq-617 已提交
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 677 678 679 680 681 682 683 684 685 686 687 688 689
        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 已提交
690 691
    }
  }
L
liuyq-617 已提交
692
  }
693
  post {
694 695
        success {
            emailext (
696 697
                subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS",
                body: """<!DOCTYPE html>
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712
                <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">
713
                                    <li>构建名称>>分支:${env.BRANCH_NAME}</li>
714 715
                                    <li>构建结果:<span style="color:green"> Successful </span></li>
                                    <li>构建编号:${BUILD_NUMBER}</li>
716
                                    <li>触发用户:${env.CHANGE_AUTHOR}</li>
L
fix  
liuyq-617 已提交
717
                                    <li>提交信息:${env.CHANGE_TITLE}</li>
718 719 720 721 722 723 724 725
                                    <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>
726
                </html>""",
L
liuyq-617 已提交
727
                to: "${env.CHANGE_AUTHOR_EMAIL}",
728 729 730 731 732
                from: "support@taosdata.com"
            )
        }
        failure {
            emailext (
733 734
                subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' FAIL",
                body: """<!DOCTYPE html>
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749
                <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">
750
                                    <li>构建名称>>分支:${env.BRANCH_NAME}</li>
L
liuyq-617 已提交
751
                                    <li>构建结果:<span style="color:red"> Failure </span></li>
752
                                    <li>构建编号:${BUILD_NUMBER}</li>
753
                                    <li>触发用户:${env.CHANGE_AUTHOR}</li>
L
fix  
liuyq-617 已提交
754
                                    <li>提交信息:${env.CHANGE_TITLE}</li>
755 756 757 758 759 760 761 762
                                    <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>
763
                </html>""",
L
liuyq-617 已提交
764
                to: "${env.CHANGE_AUTHOR_EMAIL}",
765 766 767
                from: "support@taosdata.com"
            )
        }
768
    }
X
xiaolei li 已提交
769
}
L
liuyq-617 已提交
770