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
a400b68d
Commit
a400b68d
authored
Apr 09, 2018
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
01510169
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
142 additions
and
146 deletions
+142
-146
get_project_config_server.js
qa_shell_script/config_server/get_project_config_server.js
+47
-48
temp.js
qa_shell_script/config_server/temp.js
+95
-98
No files found.
qa_shell_script/config_server/get_project_config_server.js
View file @
a400b68d
...
...
@@ -36,7 +36,6 @@ app.use(bodyParser.urlencoded({ extended: false }))
app
.
use
(
bodyParser
.
json
())
var
attrs
=
{
configPath
:
"
config_file
"
,
buildCmd
:
"
command2
"
,
gitPath
:
"
git_path
"
,
gitGroup
:
"
gitPathHead
"
,
host
:
"
www
"
,
...
...
@@ -47,9 +46,9 @@ var attrs = {
jarFilePath
:
"
target_path
"
,
auth
:
"
auth
"
,
port
:
"
port
"
,
start_command
:
"
"
,
st
op_command
:
"
"
,
command2
:
"
command
"
,
buildCmd
:
"
command2
"
,
st
artCmd
:
"
command
"
,
stopCmd
:
"
stop_
command
"
,
node_version
:
"
node_version
"
}
var
attrComs
=
Object
.
keys
(
attrs
)
...
...
@@ -131,10 +130,10 @@ function getProjectConfigPromise() {
temp
.
command2
=
pro
[
"
build_command
"
];
temp
.
command
=
pro
[
"
start_command
"
];
}
else
if
(
pro
[
"
type
"
]
==
"
ui
"
)
{
temp
.
command2
=
pro
[
"
build_command
"
];
temp
.
command2
=
pro
[
"
build_command
"
];
}
else
if
(
pro
[
"
type
"
]
==
"
node
"
)
{
temp
.
command
=
pro
[
"
start_command
"
]
temp
.
command2
=
pro
[
"
stop_command
"
]
temp
.
stop_command
=
pro
[
"
stop_command
"
]
}
else
if
(
pro
[
"
type
"
]
==
"
python
"
)
{
}
...
...
@@ -150,8 +149,8 @@ function getProjectConfigPromise() {
function
getProjectConfigPromiseByDb
()
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
// mongoose.model("ProConfig",new mongoose.Schema({}))
ProConfig
.
find
({}).
exec
().
then
(
res
=>
{
// let _pros = JSON.parse(JSON.stringify(res));
ProConfig
.
find
({}).
exec
().
then
(
res
=>
{
// let _pros = JSON.parse(JSON.stringify(res));
resolve
(
res
)
}).
catch
((
err
)
=>
{
reject
(
err
)
...
...
@@ -361,46 +360,46 @@ admin.get('/get_namespace_by_type_for_jenkins/:_type', async function (req, res)
// 给jenkins使用获取服务groupname_projectname
admin
.
get
(
'
/get_groupname_by_type_for_jenkins/:_type
'
,
async
function
(
req
,
res
)
{
let
configs
=
await
getProjectConfigPromiseByDb
();
let
re
=
{
ui
:
[],
java
:
[],
node
:
[],
python
:
[]
};
let
xjdui
=
[[
""
,
""
],[
""
,
""
]],
payui
=
[[
""
,
""
],[
""
,
""
]]
for
(
let
o
of
configs
)
{
if
(
o
.
project_name
==
"
xyqb-ui
"
)
{
xjdui
[
0
][
0
]
=
o
.
git_path_group
xjdui
[
1
][
0
]
=
o
.
project_name
}
else
if
(
o
.
project_name
==
"
paycenter-ui
"
)
{
payui
[
0
][
0
]
=
o
.
git_path_group
payui
[
1
][
0
]
=
o
.
project_name
}
else
if
(
o
.
project_name
==
"
xjd-ui
"
)
{
xjdui
[
0
][
1
]
=
o
.
git_path_group
xjdui
[
1
][
1
]
=
o
.
project_name
}
else
if
(
o
.
project_name
==
"
new-paycenter-ui
"
)
{
payui
[
0
][
1
]
=
o
.
git_path_group
payui
[
1
][
1
]
=
o
.
project_name
}
else
{
if
(
req
.
params
.
_type
!=
"
lua_ui
"
)
{
if
(
re
[
req
.
params
.
_type
]
==
undefined
)
{
re
[
req
.
params
.
_type
]
=
[];
}
re
[
o
.
type
].
push
(
`
${
o
.
git_path_group
}
/
${
o
.
project_name
}
`
)
}
}
}
function
getLuaUiStr
(
item
)
{
return
`
${
item
[
0
][
0
]}
--
${
item
[
0
][
1
]}
/
${
item
[
1
][
0
]}
--
${
item
[
1
][
1
]}
`
}
let
lua_ui
=
[],
cb
=
""
;
if
(
req
.
params
.
_type
==
"
lua_ui
"
)
{
lua_ui
.
push
(
getLuaUiStr
(
xjdui
));
lua_ui
.
push
(
getLuaUiStr
(
payui
));
cb
=
lua_ui
.
join
(
"
\n
"
);
}
else
{
res
.
send
(
re
[
req
.
params
.
_type
].
join
(
"
\n
"
));
}
let
re
=
{
ui
:
[],
java
:
[],
node
:
[],
python
:
[]
};
let
xjdui
=
[[
""
,
""
],
[
""
,
""
]],
payui
=
[[
""
,
""
],
[
""
,
""
]]
for
(
let
o
of
configs
)
{
if
(
o
.
project_name
==
"
xyqb-ui
"
)
{
xjdui
[
0
][
0
]
=
o
.
git_path_group
xjdui
[
1
][
0
]
=
o
.
project_name
}
else
if
(
o
.
project_name
==
"
paycenter-ui
"
)
{
payui
[
0
][
0
]
=
o
.
git_path_group
payui
[
1
][
0
]
=
o
.
project_name
}
else
if
(
o
.
project_name
==
"
xjd-ui
"
)
{
xjdui
[
0
][
1
]
=
o
.
git_path_group
xjdui
[
1
][
1
]
=
o
.
project_name
}
else
if
(
o
.
project_name
==
"
new-paycenter-ui
"
)
{
payui
[
0
][
1
]
=
o
.
git_path_group
payui
[
1
][
1
]
=
o
.
project_name
}
else
{
if
(
req
.
params
.
_type
!=
"
lua_ui
"
)
{
if
(
re
[
req
.
params
.
_type
]
==
undefined
)
{
re
[
req
.
params
.
_type
]
=
[];
}
re
[
o
.
type
].
push
(
`
${
o
.
git_path_group
}
/
${
o
.
project_name
}
`
)
}
}
}
function
getLuaUiStr
(
item
)
{
return
`
${
item
[
0
][
0
]}
--
${
item
[
0
][
1
]}
/
${
item
[
1
][
0
]}
--
${
item
[
1
][
1
]}
`
}
let
lua_ui
=
[],
cb
=
""
;
if
(
req
.
params
.
_type
==
"
lua_ui
"
)
{
lua_ui
.
push
(
getLuaUiStr
(
xjdui
));
lua_ui
.
push
(
getLuaUiStr
(
payui
));
cb
=
lua_ui
.
join
(
"
\n
"
);
}
else
{
res
.
send
(
re
[
req
.
params
.
_type
].
join
(
"
\n
"
));
}
});
// 增加一个新的nginx映射
...
...
qa_shell_script/config_server/temp.js
View file @
a400b68d
var
request
=
require
(
'
request
'
);
function
requestPromise
(
option
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
request
(
option
,
function
(
err
,
res
,
body
)
{
if
(
err
)
{
reject
(
err
)
}
else
{
resolve
(
body
)
}
})
})
function
requestPromise
(
option
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
request
(
option
,
function
(
err
,
res
,
body
)
{
if
(
err
)
{
reject
(
err
)
}
else
{
resolve
(
body
)
}
})
})
}
var
getattr
=
function
(
pro
)
{
this
.
url
=
`http://192.168.4.3:10088/config_server/get_project_attr/
${
pro
}
`
;
this
.
method
=
"
GET
"
this
.
url
=
`http://192.168.4.3:10088/config_server/get_project_attr/
${
pro
}
`
;
this
.
method
=
"
GET
"
}
var
getpros
=
function
()
{
this
.
url
=
`http://192.168.4.3:10088/config_server/get_systems_by_type_for_temp`
;
this
.
method
=
"
GET
"
this
.
url
=
`http://192.168.4.3:10088/config_server/get_systems_by_type_for_temp`
;
this
.
method
=
"
GET
"
}
let
save_pod
=
function
(
body
)
{
this
.
url
=
`http://192.168.28.170:3002/proconfig/server/save`
;
this
.
method
=
"
POST
"
this
.
body
=
body
;
this
.
json
=
true
;
let
save_pod
=
function
(
body
)
{
this
.
url
=
`http://192.168.28.170:3002/proconfig/server/save`
;
this
.
method
=
"
POST
"
this
.
body
=
body
;
this
.
json
=
true
;
}
function
dosomething
(
ty
,
rs
)
{
for
(
let
i
of
rs
)
{
function
dosomething
(
ty
,
rs
)
{
for
(
let
i
of
rs
)
{
console
.
log
(
i
)
let
_arrt_o
=
new
getattr
(
i
)
requestPromise
(
_arrt_o
).
then
(
res
=>
{
let
_arrt_o
=
new
getattr
(
i
)
requestPromise
(
_arrt_o
).
then
(
res
=>
{
let
attr
=
JSON
.
parse
(
res
);
let
body
=
{
port
:
attr
.
port
,
is_active
:
true
,
type
:
ty
,
git_path
:
attr
.
gitPath
,
host_name
:
attr
.
host
,
log_path
:
attr
.
logName
,
config_path
:
attr
.
configPath
,
des
:
attr
.
projectDesc
,
auth
:
attr
.
auth
,
jar_path
:
""
,
command1
:
""
,
command2
:
""
,
command3
:
""
,
command4
:
""
,
command5
:
""
,
build_command
:
""
,
start_command
:
""
,
stop_command
:
""
let
body
=
{
port
:
attr
.
port
,
is_active
:
true
,
type
:
ty
,
git_path
:
attr
.
gitPath
,
host_name
:
attr
.
host
,
log_path
:
attr
.
logName
,
config_path
:
attr
.
configPath
,
des
:
attr
.
projectDesc
,
auth
:
attr
.
auth
,
jar_path
:
""
,
command1
:
""
,
command2
:
""
,
command3
:
""
,
command4
:
""
,
command5
:
""
,
build_command
:
""
,
start_command
:
""
,
stop_command
:
""
}
// "port": attr.port,
// "is_active": true,
// "type": ty,
// "port":attr.port,
// "full_name": attr.projectDesc,
// "git_path": attr.gitPath,
// "host_name": attr.host,
// "log_path": attr.logName,
// "config_path": attr.configPath,
// "des": attr.projectDesc,
// "auth": attr.auth,
// "jar_path": "",
// "command1": "",
// "command2": "",
// "command3": "",
// "command4": "",
// "command5": "",
// "build_command": "",
// "start_command": "",
// "stop_command": ""}
if
(
ty
==
"
java
"
)
{
body
.
jar_path
=
attr
.
jarFilePath
;
body
.
command1
=
attr
.
node_version
;
body
.
build_command
=
attr
.
buildCmd
;
body
.
start_command
=
attr
.
command2
;
}
else
if
(
ty
==
"
ui
"
)
{
body
.
build_command
=
attr
.
buildCmd
;
}
else
if
(
ty
==
"
node
"
)
{
body
.
start_command
=
attr
.
buildCmd
;
body
.
stop_command
=
attr
.
command2
;
}
else
if
(
ty
==
"
python
"
)
{
}
// "port": attr.port,
// "is_active": true,
// "type": ty,
// "port":attr.port,
// "full_name": attr.projectDesc,
// "git_path": attr.gitPath,
// "host_name": attr.host,
// "log_path": attr.logName,
// "config_path": attr.configPath,
// "des": attr.projectDesc,
// "auth": attr.auth,
// "jar_path": "",
// "command1": "",
// "command2": "",
// "command3": "",
// "command4": "",
// "command5": "",
// "build_command": "",
// "start_command": "",
// "stop_command": ""}
if
(
ty
==
"
java
"
){
body
.
jar_path
=
attr
.
jarFilePath
;
body
.
command1
=
attr
.
node_version
;
body
.
build_command
=
attr
.
command2
;
body
.
start_command
=
attr
.
buildCmd
;
}
else
if
(
ty
==
"
ui
"
){
body
.
build_command
=
attr
.
buildCmd
;
}
else
if
(
ty
==
"
node
"
){
body
.
start_command
=
attr
.
buildCmd
;
body
.
stop_command
=
attr
.
command2
;
}
else
if
(
ty
==
"
python
"
){
}
let
save_pod_o
=
new
save_pod
(
body
)
console
.
log
(
body
)
requestPromise
(
save_pod_o
)
let
save_pod_o
=
new
save_pod
(
body
)
console
.
log
(
body
)
requestPromise
(
save_pod_o
)
});
}
}
function
main
(){
function
main
()
{
let
_o
=
new
getpros
();
console
.
log
(
"
-----
"
)
requestPromise
(
_o
).
then
(
res
=>
{
// console.log(res)
let
rr
=
JSON
.
parse
(
res
);
let
ks
=
Object
.
keys
(
rr
);
console
.
log
(
ks
)
for
(
let
i
of
ks
)
{
dosomething
(
i
,
rr
[
i
])
}
});
requestPromise
(
_o
).
then
(
res
=>
{
// console.log(res)
let
rr
=
JSON
.
parse
(
res
);
let
ks
=
Object
.
keys
(
rr
);
console
.
log
(
ks
)
for
(
let
i
of
ks
)
{
dosomething
(
i
,
rr
[
i
])
}
});
}
main
()
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