Skip to content

Commit b5707c3

Browse files
committed
support grepo update logic
1 parent 637ec59 commit b5707c3

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

CTP/common/script/start_consumer.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,18 @@ function updateCodes()
139139
{
140140
curDir=`pwd`
141141
branchName=$1
142+
143+
# Check branch change and remove cache if needed
144+
branchMarkerFile="${CTP_HOME}/.dailyqa/.current_branch"
145+
if [ -f "$branchMarkerFile" ]; then
146+
currentBranch=`cat $branchMarkerFile`
147+
if [ "$currentBranch" != "$branchName" ]; then
148+
localBranchName=`echo $branchName|sed 's#/#_#g'`
149+
cacheFile="${CTP_HOME}/.dailyqa/cubrid-testtools_${localBranchName}_CTP.zip"
150+
[ -f "$cacheFile" ] && rm -f "$cacheFile" && echo "Branch changed: $currentBranch -> $branchName (cache removed)"
151+
fi
152+
fi
153+
142154
changedCount=`cd ${CTP_HOME}; run_grepo_fetch -r cubrid-testtools -b "$branchName" -p "CTP" -e "conf" --check-only . | grep "fetch" | grep CHANGED | wc -l`
143155

144156
if [ "$changedCount" -gt "0" ]
@@ -369,20 +381,26 @@ do
369381
then
370382
echo "Action: $x, ${q_exec[$count]}.sh, CONTINUE"
371383
# Update CTP if ENV_CTP_BRANCH_NAME is set in continue mode
384+
tempBranchContinue=""
372385
if [ $withoutSync -ne 1 ]
373386
then
374387
source ${CTP_HOME}/common/sched/init.sh $ser_site
375388
if [ "$CTP_BRANCH_NAME" ] && [ "$CTP_BRANCH_NAME" != "$branchName" ]
376389
then
377390
echo "ENV_CTP_BRANCH_NAME detected: $CTP_BRANCH_NAME (updating from $branchName)"
378391
updateCodes $CTP_BRANCH_NAME
392+
tempBranchContinue="$branchName"
379393
fi
380394
fi
381395
(cd ${CTP_HOME}; export BUILD_IS_FROM_GIT=$isFromGit ;source ${CTP_HOME}/common/sched/init.sh $ser_site;sh common/ext/${q_exec[$count]}.sh YES)
382396

383397
echo
384398
echo "End continue mode test!"
385399
consumerTimer ${existsMsgId} "stop"
400+
401+
# Restore original branch if temp branch was used
402+
[ -n "$tempBranchContinue" ] && updateCodes $tempBranchContinue
403+
386404
contimeENDTIME=`getTimeStamp`
387405
echo "END_CONTINUE_TIME:${contimeENDTIME}"
388406
echo '' > ${CTP_HOME}/common/sched/status/${x}
@@ -393,13 +411,15 @@ do
393411
hasTestBuild
394412

395413
#update client again if ENV_CTP_BRANCH_NAME is set in message
414+
tempBranch=""
396415
if [ "$hasBuild" == "true" ] && [ $withoutSync -ne 1 ]
397416
then
398417
source ${CTP_HOME}/common/sched/init.sh $ser_site
399418
if [ "$CTP_BRANCH_NAME" ] && [ "$CTP_BRANCH_NAME" != "$branchName" ]
400419
then
401420
echo "ENV_CTP_BRANCH_NAME detected: $CTP_BRANCH_NAME (updating from $branchName)"
402421
updateCodes $CTP_BRANCH_NAME
422+
tempBranch="$branchName"
403423
fi
404424
fi
405425

@@ -440,6 +460,9 @@ do
440460

441461
consumerTimer $msgId "stop"
442462

463+
# Restore original branch if temp branch was used
464+
[ -n "$tempBranch" ] && updateCodes $tempBranch
465+
443466
ENDTIME=`getTimeStamp`
444467
echo
445468
echo "Clean msg id from queue file"

CTP/common/script/upgrade.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ mkdir -p ../.ctp
4747
cp -rf common/lib/* ../.ctp/
4848

4949
export `grep -E "^grepo_service_url" conf/common.conf | tr -d '\r'`
50-
"$JAVA_HOME/bin/java" -cp ../.ctp/cubridqa-common.jar com.navercorp.cubridqa.common.grepo.UpgradeMain -r cubrid-testtools -b "$branchName" -p "CTP" -e "conf" .; (chmod u+x ./bin/*; chmod u+x ./common/script/*; chmod u+x ./common/ext/*; chmod u+x sql/bin/*; rm -rf ../.ctp >/dev/null 3>&1); echo DONE; cd "${current_user_dir}"; exit
50+
"$JAVA_HOME/bin/java" -cp ../.ctp/cubridqa-common.jar com.navercorp.cubridqa.common.grepo.UpgradeMain -r cubrid-testtools -b "$branchName" -p "CTP" -e "conf" .; (chmod u+x ./bin/*; chmod u+x ./common/script/*; chmod u+x ./common/ext/*; chmod u+x sql/bin/*; mkdir -p ${dest_tool_dir}/.dailyqa; echo "$branchName" > ${dest_tool_dir}/.dailyqa/.current_branch; rm -rf ../.ctp >/dev/null 3>&1); echo DONE; cd "${current_user_dir}"; exit

0 commit comments

Comments
 (0)