Jenkinsfile 3.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

properties([pipelineTriggers([githubPush()])])
node {
    git url: 'https://github.com/taosdata/TDengine'
}


// execute this before anything else, including requesting any time on an agent
if (currentBuild.rawBuild.getCauses().toString().contains('BranchIndexingCause')) {
  print "INFO: Build skipped due to trigger being Branch Indexing"
  currentBuild.result = 'ABORTED' // optional, gives a better hint to the user that it's been skipped, rather than the default which shows it's successful
  return
}


def pre_test(){
    catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                sudo rmtaos
                '''
    }
    sh '''
    cd ${WKC}
    rm -rf *
    cd ${WK}
    git reset --hard
    git checkout develop
    git pull
    cd ${WKC}
    rm -rf *
    mv ${WORKSPACE}/* .
    cd ${WK}
    export TZ=Asia/Harbin
    date
    rm -rf ${WK}/debug
    mkdir debug
    cd debug
    cmake .. > /dev/null
    make > /dev/null
    make install > /dev/null
    cd ${WKC}/tests
    '''
    return 1
}
Y
Yiqing Liu 已提交
45
pipeline {
L
liuyq-617 已提交
46 47 48 49 50
  agent none
  environment{
      WK = '/var/lib/jenkins/workspace/TDinternal'
      WKC= '/var/lib/jenkins/workspace/TDinternal/community'
  }
L
liuyq-617 已提交
51

Y
Yiqing Liu 已提交
52
  stages {
L
liuyq-617 已提交
53
      stage('Parallel test stage') {
Y
Yiqing Liu 已提交
54
      parallel {
55 56
        stage('python p1') {
          agent{label 'p1'}
L
liuyq-617 已提交
57
          steps {
58
            pre_test()
L
liuyq-617 已提交
59 60
            sh '''
            cd ${WKC}/tests
61
            ./test-all.sh p1
L
liuyq-617 已提交
62 63 64
            date'''
          }
        }
L
liuyq-617 已提交
65
        stage('test_b1') {
66
          agent{label 'b1'}
Y
Yiqing Liu 已提交
67
          steps {
68
            pre_test()
L
liuyq-617 已提交
69 70
            sh '''
            cd ${WKC}/tests
L
liuyq-617 已提交
71
            ./test-all.sh b1
L
liuyq-617 已提交
72
            date'''
Y
Yiqing Liu 已提交
73 74 75 76
          }
        }

        stage('test_crash_gen') {
77
          agent{label "b2"}
Y
Yiqing Liu 已提交
78
          steps {
79
            pre_test()
L
liuyq-617 已提交
80 81 82 83 84 85
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WKC}/tests/pytest
                ./crash_gen.sh -a -p -t 4 -s 2000
                '''
            }
86 87 88 89 90 91
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WKC}/tests/pytest
                ./handle_crash_gen_val_log.sh
                '''
            }
L
liuyq-617 已提交
92
            sh '''
L
liuyq-617 已提交
93 94
            date
            cd ${WKC}/tests
L
liuyq-617 已提交
95
            ./test-all.sh b2
L
liuyq-617 已提交
96 97
            date
            '''
Y
Yiqing Liu 已提交
98 99 100 101
          }
        }

        stage('test_valgrind') {
102
          agent{label "b3"}
L
liuyq-617 已提交
103

Y
Yiqing Liu 已提交
104
          steps {
105 106 107 108 109 110 111 112
            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
                '''
            }           
L
liuyq-617 已提交
113 114
            sh '''
            date
L
liuyq-617 已提交
115 116
            cd ${WKC}/tests
            ./test-all.sh b3
L
liuyq-617 已提交
117
            date'''
Y
Yiqing Liu 已提交
118 119
          }
        }
120 121
       stage('python p2'){
         agent{label "p2"}
L
liuyq-617 已提交
122
         steps{
123 124 125 126 127 128
            pre_test()         
            sh '''
            date
            cd ${WKC}/tests
            ./test-all.sh p2
            date
L
liuyq-617 已提交
129
            '''
L
liuyq-617 已提交
130
          
L
liuyq-617 已提交
131 132
         }
       }
133 134
       
          
Y
Yiqing Liu 已提交
135 136 137 138
      }
    }

  }
139 140
  
}