Jenkinsfile 22.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

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

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

L
recover  
liuyq-617 已提交
22 23 24 25 26 27 28 29 30 31 32 33 34 35
    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)
}
36
def pre_test(){
L
liuyq-617 已提交
37
    sh'hostname'
L
liuyq-617 已提交
38 39 40
    sh '''
    sudo rmtaos || echo "taosd has not installed"
    '''
L
liuyq-617 已提交
41
    sh '''
42 43
    kill -9 $(pidof taosd) ||echo "no taosd running"
    kill -9 $(pidof taosadapter) ||echo "no taosadapter running"
L
fix  
liuyq-617 已提交
44
    killall -9 gdb || echo "no gdb running"
L
liuyq-617 已提交
45
    killall -9 python3.8 || echo "no python program running"
46 47
    cd ${WKC}
    git reset --hard HEAD~10 >/dev/null
L
fix  
liuyq-617 已提交
48 49 50
    '''
    script {
      if (env.CHANGE_TARGET == 'master') {
L
fix  
liuyq-617 已提交
51
        sh '''
52 53
        cd ${WKC}
        git checkout master
L
fix  
liuyq-617 已提交
54
        '''
L
fix  
liuyq-617 已提交
55
        }
56
      else if(env.CHANGE_TARGET == '2.0'){
L
fix  
liuyq-617 已提交
57
        sh '''
58 59
        cd ${WKC}
        git checkout 2.0
L
fix  
liuyq-617 已提交
60
        '''
61
      }
62 63
      else{
        sh '''
64 65
        cd ${WKC}
        git checkout develop
66 67
        '''
      }
L
fix  
liuyq-617 已提交
68 69
    }
    sh'''
L
fix  
liuyq-617 已提交
70
    cd ${WKC}
71
    git remote prune origin
72 73
    [ -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 已提交
74
    git fetch origin +refs/pull/${CHANGE_ID}/merge
75
    git checkout -qf FETCH_HEAD
76
    git clean -dfx
77
    git submodule update --init --recursive
78 79
    cd ${WK}
    git reset --hard HEAD~10
L
fix  
liuyq-617 已提交
80
    '''
81 82 83 84 85 86 87 88 89 90 91 92
    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
        '''
93
      }
94 95 96 97 98
      else{
        sh '''
        cd ${WK}
        git checkout develop
        '''
99
      }
100
    }
L
fix  
liuyq-617 已提交
101
    sh '''
102
    cd ${WK}
103 104
    git pull >/dev/null

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

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

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

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

341 342 343
    '''
    return 1
}
Y
Yiqing Liu 已提交
344
pipeline {
L
liuyq-617 已提交
345
  agent none
346
  options { skipDefaultCheckout() }
L
liuyq-617 已提交
347 348 349 350
  environment{
      WK = '/var/lib/jenkins/workspace/TDinternal'
      WKC= '/var/lib/jenkins/workspace/TDinternal/community'
  }
Y
Yiqing Liu 已提交
351
  stages {
L
change  
liuyq-617 已提交
352
      stage('pre_build'){
353
          agent{label 'master'}
354
          options { skipDefaultCheckout() }
L
liuyq-617 已提交
355 356 357
          when {
              changeRequest()
          }
358
          steps {
L
change  
liuyq-617 已提交
359 360 361
            script{
              abort_previous()
              abortPreviousBuilds()
L
liuyq-617 已提交
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
              println env.BRANCH_NAME,env.CHANGE_BRANCH
              if(env.CHANGE_FORK){
                scope = ['full']
              }
              else{
                sh'''
                cd ${WKC}
                git fetch
                git checkout ${BRANCH_NAME}
                git pull
                '''
                gitlog = sh(script: "git log -1 --pretty=%B ", returnStdout:true)
                fun_git = (gitlog =~ \(.?\))
                scope = fun_git.split(",")
                println scope
              }
L
change  
liuyq-617 已提交
378
            }
Y
Yiqing Liu 已提交
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
          //   sh'''
          // rm -rf ${WORKSPACE}.tes
          // cp -r ${WORKSPACE} ${WORKSPACE}.tes
          // cd ${WORKSPACE}.tes
          // git fetch
          // '''
          // script {
          //   if (env.CHANGE_TARGET == 'master') {
          //     sh '''
          //     git checkout master
          //     '''
          //     }
          //   else if(env.CHANGE_TARGET == '2.0'){
          //     sh '''
          //     git checkout 2.0
          //     '''
395
          //   }
Y
Yiqing Liu 已提交
396 397 398 399
          //   else{
          //     sh '''
          //     git checkout develop
          //     '''
400
          //   }
Y
Yiqing Liu 已提交
401 402 403 404
          // }
          // sh'''
          // git fetch origin +refs/pull/${CHANGE_ID}/merge
          // git checkout -qf FETCH_HEAD
405
          // '''
406

407 408
          // script{
          //   skipbuild='2'
Y
Yiqing Liu 已提交
409 410 411 412 413 414
          //   skipbuild=sh(script: "git log -2 --pretty=%B | fgrep -ie '[skip ci]' -e '[ci skip]' && echo 1 || echo 2", returnStdout:true)
          //   println skipbuild
          // }
          // sh'''
          // rm -rf ${WORKSPACE}.tes
          // '''
415
          // }
416 417
          }
      }
