Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-deploy-utils
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
qa-deploy-utils
Commits
85ee1ef4
Commit
85ee1ef4
authored
May 19, 2017
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asdfasdf
parent
641f85af
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
57 additions
and
47 deletions
+57
-47
2_get_code_by_name.sh
qa_shell_script/2_get_code_by_name.sh
+2
-2
2_get_code_by_type.sh
qa_shell_script/2_get_code_by_type.sh
+11
-1
3_link_config_file_by_name.sh
qa_shell_script/3_link_config_file_by_name.sh
+2
-2
3_link_config_file_by_type.sh
qa_shell_script/3_link_config_file_by_type.sh
+7
-8
4_build_by_name.sh
qa_shell_script/4_build_by_name.sh
+8
-8
4_build_by_type.sh
qa_shell_script/4_build_by_type.sh
+6
-3
5_restart_by_name.sh
qa_shell_script/5_restart_by_name.sh
+8
-10
5_restart_by_type.sh
qa_shell_script/5_restart_by_type.sh
+1
-3
deploy_project_by_name.sh
qa_shell_script/deploy_project_by_name.sh
+4
-4
deploy_project_by_type.sh
qa_shell_script/deploy_project_by_type.sh
+6
-4
exception_sub_shell.sh
qa_shell_script/exception_sub_shell.sh
+1
-1
remote_excute.sh
qa_shell_script/remote_excute.sh
+1
-1
No files found.
qa_shell_script/2_get_code_by_name.sh
View file @
85ee1ef4
...
...
@@ -15,7 +15,7 @@ if [ -n "$project_folder" ];then
command2
=
`
node
$config_server
/get_project_config.js
-name
$project_name
-attr
command2
`
command2
fi
sh
$config_server
/show_info.sh
$project_name
pull代码
$desc
sh
$config_server
/show_info.sh
$project_name
pull代码
$desc
$3
cd
./
$project_name
git checkout ./
git fetch
...
...
@@ -37,7 +37,7 @@ if [ -n "$project_folder" ];then
fi
else
desc
=
`
node
$config_server
/get_project_config.js
-name
$project_name
-attr
desc
`
sh
$config_server
/show_info.sh
$project_name
clone代码
$desc
sh
$config_server
/show_info.sh
$project_name
clone代码
$desc
$3
echo
"node
$config_server
/get_project_config.js -name
$project_name
-attr git_path"
git_path
=
`
node
$config_server
/get_project_config.js
-name
$project_name
-attr
git_path
`
echo
"git clone
$git_path
"
...
...
qa_shell_script/2_get_code_by_type.sh
View file @
85ee1ef4
...
...
@@ -24,10 +24,20 @@ function getCode()
echo
"sh
$config_server
/show_info.sh
$project
pull代码
$desc
$2
"
sh
$config_server
/show_info.sh
$project
pull代码
$desc
$2
cd
./
$project
git reset
--hard
git checkout ./
git fetch
git pull
if
[
-n
"
$git_branch
"
]
;
then
if
[
$?
-ne
0
]
;
then
echo
"error: Pulling is not possible because you have unmerged files"
cd
$project_path
rm
-rf
$project_folder
sh
$config_server
/show_info.sh
$project
clone代码
$desc
$2
git_path
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
git_path
`
git clone
$git_path
fi
if
[
-n
"
$git_branch
"
-a
$git_branch
!=
"originalBBB"
]
;
then
echo
"git checkout -f
$git_branch
"
git checkout
-f
$git_branch
fi
git pull
...
...
qa_shell_script/3_link_config_file_by_name.sh
View file @
85ee1ef4
...
...
@@ -8,13 +8,13 @@ config_path=`cat $config_server/config_path.sh`
if
[
"
$project
"
=
"nginx"
]
then
sh
$config_server
/show_info.sh nginx.conf_d 连接配置文件 nginx配置文件
sh
$config_server
/show_info.sh nginx.conf_d 连接配置文件 nginx配置文件
$3
rm
-rf
/etc/nginx/conf.d
ln
-s
$config_path
/nginx_conf.d /etc/nginx/conf.d
nginx
-t
;
nginx
-s
reload
else
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
连接配置文件
$desc
sh
$config_server
/show_info.sh
$project
连接配置文件
$desc
$3
project_type
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
type
`
file
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
config_file
`
...
...
qa_shell_script/3_link_config_file_by_type.sh
View file @
85ee1ef4
...
...
@@ -18,23 +18,23 @@ function linkProjectConfig()
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
连接配置文件
$desc
$3
file
=
`
node
$config_server
/get_project_config.js
-name
${
project
}
-attr
config_file
`
echo
"----rm -rf /home/quant_group/
${
project
}
/
$file
"
echo
"rm -rf /home/quant_group/
${
project
}
/
$file
"
rm
-rf
/home/quant_group/
${
project
}
/
$file
if
$is_public_ip
&&
[
-n
"
$is_public_ip
"
]
then
echo
"
---
ln -s
$config_path
/public/
$project_type
/
${
project
}
.* /home/quant_group/
${
project
}
/
$file
"
echo
"ln -s
$config_path
/public/
$project_type
/
${
project
}
.* /home/quant_group/
${
project
}
/
$file
"
ln
-s
$config_path
/public/
$project_type
/
${
project
}
.
*
/home/quant_group/
${
project
}
/
$file
else
echo
"
---
ln -s
$config_path
/
$project_type
/
${
project
}
.* /home/quant_group/
${
project
}
/
$file
"
echo
"ln -s
$config_path
/
$project_type
/
${
project
}
.* /home/quant_group/
${
project
}
/
$file
"
ln
-s
$config_path
/
$project_type
/
${
project
}
.
*
/home/quant_group/
${
project
}
/
$file
fi
if
[
"
$project
"
=
"xyqb-mall"
]
then
rm
-rf
/home/quant_group/xyqb-mall/baitiao
echo
"
~~
ln -s
$config_path
/pem_file /home/quant_group/xyqb-mall/baitiao"
echo
"ln -s
$config_path
/pem_file /home/quant_group/xyqb-mall/baitiao"
ln
-s
$config_path
/pem_file /home/quant_group/xyqb-mall/baitiao
fi
}
...
...
@@ -46,16 +46,15 @@ function cpProjectConfig()
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
连接配置文件
$desc
$3
file
=
`
node
$config_server
/get_project_config.js
-name
${
project
}
-attr
config_file
`
echo
"----rm -rf /home/quant_group/
${
project
}
/
$file
"
echo
"rm -rf /home/quant_group/
${
project
}
/
$file
"
rm
-rf
/home/quant_group/
${
project
}
/
$file
if
$is_public_ip
&&
[
-n
"
$is_public_ip
"
]
then
echo
"
---
cp
$config_path
/public/
$project_type
/
${
project
}
.* /home/quant_group/
${
project
}
/
$file
"
echo
"cp
$config_path
/public/
$project_type
/
${
project
}
.* /home/quant_group/
${
project
}
/
$file
"
cp
$config_path
/public/
$project_type
/
${
project
}
.
*
/home/quant_group/
${
project
}
/
$file
else
echo
"
---
cp
$config_path
/
$project_type
/
${
project
}
.* /home/quant_group/
${
project
}
/
$file
"
echo
"cp
$config_path
/
$project_type
/
${
project
}
.* /home/quant_group/
${
project
}
/
$file
"
cp
$config_path
/
$project_type
/
${
project
}
.
*
/home/quant_group/
${
project
}
/
$file
fi
}
...
...
qa_shell_script/4_build_by_name.sh
View file @
85ee1ef4
...
...
@@ -21,7 +21,7 @@ function buildJavaProject()
{
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
BUILD
$desc
sh
$config_server
/show_info.sh
$project
BUILD
$desc
$2
cd
$project_path
/
$project
rm
-rf
./target/
...
...
@@ -65,7 +65,7 @@ function buildUiProject()
{
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
BUILD
$desc
sh
$config_server
/show_info.sh
$project
BUILD
$desc
$2
config_file
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
config_file
`
command
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
command
`
node_version
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
node_version
`
...
...
@@ -117,7 +117,7 @@ function buildNodeProject()
{
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
BUILD
$desc
sh
$config_server
/show_info.sh
$project
BUILD
$desc
$2
config_file
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
config_file
`
command
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
command
`
node_version
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
node_version
`
...
...
@@ -135,7 +135,7 @@ function buildPythonProject()
{
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
BUILD
$desc
sh
$config_server
/show_info.sh
$project
BUILD
$desc
$2
config_file
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
config_file
`
cd
$project_path
/
$project
setup_path_temp
=
`
find ./
-name
"setup.py"
`
...
...
@@ -146,11 +146,11 @@ function buildPythonProject()
}
if
[
"
$project_type
"
=
"java"
]
;
then
buildJavaProject
$project_name
buildJavaProject
$project_name
$3
elif
[
"
$project_type
"
=
"ui"
]
;
then
buildUiProject
$project_name
buildUiProject
$project_name
$3
elif
[
"
$project_type
"
=
"node"
]
;
then
buildNodeProject
$project_name
buildNodeProject
$project_name
$3
elif
[
"
$project_type
"
=
"python"
]
;
then
buildPythonProject
$project_name
buildPythonProject
$project_name
$3
fi
qa_shell_script/4_build_by_type.sh
View file @
85ee1ef4
...
...
@@ -18,7 +18,8 @@ function buildJavaProject()
{
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
BUILD
$desc
$2
echo
sh
$config_server
/show_info.sh
$project
"打包BUILD"
$desc
$2
cd
$project_path
/
$project
rm
-rf
./target/
...
...
@@ -56,7 +57,8 @@ function buildUiProject()
{
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
BUILD
$desc
echo
sh
$config_server
/show_info.sh
$project
"打包BUILD"
$desc
$2
config_file
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
config_file
`
command
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
command
`
node_version
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
node_version
`
...
...
@@ -104,7 +106,7 @@ function buildUiProject()
function
buildNginx
()
{
# 第二步 不关机使得nginx生效
sh
$config_server
/show_info.sh nginx.config_d
BUILD
nginx配置文件生效
$2
sh
$config_server
/show_info.sh nginx.config_d
"打包BUILD"
nginx配置文件生效
$2
nginx
-t
;
nginx
-s
reload
}
...
...
@@ -112,6 +114,7 @@ function buildNodeProject()
{
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
echo
sh
$config_server
/show_info.sh
$project
"打包BUILD"
$desc
$2
config_file
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
config_file
`
command
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
command
`
...
...
qa_shell_script/5_restart_by_name.sh
View file @
85ee1ef4
...
...
@@ -19,7 +19,7 @@ function restartJavaProject()
ack_phrase
=
"Started
\
Bootstrap"
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
sh
$config_server
/show_info.sh
$project
重新启动
$desc
sh
$config_server
/show_info.sh
$project
重新启动
$desc
$2
cd
$project_path
/
$project
P_UUID
=
`
ps
-ef
|grep
${
project
}
.jar |grep
-v
'grep'
|awk
'{print $2}'
`
if
[
-n
"
${
P_UUID
}
"
]
;
then
...
...
@@ -52,9 +52,7 @@ function restartJavaProject()
mv
$project_path
/logs/
$log_name
$project_path
/logs/
$project
.log.
$time
if
[[
$project
==
"xyqb-mall"
]]
;
then
echo
`
java
-Xmx1024m
-XX
:PermSize64m
-Xloggc
:/tmp/
${
project
}
.log
-XX
:+PrintGCDetails
-XX
:+PrintGCTimeStamps
-jar
${
project
}
.jar
--worker
1
--currentW
orker 1
-t
-ts
>
/dev/null 2>&1 &
`
elif
[[
$project
==
"redpacket"
]]
;
then
if
[[
$project
==
"redpacket"
]]
;
then
echo
`
java
-Xmx512m
-XX
:PermSize64m
-Xloggc
:/tmp/
${
project
}
.log
-XX
:+PrintGCDetails
-XX
:+PrintGCTimeStamps
-jar
${
project
}
.jar
--worker
1
--currentWorker
1
-t
-ts
>
/dev/null 2>&1 &
`
else
echo
`
java
-Xmx512m
-XX
:PermSize64m
-Xloggc
:/tmp/
${
project
}
.log
-XX
:+PrintGCDetails
-XX
:+PrintGCTimeStamps
-jar
${
project
}
.jar
--worker
1
--currentWorker
1
-t
>
/dev/null 2>&1 &
`
...
...
@@ -74,7 +72,7 @@ function restartNodeProject()
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
stop_command
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
command2
`
sh
$config_server
/show_info.sh
$project
重新启动
$desc
sh
$config_server
/show_info.sh
$project
重新启动
$desc
$2
cd
$project_path
/
$project
$stop_command
# forever stop $project
...
...
@@ -99,7 +97,7 @@ function restartPythonProject()
project
=
$1
desc
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
desc
`
port
=
`
node
$config_server
/get_project_config.js
-name
$project
-attr
port
`
sh
$config_server
/show_info.sh
$project
重新启动
$desc
sh
$config_server
/show_info.sh
$project
重新启动
$desc
$2
cd
$project_path
/
$project
setup_path_temp
=
`
find ./
-name
"run.py"
`
python_project_path
=
$project_path
/
$project
${
setup_path_temp
/\.\//\/
}
...
...
@@ -164,11 +162,11 @@ function ack()
}
if
[
"
$project_type
"
=
"java"
]
;
then
restartJavaProject
$project_name
restartJavaProject
$project_name
$3
elif
[
"
$project_type
"
=
"node"
]
;
then
restartNodeProject
$project_name
restartNodeProject
$project_name
$3
elif
[
"
$project_type
"
=
"python"
]
;
then
restartPythonProject
$project_name
restartPythonProject
$project_name
$3
elif
[
"
$project_type
"
=
"ui"
]
;
then
restartUiProject
$project_name
restartUiProject
$project_name
$3
fi
qa_shell_script/5_restart_by_type.sh
View file @
85ee1ef4
...
...
@@ -50,9 +50,7 @@ function restartJavaProject()
echo
"-----project:
$project
while be run command: java -Xmx256m -XX:PermSize64m -Xloggc:/tmp/
${
project
}
.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -jar
${
project
}
.jar --worker 1 --currentWorker 1 -t > /dev/null 2>&1 &"
#echo `java -Xmx512m -XX:PermSize64m -Xloggc:/tmp/${project}.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -jar ${project}.jar --worker 1 --currentWorker 1 -t > /dev/null 2>&1 &`
if
[[
$project
==
"xyqb-mall"
]]
;
then
echo
`
java
-Xmx1024m
-XX
:PermSize64m
-Xloggc
:/tmp/
${
project
}
.log
-XX
:+PrintGCDetails
-XX
:+PrintGCTimeStamps
-jar
${
project
}
.jar
--worker
1
--currentWorker
1
-t
-ts
>
/dev/null 2>&1 &
`
elif
[[
$project
==
"redpacket"
]]
;
then
if
[[
$project
==
"redpacket"
]]
;
then
echo
`
java
-Xmx512m
-XX
:PermSize64m
-Xloggc
:/tmp/
${
project
}
.log
-XX
:+PrintGCDetails
-XX
:+PrintGCTimeStamps
-jar
${
project
}
.jar
--worker
1
--currentWorker
1
-t
-ts
>
/dev/null 2>&1 &
`
else
echo
`
java
-Xmx512m
-XX
:PermSize64m
-Xloggc
:/tmp/
${
project
}
.log
-XX
:+PrintGCDetails
-XX
:+PrintGCTimeStamps
-jar
${
project
}
.jar
--worker
1
--currentWorker
1
-t
>
/dev/null 2>&1 &
`
...
...
qa_shell_script/deploy_project_by_name.sh
View file @
85ee1ef4
...
...
@@ -3,11 +3,11 @@ project_name=$1
branch_name
=
$2
public_ip
=
$3
sh /home/qa-deploy-utils/qa_shell_script/2_get_code_by_name.sh
$project_name
$branch_name
sh /home/qa-deploy-utils/qa_shell_script/2_get_code_by_name.sh
$project_name
$branch_name
$4
if
[[
$?
==
128
]]
;
then
echo
"Invalid argument to exit"
exit
fi
sh /home/qa-deploy-utils/qa_shell_script/3_link_config_file_by_name.sh
$project_name
$public_ip
sh /home/qa-deploy-utils/qa_shell_script/4_build_by_name.sh
$project_name
$public_ip
sh /home/qa-deploy-utils/qa_shell_script/5_restart_by_name.sh
$project_name
$public_ip
sh /home/qa-deploy-utils/qa_shell_script/3_link_config_file_by_name.sh
$project_name
$public_ip
$4
sh /home/qa-deploy-utils/qa_shell_script/4_build_by_name.sh
$project_name
$public_ip
$4
sh /home/qa-deploy-utils/qa_shell_script/5_restart_by_name.sh
$project_name
$public_ip
$4
qa_shell_script/deploy_project_by_type.sh
View file @
85ee1ef4
...
...
@@ -9,6 +9,7 @@ pwd_path="/home/qa-deploy-utils/qa_shell_script"
config_server
=
"
$pwd_path
/config_server"
project_path
=
`
cat
$config_server
/project_path.sh
`
config_path
=
`
cat
$config_server
/config_path.sh
`
echo
"********"
if
[
"
$project_type
"
=
"all"
]
then
projects
=(
`
node
$config_server
/get_project_config.js
-type
ui
-attr
name
`
)
...
...
@@ -23,12 +24,13 @@ else
projects
=(
`
node
$config_server
/get_project_config.js
-type
$1
-attr
name
`
)
echo
${#
projects
[@]
}
"个"
$1
"项目:"
${
projects
[@]
}
fi
echo
"sh 2_get_code_by_type.sh
$project_type
$branch_name
$ip
"
echo
"********"
echo
"********sh 2_get_code_by_type.sh
$project_type
$branch_name
$ip
********"
sh 2_get_code_by_type.sh
$project_type
$branch_name
$ip
echo
"
sh 3_link_config_file_by_type.sh
$project_type
$public_ip
$ip
"
echo
"
********sh 3_link_config_file_by_type.sh
$project_type
$public_ip
$ip
********
"
sh 3_link_config_file_by_type.sh
$project_type
$public_ip
$ip
echo
"
sh 4_build_by_type.sh
$project_type
$public_ip
$ip
"
echo
"
********sh 4_build_by_type.sh
$project_type
$public_ip
$ip
********-
"
sh 4_build_by_type.sh
$project_type
$public_ip
$ip
echo
"
sh 5_restart_by_type.sh
$project_type
$public_ip
$ip
"
echo
"
********sh 5_restart_by_type.sh
$project_type
$public_ip
$ip
********
"
sh 5_restart_by_type.sh
$project_type
$public_ip
$ip
date
qa_shell_script/exception_sub_shell.sh
View file @
85ee1ef4
...
...
@@ -73,7 +73,7 @@ tranceConfig nginx "\/home\/quant_group\/paycenter-ui\/dist" "\/home\/quant_grou
#tranceConfig java "paycenter.host.url=http:\/\/192.168.4.15:7007" "paycenter.host.url=http:\/\/wechattest1.xyqb.com" "192.168.4.15" "gu-bei.properties"
#tranceConfig java "139.198.2.95:1507" "wechattest1.xyqb.com" "192.168.4.15" "gu-bei.properties"
#tranceConfig java "loanorder" "loanstatus" "192.168.4.15" "xyqb.properties"
tranceConfig java
"xyqb-ui.url=http://192.168.4.15:7001"
"xyqb-ui.url=http://192.168.4.15:7057"
"192.168.4.15"
"xyqb.properties"
#
tranceConfig java "xyqb-ui.url=http://192.168.4.15:7001" "xyqb-ui.url=http://192.168.4.15:7057" "192.168.4.15" "xyqb.properties"
#4.16
...
...
qa_shell_script/remote_excute.sh
View file @
85ee1ef4
...
...
@@ -36,7 +36,7 @@ else
expect
\"
]#
\"
send
\"
cd /home/qa-deploy-utils/qa_shell_script
\r\"
expect
\"
]#
\"
send
\"
sh deploy_project_by_type.sh
$project_type
$branch_name
$public_ip
\r\"
send
\"
sh deploy_project_by_type.sh
$project_type
$branch_name
$public_ip
$ip
\r\"
set timeout -1
expect
\"
]#
\"
send
\"
exit
\r\"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment