Jenkinsfile 20.0 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
update  
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
        }
L
liuyq-617 已提交
59
      else if(env.CHANGE_TARGET == '2.4'){
L
fix  
liuyq-617 已提交
60
        sh '''
61
        cd ${WKC}
L
liuyq-617 已提交
62
        git checkout 2.4
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
L
update  
liuyq-617 已提交
81 82
    cd src/kit/taos-tools/deps/avro
    git clean -dfx
83 84
    cd ${WK}
    git reset --hard HEAD~10
L
fix  
liuyq-617 已提交
85
    '''
86 87 88 89 90 91 92
    script {
      if (env.CHANGE_TARGET == 'master') {
        sh '''
        cd ${WK}
        git checkout master
        '''
        }
L
liuyq-617 已提交
93
      else if(env.CHANGE_TARGET == '2.4'){
94 95
        sh '''
        cd ${WK}
L
liuyq-617 已提交
96
        git checkout 2.4
97
        '''
98
      }
99 100 101 102 103
      else{
        sh '''
        cd ${WK}
        git checkout develop
        '''
104
      }
105
    }
L
fix  
liuyq-617 已提交
106
    sh '''
107
    cd ${WK}
108 109
    git pull >/dev/null

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

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

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

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

352 353 354
    '''
    return 1
}
Y
Yiqing Liu 已提交
355
pipeline {
L
liuyq-617 已提交
356
  agent none
357
  options { skipDefaultCheckout() }
L
liuyq-617 已提交
358 359 360 361
  environment{
      WK = '/var/lib/jenkins/workspace/TDinternal'
      WKC= '/var/lib/jenkins/workspace/TDinternal/community'
  }
Y
Yiqing Liu 已提交
362
  stages {
L
change  
liuyq-617 已提交
363
      stage('pre_build'){
L
update  
liuyq-617 已提交
364
          agent{label 'master'}
365
          options { skipDefaultCheckout() }
L
liuyq-617 已提交
366 367 368
          when {
              changeRequest()
          }
369
          steps {
L
change  
liuyq-617 已提交
370 371 372
            script{
              abort_previous()
              abortPreviousBuilds()
L
update  
liuyq-617 已提交
373 374 375 376
              scope = ['connector','query','insert','other','tools','taosAdapter']
              Collections.shuffle mod
              Collections.shuffle sim_mod
            }
377

378
          }
L
update  
liuyq-617 已提交
379
        }    
L
change  
liuyq-617 已提交
380
      stage('Parallel test stage') {
L
liuyq-617 已提交
381
        //only build pr
382
        options { skipDefaultCheckout() }
L
liuyq-617 已提交
383
        when {
L
liuyq-617 已提交
384
          allOf{
L
liuyq-617 已提交
385
              changeRequest()
386
              not{ expression { env.CHANGE_BRANCH =~ /docs\// }}
L
liuyq-617 已提交
387
            }
L
liuyq-617 已提交
388
          }
Y
Yiqing Liu 已提交
389
      parallel {
L
liuyq-617 已提交
390
        stage('python_1') {
L
liuyq-617 已提交
391
          agent{label " slave1 || slave11 "}
L
liuyq-617 已提交
392
          steps {
393
            pre_test()
L
liuyq-617 已提交
394
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
395 396 397 398 399
              script{
                scope.each {
                  sh """
                    date
                    cd ${WKC}/tests
L
liuyq-617 已提交
400
                    ./test-CI.sh ${it} 5 ${mod[0]}
L
liuyq-617 已提交
401 402 403 404
                    date"""
                  }
                }
            }            
L
liuyq-617 已提交
405 406
          }
        }
L
liuyq-617 已提交
407
        stage('python_2') {
L
liuyq-617 已提交
408
          agent{label " slave2 || slave12 "}
L
liuyq-617 已提交
409 410
          steps {
            pre_test()
L
liuyq-617 已提交
411
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
412 413 414 415 416
                 script{
                  scope.each {
                    sh """
                      date
                      cd ${WKC}/tests
L
liuyq-617 已提交
417
                      ./test-CI.sh ${it} 5 ${mod[1]} 
L
liuyq-617 已提交
418 419 420
                      date"""
                    }
                }
L
liuyq-617 已提交
421
            }
L
liuyq-617 已提交
422 423
          }
        }
L
liuyq-617 已提交
424
        stage('python_3') {
L
liuyq-617 已提交
425
          agent{label " slave3 || slave13 "}
426
          steps {
427
            timeout(time: 105, unit: 'MINUTES'){
L
liuyq-617 已提交
428
              pre_test()
L
liuyq-617 已提交
429 430 431 432 433
              script{
              scope.each {
                sh """
                  date
                  cd ${WKC}/tests
L
liuyq-617 已提交
434
                  ./test-CI.sh ${it} 5 ${mod[2]}
L
liuyq-617 已提交
435 436
                  date"""
                }
437
              }
L
liuyq-617 已提交
438
            }
Y
Yiqing Liu 已提交
439 440
          }
        }
L
liuyq-617 已提交
441
        stage('python_4') {
L
liuyq-617 已提交
442
          agent{label " slave4 || slave14 "}
443
          steps {
L
liuyq-617 已提交
444
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
445
              pre_test()
L
liuyq-617 已提交
446 447 448 449 450
              script{
              scope.each {
                sh """
                  date
                  cd ${WKC}/tests
L
liuyq-617 已提交
451
                  ./test-CI.sh ${it} 5 ${mod[3]}
L
liuyq-617 已提交
452 453 454 455
                  date"""
                }
              }
          
L
liuyq-617 已提交
456 457 458
            }
          }
        }
L
liuyq-617 已提交
459
        stage('python_5') {
L
liuyq-617 已提交
460
          agent{label " slave5 || slave15 "}
461
          steps {
L
liuyq-617 已提交
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[4]}
L
liuyq-617 已提交
470 471 472 473
                  date"""
                }
              }
          
L
liuyq-617 已提交
474 475
            }
          }
476
        }
L
liuyq-617 已提交
477 478 479 480 481 482 483 484 485 486
        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 已提交
487 488
              }
          }            
L
liuyq-617 已提交
489 490 491 492 493 494
        }
        stage('sim_2') {
          agent{label " slave7 || slave17 "}
          steps {
            pre_test()
            timeout(time: 100, unit: 'MINUTES'){
L
liuyq-617 已提交
495 496 497 498 499
              sh """
                date
                cd ${WKC}/tests
                ./test-CI.sh sim 4 ${sim_mod[1]} 
                date"""
L
liuyq-617 已提交
500 501 502 503 504 505 506 507
            }
          }
        }
        stage('sim_3') {
          agent{label " slave8 || slave18 "}
          steps {
            timeout(time: 105, unit: 'MINUTES'){
              pre_test()
L
liuyq-617 已提交
508 509 510 511 512
              sh """
                date
                cd ${WKC}/tests
                ./test-CI.sh sim 4 ${sim_mod[2]}
                date"""
L
liuyq-617 已提交
513 514 515 516 517 518 519 520
            }
          }
        }
        stage('sim_4') {
          agent{label " slave9 || slave19 "}
          steps {
            timeout(time: 100, unit: 'MINUTES'){
              pre_test()
L
liuyq-617 已提交
521 522 523 524 525
              sh """
                date
                cd ${WKC}/tests
                ./test-CI.sh sim 4 ${sim_mod[3]}
                date"""
L
liuyq-617 已提交
526 527
              }
            }
L
liuyq-617 已提交
528
          
L
liuyq-617 已提交
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
        }
        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 已提交
594 595
        stage('Mac_build') {
          agent{label " catalina "}
596 597
          steps {
              pre_test_mac()
L
liuyq-617 已提交
598 599
            }
        }
L
liuyq-617 已提交
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 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
        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 已提交
659 660
    }
  }
L
liuyq-617 已提交
661
  }
662
  post {
663 664
        success {
            emailext (
665 666
                subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS",
                body: """<!DOCTYPE html>
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681
                <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">
682
                                    <li>构建名称>>分支:${env.BRANCH_NAME}</li>
683 684
                                    <li>构建结果:<span style="color:green"> Successful </span></li>
                                    <li>构建编号:${BUILD_NUMBER}</li>
685
                                    <li>触发用户:${env.CHANGE_AUTHOR}</li>
L
fix  
liuyq-617 已提交
686
                                    <li>提交信息:${env.CHANGE_TITLE}</li>
687 688 689 690 691 692 693 694
                                    <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>
695
                </html>""",
L
liuyq-617 已提交
696
                to: "${env.CHANGE_AUTHOR_EMAIL}",
697 698 699 700 701
                from: "support@taosdata.com"
            )
        }
        failure {
            emailext (
702 703
                subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' FAIL",
                body: """<!DOCTYPE html>
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718
                <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">
719
                                    <li>构建名称>>分支:${env.BRANCH_NAME}</li>
L
liuyq-617 已提交
720
                                    <li>构建结果:<span style="color:red"> Failure </span></li>
721
                                    <li>构建编号:${BUILD_NUMBER}</li>
722
                                    <li>触发用户:${env.CHANGE_AUTHOR}</li>
L
fix  
liuyq-617 已提交
723
                                    <li>提交信息:${env.CHANGE_TITLE}</li>
724 725 726 727 728 729 730 731
                                    <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>
732
                </html>""",
L
liuyq-617 已提交
733
                to: "${env.CHANGE_AUTHOR_EMAIL}",
734 735 736
                from: "support@taosdata.com"
            )
        }
737
    }
X
xiaolei li 已提交
738
}
L
liuyq-617 已提交
739