提交 f5d0c3cf 编写于 作者: L liuyq-617

[TD-10750]remove default checkout in jenkins

上级 909d68ec
import hudson.model.Result import hudson.model.Result
import hudson.model.*; import hudson.model.*;
import jenkins.model.CauseOfInterruption import jenkins.model.CauseOfInterruption
properties([pipelineTriggers([githubPush()])])
node { node {
git url: 'https://github.com/taosdata/TDengine.git'
} }
def skipbuild=0 def skipbuild=0
...@@ -72,6 +70,7 @@ def pre_test(){ ...@@ -72,6 +70,7 @@ def pre_test(){
git fetch origin +refs/pull/${CHANGE_ID}/merge git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD git checkout -qf FETCH_HEAD
git clean -dfx git clean -dfx
git submodule update --init --recursive
cd ${WK} cd ${WK}
git reset --hard HEAD~10 git reset --hard HEAD~10
''' '''
...@@ -114,6 +113,7 @@ def pre_test(){ ...@@ -114,6 +113,7 @@ def pre_test(){
} }
def pre_test_win(){ def pre_test_win(){
bat ''' bat '''
taskkill /f /t /im python.exe
cd C:\\ cd C:\\
rd /s /Q C:\\TDengine rd /s /Q C:\\TDengine
cd C:\\workspace\\TDinternal cd C:\\workspace\\TDinternal
...@@ -147,6 +147,7 @@ def pre_test_win(){ ...@@ -147,6 +147,7 @@ def pre_test_win(){
git fetch origin +refs/pull/%CHANGE_ID%/merge git fetch origin +refs/pull/%CHANGE_ID%/merge
git checkout -qf FETCH_HEAD git checkout -qf FETCH_HEAD
git clean -dfx git clean -dfx
git submodule update --init --recursive
cd C:\\workspace\\TDinternal cd C:\\workspace\\TDinternal
git reset --hard HEAD~10 git reset --hard HEAD~10
''' '''
...@@ -171,7 +172,6 @@ def pre_test_win(){ ...@@ -171,7 +172,6 @@ def pre_test_win(){
} }
} }
bat ''' bat '''
taskkill /f /t /im python.exe
cd C:\\workspace\\TDinternal cd C:\\workspace\\TDinternal
git pull git pull
...@@ -192,6 +192,7 @@ def pre_test_win(){ ...@@ -192,6 +192,7 @@ def pre_test_win(){
} }
pipeline { pipeline {
agent none agent none
options { skipDefaultCheckout() }
environment{ environment{
WK = '/var/lib/jenkins/workspace/TDinternal' WK = '/var/lib/jenkins/workspace/TDinternal'
WKC= '/var/lib/jenkins/workspace/TDinternal/community' WKC= '/var/lib/jenkins/workspace/TDinternal/community'
...@@ -199,6 +200,7 @@ pipeline { ...@@ -199,6 +200,7 @@ pipeline {
stages { stages {
stage('pre_build'){ stage('pre_build'){
agent{label 'master'} agent{label 'master'}
options { skipDefaultCheckout() }
when { when {
changeRequest() changeRequest()
} }
...@@ -207,52 +209,52 @@ pipeline { ...@@ -207,52 +209,52 @@ pipeline {
abort_previous() abort_previous()
abortPreviousBuilds() abortPreviousBuilds()
} }
sh''' // sh'''
rm -rf ${WORKSPACE}.tes // rm -rf ${WORKSPACE}.tes
cp -r ${WORKSPACE} ${WORKSPACE}.tes // cp -r ${WORKSPACE} ${WORKSPACE}.tes
cd ${WORKSPACE}.tes // cd ${WORKSPACE}.tes
git fetch // git fetch
''' // '''
script { // script {
if (env.CHANGE_TARGET == 'master') { // if (env.CHANGE_TARGET == 'master') {
sh ''' // sh '''
git checkout master // git checkout master
''' // '''
} // }
else if(env.CHANGE_TARGET == '2.0'){ // else if(env.CHANGE_TARGET == '2.0'){
sh ''' // sh '''
git checkout 2.0 // git checkout 2.0
''' // '''
} // }
else{ // else{
sh ''' // sh '''
git checkout develop // git checkout develop
''' // '''
} // }
} // }
sh''' // sh'''
git fetch origin +refs/pull/${CHANGE_ID}/merge // git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD // git checkout -qf FETCH_HEAD
''' // '''
script{ // script{
skipbuild='2' // skipbuild='2'
skipbuild=sh(script: "git log -2 --pretty=%B | fgrep -ie '[skip ci]' -e '[ci skip]' && echo 1 || echo 2", returnStdout:true) // skipbuild=sh(script: "git log -2 --pretty=%B | fgrep -ie '[skip ci]' -e '[ci skip]' && echo 1 || echo 2", returnStdout:true)
println skipbuild // println skipbuild
} // }
sh''' // sh'''
rm -rf ${WORKSPACE}.tes // rm -rf ${WORKSPACE}.tes
''' // '''
// }
} }
} }
stage('Parallel test stage') { stage('Parallel test stage') {
//only build pr //only build pr
options { skipDefaultCheckout() }
when { when {
allOf{ allOf{
changeRequest() changeRequest()
expression{ not{ expression { env.CHANGE_BRANCH =~ /docs\// }}
return skipbuild.trim() == '2'
}
} }
} }
parallel { parallel {
...@@ -313,11 +315,25 @@ pipeline { ...@@ -313,11 +315,25 @@ pipeline {
cd ${WKC}/tests/examples/nodejs cd ${WKC}/tests/examples/nodejs
npm install td2.0-connector > /dev/null 2>&1 npm install td2.0-connector > /dev/null 2>&1
node nodejsChecker.js host=localhost 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
'''
sh '''
cd ${WKC}/src/connector/node-rest/
npm install
npm run build
npm run build:test
npm run test
''' '''
sh ''' sh '''
cd ${WKC}/tests/examples/C#/taosdemo cd ${WKC}/tests/examples/C#/taosdemo
mcs -out:taosdemo *.cs > /dev/null 2>&1 mcs -out:taosdemo *.cs > /dev/null 2>&1
./taosdemo -c /etc/taos -y echo '' |./taosdemo -c /etc/taos
cd ${WKC}/tests/connectorTest/C#Test/nanosupport
mcs -out:nano *.cs > /dev/null 2>&1
echo '' |./nano
''' '''
sh ''' sh '''
cd ${WKC}/tests/gotest cd ${WKC}/tests/gotest
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册