From 201e82fd6bde0ad89b9d9d438560f90a4e190b77 Mon Sep 17 00:00:00 2001 From: Yiqing Liu Date: Fri, 3 Dec 2021 11:25:38 +0800 Subject: [PATCH] Revert "[TD-11752]different branches use different dir (#8909)" This reverts commit 520c32169f1a3a1bf8c7977db7f31d0cfb936572. --- Jenkinsfile | 243 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 152 insertions(+), 91 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e9e9b52c70..245ba5b2e3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,54 +41,68 @@ def pre_test(){ killall -9 taosd ||echo "no taosd running" killall -9 gdb || echo "no gdb running" killall -9 python3.8 || echo "no python program running" - cd ${WS} - rm -rf ${WK} + cd ${WKC} + git reset --hard HEAD~10 >/dev/null ''' script { if (env.CHANGE_TARGET == 'master') { sh ''' - cd ${WS} - cd TDinternal_master - git pull - cd community - git pull - cd ${WS} - cp -fr TDinternal_master TDinternal + cd ${WKC} + git checkout master ''' } else if(env.CHANGE_TARGET == '2.0'){ sh ''' - cd ${WS} - cd TDinternal_2.0 - git pull - cd community - git pull - cd ${WS} - cp -fr TDinternal_2.0 TDinternal + cd ${WKC} + git checkout 2.0 ''' } else{ sh ''' - cd ${WS} - cd TDinternal_develop - git pull - cd community - git pull - cd ${WS} - cp -fr TDinternal_develop TDinternal + cd ${WKC} + git checkout develop ''' } } sh''' cd ${WKC} + [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md" + git pull >/dev/null git fetch origin +refs/pull/${CHANGE_ID}/merge git checkout -qf FETCH_HEAD + git clean -dfx + git ls-files --stage | grep 160000 | awk '{print $4}' | xargs git rm --cached git submodule update --init --recursive + cd ${WK} + git reset --hard HEAD~10 ''' + script { + if (env.CHANGE_TARGET == 'master') { + sh ''' + cd ${WK} + git checkout master + ''' + } + else if(env.CHANGE_TARGET == '2.0'){ + sh ''' + cd ${WK} + git checkout 2.0 + ''' + } + else{ + sh ''' + cd ${WK} + git checkout develop + ''' + } + } sh ''' - cd ${WK} + cd ${WK} + git pull >/dev/null + export TZ=Asia/Harbin date + git clean -dfx mkdir debug cd debug cmake .. > /dev/null @@ -102,112 +116,140 @@ def pre_test(){ def pre_test_noinstall(){ sh'hostname' sh''' - cd ${WS} - rm -rf ${WK} + cd ${WKC} + git reset --hard HEAD~10 >/dev/null ''' script { if (env.CHANGE_TARGET == 'master') { sh ''' - cd ${WS} - cd TDinternal_master - git pull - cd community - git pull - cd ${WS} - cp -fr TDinternal_master TDinternal + cd ${WKC} + git checkout master ''' } else if(env.CHANGE_TARGET == '2.0'){ sh ''' - cd ${WS} - cd TDinternal_20 - git pull - cd community - git pull - cd ${WS} - cp -fr TDinternal_20 TDinternal + cd ${WKC} + git checkout 2.0 ''' } else{ sh ''' - cd ${WS} - cd TDinternal_develop - git pull - cd community - git pull - cd ${WS} - cp -fr TDinternal_develop TDinternal + cd ${WKC} + git checkout develop ''' } } sh''' cd ${WKC} + [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md" + git pull >/dev/null git fetch origin +refs/pull/${CHANGE_ID}/merge git checkout -qf FETCH_HEAD + git clean -dfx + git ls-files --stage | grep 160000 | awk '{print $4}' | xargs git rm --cached git submodule update --init --recursive + cd ${WK} + git reset --hard HEAD~10 ''' + script { + if (env.CHANGE_TARGET == 'master') { + sh ''' + cd ${WK} + git checkout master + ''' + } + else if(env.CHANGE_TARGET == '2.0'){ + sh ''' + cd ${WK} + git checkout 2.0 + ''' + } + else{ + sh ''' + cd ${WK} + git checkout develop + ''' + } + } sh ''' - cd ${WK} + cd ${WK} + git pull >/dev/null + export TZ=Asia/Harbin date + git clean -dfx mkdir debug cd debug cmake .. > /dev/null - make + make ''' return 1 } def pre_test_mac(){ sh'hostname' sh''' - cd ${WS} - rm -rf ${WK} + cd ${WKC} + git reset --hard HEAD~10 >/dev/null ''' script { if (env.CHANGE_TARGET == 'master') { sh ''' - cd ${WS} - cd TDinternal_master - git pull - cd community - git pull - cd ${WS} - cp -fr TDinternal_master TDinternal + cd ${WKC} + git checkout master ''' } else if(env.CHANGE_TARGET == '2.0'){ sh ''' - cd ${WS} - cd TDinternal_20 - git pull - cd community - git pull - cd ${WS} - cp -fr TDinternal_20 TDinternal + cd ${WKC} + git checkout 2.0 ''' } else{ sh ''' - cd ${WS} - cd TDinternal_develop - git pull - cd community - git pull - cd ${WS} - cp -fr TDinternal_develop TDinternal + cd ${WKC} + git checkout develop ''' } } sh''' cd ${WKC} + [ -f src/connector/grafanaplugin/README.md ] && rm -f src/connector/grafanaplugin/README.md > /dev/null || echo "failed to remove grafanaplugin README.md" + git pull >/dev/null git fetch origin +refs/pull/${CHANGE_ID}/merge git checkout -qf FETCH_HEAD + git clean -dfx + git ls-files --stage | grep 160000 | awk '{print $4}' | xargs git rm --cached git submodule update --init --recursive + cd ${WK} + git reset --hard HEAD~10 ''' + script { + if (env.CHANGE_TARGET == 'master') { + sh ''' + cd ${WK} + git checkout master + ''' + } + else if(env.CHANGE_TARGET == '2.0'){ + sh ''' + cd ${WK} + git checkout 2.0 + ''' + } + else{ + sh ''' + cd ${WK} + git checkout develop + ''' + } + } sh ''' - cd ${WK} + cd ${WK} + git pull >/dev/null + export TZ=Asia/Harbin date + git clean -dfx mkdir debug cd debug cmake .. > /dev/null @@ -222,47 +264,67 @@ def pre_test_win(){ taskkill /f /t /im python.exe cd C:\\ rd /s /Q C:\\TDengine - cd C:\\workspace - rd /s /Q C:\\workspace\\TDinternal | echo 1 + cd C:\\workspace\\TDinternal + rd /s /Q C:\\workspace\\TDinternal\\debug + cd C:\\workspace\\TDinternal\\community + git reset --hard HEAD~10 ''' script { if (env.CHANGE_TARGET == 'master') { bat ''' - cd C:\\workspace\\TDinternal_master - git pull - cd C:\\workspace\\TDinternal_master\\community - git pull - xcopy /e/y/i/f C:\\workspace\\TDinternal_master C:\\workspace\\TDinternal + cd C:\\workspace\\TDinternal\\community + git checkout master ''' } else if(env.CHANGE_TARGET == '2.0'){ bat ''' - cd C:\\workspace\\TDinternal_20 - git pull - cd C:\\workspace\\TDinternal_20\\community - git pull - xcopy /e/y/i/f C:\\workspace\\TDinternal_20 C:\\workspace\\TDinternal + cd C:\\workspace\\TDinternal\\community + git checkout 2.0 ''' } else{ bat ''' - cd C:\\workspace\\TDinternal_develop - git pull - cd C:\\workspace\\TDinternal_develop\\community - git pull - xcopy /e/y/i/f C:\\workspace\\TDinternal_develop C:\\workspace\\TDinternal + cd C:\\workspace\\TDinternal\\community + git checkout develop ''' } } bat''' cd C:\\workspace\\TDinternal\\community + git pull git fetch origin +refs/pull/%CHANGE_ID%/merge git checkout -qf FETCH_HEAD + git clean -dfx git submodule update --init --recursive + cd C:\\workspace\\TDinternal + git reset --hard HEAD~10 ''' + script { + if (env.CHANGE_TARGET == 'master') { + bat ''' + cd C:\\workspace\\TDinternal + git checkout master + ''' + } + else if(env.CHANGE_TARGET == '2.0'){ + bat ''' + cd C:\\workspace\\TDinternal + git checkout 2.0 + ''' + } + else{ + bat ''' + cd C:\\workspace\\TDinternal + git checkout develop + ''' + } + } bat ''' cd C:\\workspace\\TDinternal + git pull + date + git clean -dfx mkdir debug cd debug call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat" amd64 @@ -282,7 +344,6 @@ pipeline { environment{ WK = '/var/lib/jenkins/workspace/TDinternal' WKC= '/var/lib/jenkins/workspace/TDinternal/community' - WS = '/var/lib/jenkins/workspace' } stages { stage('pre_build'){ -- GitLab