diff --git a/Jenkinsfile b/Jenkinsfile index 8952e493dbdc68fdf17e03b29604dfde3cc6ee62..6b3d9e51510ce10d38bd49a56a63e9859e5cd691 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ node { git url: 'https://github.com/taosdata/TDengine.git' } - +def kipstage=0 def abortPreviousBuilds() { def currentJobName = env.JOB_NAME def currentBuildNumber = env.BUILD_NUMBER.toInteger() @@ -63,6 +63,7 @@ def pre_test(){ ''' return 1 } + pipeline { agent none @@ -72,12 +73,33 @@ pipeline { } stages { - + stage('pre_build'){ + agent{label 'master'} + when { + changeRequest() + } + steps { + sh''' + cd ${WORKSPACE} + git checkout develop + git pull + git fetch origin +refs/pull/${CHANGE_ID}/merge + git checkout -qf FETCH_HEAD + ''' + script{ + skipstage=sh(script:"git --no-pager diff --name-only FETCH_HEAD develop|grep -v -E '.*md|//src//connector|Jenkinsfile|test-all.sh' || echo 1 ",returnStdout:true) + } + } + } stage('Parallel test stage') { + //only build pr when { changeRequest() + expression { + skipstage != 1 + } } parallel { stage('python_1_s1') { @@ -127,7 +149,7 @@ pipeline { stage('test_b1_s2') { agent{label 'b1'} steps { - timeout(time: 90, unit: 'MINUTES'){ + timeout(time: 45, unit: 'MINUTES'){ pre_test() sh ''' cd ${WKC}/tests @@ -240,8 +262,7 @@ pipeline { } } } - post { - + post { success { emailext ( subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' SUCCESS", @@ -300,7 +321,7 @@ pipeline {