From c504199d90f1e89fb80eb870a78efeb2ef238f64 Mon Sep 17 00:00:00 2001 From: Yiqing Liu Date: Mon, 28 Jun 2021 15:47:18 +0800 Subject: [PATCH] [TD-4932]fix jenkins errors on master branch (#6645) * [TD-4932]fix jenkins errors on master branch * fix * fix * fix * fix --- Jenkinsfile | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6b6ef420e6..d685df3d0c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -119,16 +119,32 @@ pipeline { abortPreviousBuilds() } sh''' + rm -rf ${WORKSPACE}.tes cp -r ${WORKSPACE} ${WORKSPACE}.tes cd ${WORKSPACE}.tes - git checkout develop - git pull + + ''' + script { + if (env.CHANGE_TARGET == 'master') { + sh ''' + git checkout master + git pull origin master + ''' + } + else { + sh ''' + git checkout develop + git pull origin develop + ''' + } + } + sh''' git fetch origin +refs/pull/${CHANGE_ID}/merge git checkout -qf FETCH_HEAD ''' script{ - env.skipstage=sh(script:"cd ${WORKSPACE}.tes && git --no-pager diff --name-only FETCH_HEAD develop|grep -v -E '.*md|//src//connector|Jenkinsfile|test-all.sh' || echo 0 ",returnStdout:true) + env.skipstage=sh(script:"cd ${WORKSPACE}.tes && git --no-pager diff --name-only FETCH_HEAD ${env.CHANGE_TARGET}|grep -v -E '.*md|//src//connector|Jenkinsfile|test-all.sh' || echo 0 ",returnStdout:true) } println env.skipstage sh''' -- GitLab