Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qg-dockerfiles
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
qg-dockerfiles
Commits
c1c11839
Commit
c1c11839
authored
Feb 18, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui run.sh
parent
ff0a7eae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
156 additions
and
4 deletions
+156
-4
Dockerfile
tke/ui/Dockerfile
+2
-0
replace.py
tke/ui/replace.py
+71
-0
replace_config.yaml
tke/ui/replace_config.yaml
+81
-0
run.sh
tke/ui/run.sh
+2
-4
No files found.
tke/ui/Dockerfile
View file @
c1c11839
...
...
@@ -31,5 +31,7 @@ COPY --from=0 /code/* /home/quant_group/
COPY
docker-entrypoint.sh .
COPY
run.sh .
COPY
replace.py .
COPY
replace_config.yaml .
RUN
chmod
+x ./docker-entrypoint.sh
CMD
./docker-entrypoint.sh
\ No newline at end of file
tke/ui/replace.py
0 → 100644
View file @
c1c11839
# coding=UTF-8
from
__future__
import
print_function
import
io
import
yaml
import
fileinput
import
os
import
os.path
import
re
import
copy
import
sys
import
string
f
=
io
.
open
(
'replace_config.yaml'
,
'r'
,
encoding
=
'utf-8'
)
res
=
yaml
.
load
(
f
)
print
(
"全部配置信息:"
,
res
)
# 获取当前项目的配置
env
=
os
.
environ
project
=
env
.
get
(
'SYSTEM_NAME'
)
config
=
res
.
get
(
project
,
res
.
get
(
'common'
))
config
=
sorted
(
config
.
items
(),
key
=
lambda
rule
:
(
rule
[
1
][
'order'
],
rule
[
0
]))
print
(
project
,
"的配置信息:"
,
config
)
namespace
=
env
.
get
(
'NAMESPACE'
)
print
(
'namespace:'
,
namespace
)
print
(
'host:'
,
sys
.
argv
[
1
])
files
=
[]
acceptType
=
{
'.html'
,
'.js'
,
'.css'
}
def
findFile
(
dir
):
if
os
.
path
.
isfile
(
dir
):
suffix
=
os
.
path
.
splitext
(
dir
)[
-
1
]
if
(
suffix
in
acceptType
):
files
.
append
(
dir
)
return
else
:
for
sub
in
os
.
listdir
(
dir
):
findFile
(
dir
+
'/'
+
sub
)
distPaths
=
[]
if
'--'
in
project
:
distPaths
.
append
(
os
.
path
.
abspath
(
project
.
split
(
'--'
)[
0
]
+
'/dist'
))
distPaths
.
append
(
os
.
path
.
abspath
(
project
.
split
(
'--'
)[
1
]
+
'/dist'
))
else
:
distPaths
.
append
(
os
.
path
.
abspath
(
project
+
'/dist'
))
# 过滤符合要求的文件路径
for
distPath
in
distPaths
:
print
(
"dist路径:"
,
distPath
)
findFile
(
distPath
)
# 替换文件中的内容
for
file
in
files
:
for
line
in
fileinput
.
input
(
file
,
inplace
=
1
):
for
item
in
config
:
rule
=
copy
.
deepcopy
(
item
[
1
])
if
rule
.
get
(
'useNamespace'
,
None
)
and
rule
[
'to'
]:
rule
[
'to'
]
=
'-'
+
namespace
+
rule
[
'to'
]
if
rule
.
get
(
'useHost'
,
None
):
domain
=
sys
.
argv
[
1
]
.
split
(
'.'
)[
0
]
rule
[
'to'
]
=
'//'
+
domain
+
rule
[
'to'
]
if
rule
[
'reg'
]:
p
=
re
.
compile
(
r''
+
rule
[
'reg'
])
line
=
re
.
sub
(
p
,
rule
[
'to'
],
line
)
print
(
line
,
end
=
''
)
fileinput
.
close
()
f
.
close
()
\ No newline at end of file
tke/ui/replace_config.yaml
0 → 100644
View file @
c1c11839
# reg: 匹配的正则
# to: 正则匹配后替换需要的值
# useNamespace: 是否在替换的值前追加 '-[namespace名称]'
# useHost: 是否在替换时使用该项目域名的第一段
# order 默认0, 负数用在自定义属性上,在通用规则前生效
rule
:
&rule
reg
:
'
'
to
:
'
'
useNamespace
:
false
useHost
:
false
order
:
0
lkbDomain
:
&lkbDomain
'
.liangkebang.com'
# 替换xyqbapi
xyqbApiRule
:
&xyqbApiRule
<<
:
*rule
reg
:
'
(?<=\w).xyqb.com'
to
:
*lkbDomain
useNamespace
:
true
# 替换quantgroupApi
quantgroupApiRule
:
&quantgroupApiRule
<<
:
*rule
reg
:
'
(?<=\w).quantgroup.cn'
to
:
*lkbDomain
useNamespace
:
true
# 替换cookie
xyqbCookieRule
:
&xyqbCookieRule
<<
:
*rule
reg
:
'
(?<![\w]).xyqb.com'
to
:
*lkbDomain
qgApiRule
:
&qgApiRule
<<
:
*rule
reg
:
'
(?<=\w).q-gp.com'
to
:
*lkbDomain
useNamespace
:
true
qgCookieRule
:
&qgCookieRule
<<
:
*rule
reg
:
'
(?<![\w]).q-gp.com'
to
:
*lkbDomain
h5AuthRule
:
&h5AuthRule
<<
:
*rule
# reg: 'auth[-a-z]*\.[a-z]*\.[a-z]*'
reg
:
'
auth.quantgroup.cn'
to
:
'
operator.liangkebang.com'
staticRule
:
&staticRule
<<
:
*rule
reg
:
'
//static[-/0-9a-z.]*public'
to
:
*lkbDomain
useNamespace
:
true
useHost
:
true
# 神测用户采集
bnRule
:
&bnRule
<<
:
*rule
reg
:
'
bn[-/0-9a-z.]*liangkebang.com'
to
:
'
bn.xyqb.com'
order
:
8
# 神测测试环境
bnDefaultRule
:
&bnDefaultRule
<<
:
*rule
reg
:
'
.com/sa.gif?project=production'
to
:
'
.com/sa.gif?project=default'
common
:
&common
h5AuthRule
:
*h5AuthRule
qgApiRule
:
*qgApiRule
qgCookieRule
:
*qgCookieRule
quantgroupApiRule
:
*quantgroupApiRule
staticRule
:
*staticRule
xyqbApiRule
:
*xyqbApiRule
xyqbCookieRule
:
*xyqbCookieRule
bnRule
:
*bnRule
bnDefaultRule
:
*bnDefaultRule
\ No newline at end of file
tke/ui/run.sh
View file @
c1c11839
...
...
@@ -25,12 +25,10 @@ do
echo
"tar zxf
${
current
}
/
$with_ext
-C
${
current
}
/
$fname
"
tar
zxf
${
current
}
/
$with_ext
-C
${
current
}
/
$fname
# echo "rm -rf ${package_path}/$with_ext"
# rm -rf ${package_path}/$with_ext
done
curl
-sSL
http://git.quantgroup.cn/QA/config_repository/raw/master/yaml/replace.py
-o
replace.py
curl
-sSL
http://git.quantgroup.cn/QA/config_repository/raw/master/yaml/replace_config.yaml
-o
replace_config.yaml
#
curl -sSL http://git.quantgroup.cn/QA/config_repository/raw/master/yaml/replace.py -o replace.py
#
curl -sSL http://git.quantgroup.cn/QA/config_repository/raw/master/yaml/replace_config.yaml -o replace_config.yaml
python replace.py
$host
;
echo
"/usr/bin/openresty -g 'daemon off;'"
...
...
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