Jenkinsfile 21.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
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
L
update  
liuyq-617 已提交
81 82
    cd src/kit/taos-tools
    git clean -dfx
83 84
    cd ${WK}
    git reset --hard HEAD~10
L
fix  
liuyq-617 已提交
85
    '''
86 87 88 89 90 91 92 93 94 95 96 97
    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
        '''
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
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 137 138
        '''
        }
      else if(env.CHANGE_TARGET == '2.0'){
        sh '''
139 140
        cd ${WKC}
        git checkout 2.0
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
    git clean -dfx
161 162
    cd ${WK}
    git reset --hard HEAD~10
L
update  
liuyq-617 已提交
163
    '''
164 165 166 167 168 169 170 171 172 173 174 175
    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
        '''
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
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 212 213
        '''
        }
      else if(env.CHANGE_TARGET == '2.0'){
        sh '''
214 215
        cd ${WKC}
        git checkout 2.0
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
    git clean -dfx
236 237
    cd ${WK}
    git reset --hard HEAD~10
L
liuyq-617 已提交
238
    '''
239 240 241 242 243 244 245 246 247 248 249 250
    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
        '''
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 292 293
        '''
        }
      else if(env.CHANGE_TARGET == '2.0'){
        bat '''
294 295
        cd C:\\workspace\\TDinternal\\community
        git checkout 2.0
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 323 324 325 326 327
    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
        '''
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
liuyq-617 已提交
364
          agent{label 'catalina'}
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
liuyq-617 已提交
373
              println env.CHANGE_BRANCH
L
liuyq-617 已提交
374
              if(env.CHANGE_FORK){
375
                scope = ['connector','query','insert','other','tools','taosAdapter']
L
liuyq-617 已提交
376 377 378
              }
              else{
                sh'''
L
liuyq-617 已提交
379
                  cd ${WKC}
380
                  git reset --hard HEAD~10
L
liuyq-617 已提交
381 382 383
                  git fetch
                  git checkout ${CHANGE_BRANCH}
                  git pull
L
liuyq-617 已提交
384
                '''
L
liuyq-617 已提交
385 386 387
                dir('/var/lib/jenkins/workspace/TDinternal/community'){
                  gitlog = sh(script: "git log -1 --pretty=%B ", returnStdout:true)
                  println gitlog
L
liuyq-617 已提交
388
                  if (!(gitlog =~ /\((.*?)\)/)){
L
liuyq-617 已提交
389
                    autoCancelled = true
390
                    error('Please fill in the scope information correctly.\neg. [TD-xxxx]<fix>(query,insert):xxxxxxxxxxxxxxxxxx ')
L
liuyq-617 已提交
391
                  }
L
liuyq-617 已提交
392
                  temp = (gitlog =~ /\((.*?)\)/)
L
liuyq-617 已提交
393 394
                  temp = temp[0].remove(1)
                  scope = temp.split(",")
L
liuyq-617 已提交
395
                  scope = ['connector','query','insert','other','tools','taosAdapter']
L
liuyq-617 已提交
396
                  Collections.shuffle mod
L
liuyq-617 已提交
397
                  Collections.shuffle sim_mod
L
liuyq-617 已提交
398
                }
399

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