Jenkinsfile 8.5 KB
Newer Older
Y
Yiqing Liu 已提交
1
pipeline {
L
liuyq-617 已提交
2 3 4 5 6
  agent none
  environment{
      WK = '/var/lib/jenkins/workspace/TDinternal'
      WKC= '/var/lib/jenkins/workspace/TDinternal/community'
  }
L
liuyq-617 已提交
7

Y
Yiqing Liu 已提交
8
  stages {
L
liuyq-617 已提交
9
      stage('Parallel test stage') {
Y
Yiqing Liu 已提交
10
      parallel {
L
liuyq-617 已提交
11
        stage('pytest') {
L
liuyq-617 已提交
12
          agent{label '184'}
L
liuyq-617 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
          steps {
            sh '''
            date
            cd ${WKC}
            git checkout develop
            git pull
            git submodule update
            cd ${WK}
            git checkout develop
            git pull
            export TZ=Asia/Harbin
            date
            rm -rf ${WK}/debug
            mkdir debug
            cd debug
            cmake .. > /dev/null
            make > /dev/null
            cd ${WKC}/tests
            #./test-all.sh smoke
            ./test-all.sh pytest
            date'''
          }
        }
L
liuyq-617 已提交
36
        stage('test_b1') {
L
liuyq-617 已提交
37
          agent{label 'master'}
Y
Yiqing Liu 已提交
38
          steps {
L
liuyq-617 已提交
39 40 41 42
            sh '''
            cd ${WKC}
            git checkout develop
            git pull
L
liuyq-617 已提交
43
              
L
liuyq-617 已提交
44 45 46 47 48 49 50 51 52 53 54 55 56
            git submodule update
            cd ${WK}
            git checkout develop
            git pull
            export TZ=Asia/Harbin
            date
            rm -rf ${WK}/debug
            mkdir debug
            cd debug
            cmake .. > /dev/null
            make > /dev/null
            cd ${WKC}/tests
            #./test-all.sh smoke
L
liuyq-617 已提交
57
            ./test-all.sh b1
L
liuyq-617 已提交
58
            date'''
Y
Yiqing Liu 已提交
59 60 61 62
          }
        }

        stage('test_crash_gen') {
L
liuyq-617 已提交
63
          agent{label "185"}
Y
Yiqing Liu 已提交
64
          steps {
L
liuyq-617 已提交
65 66 67 68
            sh '''
            cd ${WKC}
            git checkout develop
            git pull
L
liuyq-617 已提交
69
              
L
liuyq-617 已提交
70 71 72 73 74
            git submodule update
            cd ${WK}
            git checkout develop
            git pull
            export TZ=Asia/Harbin
L
liuyq-617 已提交
75
            
L
liuyq-617 已提交
76 77 78 79 80 81
            rm -rf ${WK}/debug
            mkdir debug
            cd debug
            cmake .. > /dev/null
            make > /dev/null
            cd ${WKC}/tests/pytest
L
liuyq-617 已提交
82 83 84 85 86 87 88
            '''
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WKC}/tests/pytest
                ./crash_gen.sh -a -p -t 4 -s 2000
                '''
            }
89 90 91 92 93 94 95
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WKC}/tests/pytest
                ./crash_gen.sh --valgrind -p -t 10 -s 100 -b 4
                ./handle_crash_gen_val_log.sh
                '''
            }
L
liuyq-617 已提交
96
            sh '''
L
liuyq-617 已提交
97 98
            date
            cd ${WKC}/tests
L
liuyq-617 已提交
99
            ./test-all.sh b2
L
liuyq-617 已提交
100 101
            date
            '''
Y
Yiqing Liu 已提交
102 103 104 105
          }
        }

        stage('test_valgrind') {
L
liuyq-617 已提交
106
          agent{label "186"}
L
liuyq-617 已提交
107

Y
Yiqing Liu 已提交
108
          steps {
L
liuyq-617 已提交
109 110 111 112
            sh '''
            cd ${WKC}
            git checkout develop
            git pull
L
liuyq-617 已提交
113
              
L
liuyq-617 已提交
114 115 116 117 118 119 120 121 122 123 124 125
            git submodule update
            cd ${WK}
            git checkout develop
            git pull
            export TZ=Asia/Harbin
            date
            rm -rf ${WK}/debug
            mkdir debug
            cd debug
            cmake .. > /dev/null
            make > /dev/null
            cd ${WKC}/tests/pytest
L
liuyq-617 已提交
126
            ./valgrind-test.sh 2>&1 > mem-error-out.log
127 128
            ./handle_val_log.sh
          
L
liuyq-617 已提交
129
            date
L
liuyq-617 已提交
130 131
            cd ${WKC}/tests
            ./test-all.sh b3
L
liuyq-617 已提交
132
            date'''
Y
Yiqing Liu 已提交
133 134
          }
        }
L
liuyq-617 已提交
135 136 137 138 139 140 141
       stage('connector'){
         agent{label "release"}
         steps{
            sh'''
            cd ${WORKSPACE}
            git checkout develop
            '''
L
liuyq-617 已提交
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WORKSPACE}/tests/gotest
                bash batchtest.sh
                '''
            }
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WORKSPACE}/tests/examples/python/PYTHONConnectorChecker
                python3 PythonChecker.py
                '''
            }
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${WORKSPACE}/tests/examples/JDBC/JDBCDemo/
                mvn clean package assembly:single >/dev/null 
                java -jar target/jdbcChecker-SNAPSHOT-jar-with-dependencies.jar -host 127.0.0.1
                '''
            }
            catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                sh '''
                cd ${JENKINS_HOME}/workspace/C#NET/src/CheckC#
                dotnet run
                '''
            }
          
L
liuyq-617 已提交
168 169
         }
       }
Y
Yiqing Liu 已提交
170 171 172 173 174

      }
    }

  }
L
liuyq-617 已提交
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
  post {             
        success {
            emailext (
                subject: "SUCCESSFUL: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
                body: '''<!DOCTYPE html>
                <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">
                                    <li>构建名称>>分支:${PROJECT_NAME}</li>
                                    <li>构建结果:<span style="color:green"> Successful </span></li>
                                    <li>构建编号:${BUILD_NUMBER}</li>
                                    <li>触发用户:${CAUSE}</li>
                                    <li>变更概要:${CHANGES}</li>
                                    <li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
                                    <li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
                                    <li>变更集:${JELLY_SCRIPT}</li>
                                </div>
                                </ul>
                            </td>
                        </tr>
                    </table></font>
                </body>
                </html>''',
                to: "yqliu@taosdata.com,pxiao@taosdata.com",
                from: "support@taosdata.com"
            )
        }
        failure {
            emailext (
                subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
                body: '''<!DOCTYPE html>
                <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">
                                    <li>构建名称>>分支:${PROJECT_NAME}</li>
                                    <li>构建结果:<span style="color:green"> Successful </span></li>
                                    <li>构建编号:${BUILD_NUMBER}</li>
                                    <li>触发用户:${CAUSE}</li>
                                    <li>变更概要:${CHANGES}</li>
                                    <li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
                                    <li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
                                    <li>变更集:${JELLY_SCRIPT}</li>
                                </div>
                                </ul>
                            </td>
                        </tr>
                    </table></font>
                </body>
                </html>''',
                to: "yqliu@taosdata.com,pxiao@taosdata.com",
                from: "support@taosdata.com"
            )
        }
    }
L
liuyq-617 已提交
253
}