diff --git a/Jenkinsfile b/Jenkinsfile index 2c64e71f5112dca47fdb7cb3c2f1b5c85923b550..0d6939af3159ae1812e4b56ac942188628d4c70a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,8 +42,24 @@ def pre_test(){ killall -9 taosd ||echo "no taosd running" killall -9 gdb || echo "no gdb running" cd ${WKC} - git reset --hard HEAD~10 >/dev/null - git checkout develop + git reset --hard HEAD~10 >/dev/null + ''' + script { + if (env.CHANGE_TARGET == 'master') { + sh ''' + cd ${WKC} + git checkout master + ''' + } + else { + sh ''' + cd ${WKC} + git checkout develop + ''' + } + } + sh''' + cd ${WKC} git pull >/dev/null git fetch origin +refs/pull/${CHANGE_ID}/merge git checkout -qf FETCH_HEAD @@ -53,15 +69,22 @@ def pre_test(){ ''' script { if (env.CHANGE_TARGET == 'master') { - sh 'git checkout master' + sh ''' + cd ${WK} + git checkout master + ''' } else { - sh 'git checkout develop' + sh ''' + cd ${WK} + git checkout develop + ''' } } sh ''' - git pull >/dev/null + cd ${WK} + git pull >/dev/null export TZ=Asia/Harbin date git clean -dfx