L
change  
liuyq-617 已提交
418
      stage('Parallel test stage') {
L
liuyq-617 已提交
419
        //only build pr
420
        options { skipDefaultCheckout() }
L
liuyq-617 已提交
421
        when {
L
liuyq-617 已提交
422
          allOf{
L
liuyq-617 已提交
423
              changeRequest()
424
              not{ expression { env.CHANGE_BRANCH =~ /docs\// }}
L
liuyq-617 已提交
425
            }
L
liuyq-617 已提交
426
          }
Y
Yiqing Liu 已提交
427
      parallel {
L
liuyq-617 已提交
428
        stage('python_1_s1') {
L
liuyq-617 已提交
429
          agent{label " slave1 || slave11 "}
L
liuyq-617 已提交
430
          steps {
431
            pre_test()
L
liuyq-617 已提交
432
            timeout(time: 55, unit: 'MINUTES'){
L
liuyq-617 已提交
433
              sh '''
L
liuyq-617 已提交
434
              date
L
liuyq-617 已提交
435 436 437 438
              cd ${WKC}/tests
              ./test-all.sh p1
              date'''
            }
L
liuyq-617 已提交
439 440
          }
        }
L
liuyq-617 已提交
441
        stage('python_2_s5') {
L
liuyq-617 已提交
442
          agent{label " slave5 || slave15 "}
L
liuyq-617 已提交
443 444
          steps {
            pre_test()
L
liuyq-617 已提交
445
            timeout(time: 55, unit: 'MINUTES'){
446 447 448 449 450
                sh '''
                date
                cd ${WKC}/tests
                ./test-all.sh p2
                date'''
L
liuyq-617 已提交
451 452 453 454
            }
          }
        }
        stage('python_3_s6') {
L
liuyq-617 已提交
455
          agent{label " slave6 || slave16 "}
456 457
          steps {
            timeout(time: 55, unit: 'MINUTES'){
L
liuyq-617 已提交
458 459 460 461 462 463 464
              pre_test()
              sh '''
              date
              cd ${WKC}/tests
              ./test-all.sh p3
              date'''
            }
L
liuyq-617 已提交
465 466
          }
        }
L
liuyq-617 已提交
467
        stage('test_b1_s2') {
L
liuyq-617 已提交
468
          agent{label " slave2 || slave12 "}
469 470
          steps {
            timeout(time: 55, unit: 'MINUTES'){
L
liuyq-617 已提交
471
              pre_test()
L
liuyq-617 已提交
472 473 474
              sh '''
                rm -rf /var/lib/taos/*
                rm -rf /var/log/taos/*
L
update  
liuyq-617 已提交
475
                nohup taosd >/dev/null &
L
liuyq-617 已提交
476 477
                sleep 10
              '''
478

L
liuyq-617 已提交
479
              sh '''
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495
                cd ${WKC}/src/connector/python
                export PYTHONPATH=$PWD/
                export LD_LIBRARY_PATH=${WKC}/debug/build/lib
                pip3 install pytest
                pytest tests/

                python3 examples/bind-multi.py
                python3 examples/bind-row.py
                python3 examples/demo.py
                python3 examples/insert-lines.py
                python3 examples/pep-249.py
                python3 examples/query-async.py
                python3 examples/query-objectively.py
                python3 examples/subscribe-sync.py
                python3 examples/subscribe-async.py
              '''
496

497
              sh '''
498 499 500
                cd ${WKC}/src/connector/nodejs
                npm install
                npm run test
501 502 503 504 505 506 507
                cd ${WKC}/tests/examples/nodejs
                npm install td2.0-connector > /dev/null 2>&1
                node nodejsChecker.js host=localhost
                node test1970.js
                cd ${WKC}/tests/connectorTest/nodejsTest/nanosupport
                npm install td2.0-connector > /dev/null 2>&1
                node nanosecondTest.js
L
liuyq-617 已提交
508
              '''
509 510
              catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
511 512 513
                  cd ${WKC}/src/connector/C#
                  dotnet test
                  dotnet run --project src/test/Cases/Cases.csproj
514

515 516 517
                  cd ${WKC}/tests/examples/C#
                  dotnet run --project C#checker/C#checker.csproj
                  dotnet run --project TDengineTest/TDengineTest.csproj
518
                  dotnet run --project schemaless/schemaless.csproj
519

520
                  cd ${WKC}/tests/examples/C#/taosdemo
521 522 523
                  dotnet build -c Release
                  tree | true
                  ./bin/Release/net5.0/taosdemo -c /etc/taos -y
524
                '''
525
              }
L
liuyq-617 已提交
526 527 528 529
              sh '''
                cd ${WKC}/tests/gotest
                bash batchtest.sh
              '''
L
liuyq-617 已提交
530 531 532 533 534
              sh '''
              cd ${WKC}/tests
              ./test-all.sh b1fq
              date'''
            }
Y
Yiqing Liu 已提交
535 536
          }
        }
L
liuyq-617 已提交
537
        stage('test_crash_gen_s3') {
L
liuyq-617 已提交
538
          agent{label " slave3 || slave13 "}
539

Y
Yiqing Liu 已提交
540
          steps {
541
            pre_test()
542 543 544
            timeout(time: 60, unit: 'MINUTES'){
              sh '''
              cd ${WKC}/tests/pytest
L
liuyq-617 已提交
545
              ./crash_gen.sh -a -p -t 4 -s 2000
546 547 548
              '''
            }
            timeout(time: 60, unit: 'MINUTES'){
P
Ping Xiao 已提交
549 550 551 552 553 554
              sh '''
              cd ${WKC}/tests/pytest
              rm -rf /var/lib/taos/*
              rm -rf /var/log/taos/*
              ./handle_crash_gen_val_log.sh
              '''
555 556 557 558 559 560
              sh '''
              cd ${WKC}/tests/pytest
              rm -rf /var/lib/taos/*
              rm -rf /var/log/taos/*
              ./handle_taosd_val_log.sh
              '''
L
liuyq-617 已提交
561
            }
L
liuyq-617 已提交
562
            timeout(time: 55, unit: 'MINUTES'){
563 564 565 566 567 568
                sh '''
                date
                cd ${WKC}/tests
                ./test-all.sh b2fq
                date
                '''
569
            }
Y
Yiqing Liu 已提交
570 571
          }
        }
L
liuyq-617 已提交
572
        stage('test_valgrind_s4') {
L
liuyq-617 已提交
573
          agent{label " slave4 || slave14 "}
L
liuyq-617 已提交
574

Y
Yiqing Liu 已提交
575
          steps {
576 577 578 579 580 581 582
            pre_test()
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WKC}/tests/pytest
                ./valgrind-test.sh 2>&1 > mem-error-out.log
                ./handle_val_log.sh
                '''
583 584
            }
            timeout(time: 55, unit: 'MINUTES'){
L
liuyq-617 已提交
585 586 587 588 589
              sh '''
              date
              cd ${WKC}/tests
              ./test-all.sh b3fq
              date'''
P
change  
Ping Xiao 已提交
590 591 592 593 594
              sh '''
              date
              cd ${WKC}/tests
              ./test-all.sh full example
              date'''
L
liuyq-617 已提交
595
            }
Y
Yiqing Liu 已提交
596 597
          }
        }
L
liuyq-617 已提交
598
        stage('test_b4_s7') {
L
liuyq-617 已提交
599
          agent{label " slave7 || slave17 "}
600 601
          steps {
            timeout(time: 105, unit: 'MINUTES'){
L
liuyq-617 已提交
602 603 604 605 606
              pre_test()
              sh '''
              date
              cd ${WKC}/tests
              ./test-all.sh b4fq
L
fix  
liuyq-617 已提交
607
              cd ${WKC}/tests
L
liuyq-617 已提交
608
              ./test-all.sh p4
L
liuyq-617 已提交
609
              '''
L
liuyq-617 已提交
610 611
              // cd ${WKC}/tests
              // ./test-all.sh full jdbc
L
liuyq-617 已提交
612 613
              // cd ${WKC}/tests
              // ./test-all.sh full unit
L
liuyq-617 已提交
614 615 616 617
            }
          }
        }
        stage('test_b5_s8') {
L
liuyq-617 已提交
618
          agent{label " slave8 || slave18 "}
619 620
          steps {
            timeout(time: 55, unit: 'MINUTES'){
L
liuyq-617 已提交
621 622 623 624 625 626 627 628 629 630
              pre_test()
              sh '''
              date
              cd ${WKC}/tests
              ./test-all.sh b5fq
              date'''
            }
          }
        }
        stage('test_b6_s9') {
L
liuyq-617 已提交
631
          agent{label " slave9 || slave19 "}
632 633
          steps {
            timeout(time: 55, unit: 'MINUTES'){
L
liuyq-617 已提交
634 635
              pre_test()
              sh '''
L
liuyq-617 已提交
636 637 638 639
              cd ${WKC}/tests
              ./test-all.sh develop-test
              '''
              sh '''
L
liuyq-617 已提交
640 641 642 643 644 645 646 647
              date
              cd ${WKC}/tests
              ./test-all.sh b6fq
              date'''
            }
          }
        }
        stage('test_b7_s10') {
L
liuyq-617 已提交
648
          agent{label " slave10 || slave20 "}
649 650
          steps {
            timeout(time: 55, unit: 'MINUTES'){
L
liuyq-617 已提交
651 652
              pre_test()
              sh '''
L
liuyq-617 已提交
653 654 655 656
              cd ${WKC}/tests
              ./test-all.sh system-test
              '''
              sh '''
L
liuyq-617 已提交
657 658 659
              date
              cd ${WKC}/tests
              ./test-all.sh b7fq
660
              date'''
L
liuyq-617 已提交
661 662
            }
          }
663
        }
L
liuyq-617 已提交
664 665
        stage('arm64centos7') {
          agent{label " arm64centos7 "}
666 667
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
668 669 670 671
            }
        }
        stage('arm64centos8') {
          agent{label " arm64centos8 "}
672 673
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
674 675 676 677
            }
        }
        stage('arm32bionic') {
          agent{label " arm32bionic "}
678 679
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
680 681 682 683
            }
        }
        stage('arm64bionic') {
          agent{label " arm64bionic "}
684 685
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
686 687 688 689
            }
        }
        stage('arm64focal') {
          agent{label " arm64focal "}
690 691
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
692 693
            }
        }
L
liuyq-617 已提交
694 695
        stage('centos7') {
          agent{label " centos7 "}
696 697
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
698 699 700 701
            }
        }
        stage('ubuntu:trusty') {
          agent{label " trusty "}
702 703
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
704 705 706 707
            }
        }
        stage('ubuntu:xenial') {
          agent{label " xenial "}
708 709
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
710 711 712 713
            }
        }
        stage('ubuntu:bionic') {
          agent{label " bionic "}
714 715
          steps {
              pre_test_noinstall()
L
liuyq-617 已提交
716 717
            }
        }
L
liuyq-617 已提交
718 719
        stage('Mac_build') {
          agent{label " catalina "}
720 721
          steps {
              pre_test_mac()
L
liuyq-617 已提交
722 723
            }
        }
L
liuyq-617 已提交
724

L
liuyq-617 已提交
725 726 727 728
        stage('build'){
          agent{label " wintest "}
          steps {
            pre_test()
729
            script{
L
liuyq-617 已提交
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746
                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
                '''
                }
747
            }
L
liuyq-617 已提交
748 749 750 751 752
            script{
              win_stop=1
            }
          }
        }
Y
Yiqing Liu 已提交
753 754
    }
  }
L
liuyq-617 已提交
755
  }
756
  post {
757 758
        success {
            emailext (
759 760
                subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS",
                body: """<!DOCTYPE html>
761 762 763 764 765 766 767 768 769 770 771 772 773 774 775
                <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">
776
                                    <li>构建名称>>分支:${env.BRANCH_NAME}</li>
777 778
                                    <li>构建结果:<span style="color:green"> Successful </span></li>
                                    <li>构建编号:${BUILD_NUMBER}</li>
779
                                    <li>触发用户:${env.CHANGE_AUTHOR}</li>
L
fix  
liuyq-617 已提交
780
                                    <li>提交信息:${env.CHANGE_TITLE}</li>
781 782 783 784 785 786 787 788
                                    <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>
789
                </html>""",
L
liuyq-617 已提交
790
                to: "${env.CHANGE_AUTHOR_EMAIL}",
791 792 793 794 795
                from: "support@taosdata.com"
            )
        }
        failure {
            emailext (
796 797
                subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' FAIL",
                body: """<!DOCTYPE html>
798 799 800 801 802 803 804 805 806 807 808 809 810 811 812
                <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">
813
                                    <li>构建名称>>分支:${env.BRANCH_NAME}</li>
L
liuyq-617 已提交
814
                                    <li>构建结果:<span style="color:red"> Failure </span></li>
815
                                    <li>构建编号:${BUILD_NUMBER}</li>
816
                                    <li>触发用户:${env.CHANGE_AUTHOR}</li>
L
fix  
liuyq-617 已提交
817
                                    <li>提交信息:${env.CHANGE_TITLE}</li>
818 819 820 821 822 823 824 825
                                    <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>
826
                </html>""",
L
liuyq-617 已提交
827
                to: "${env.CHANGE_AUTHOR_EMAIL}",
828 829 830
                from: "support@taosdata.com"
            )
        }
831
    }
X
xiaolei li 已提交
832
}