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
fe061725
Commit
fe061725
authored
Feb 28, 2018
by
tywldx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
bf272002
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
561 additions
and
435 deletions
+561
-435
get_project_config.js
qa_shell_script/config_server/get_project_config.js
+42
-276
get_project_config.js.back
qa_shell_script/config_server/get_project_config.js.back
+392
-0
get_project_config_from_mongo.js
...ell_script/config_server/get_project_config_from_mongo.js
+0
-159
temp.js
qa_shell_script/config_server/temp.js
+127
-0
No files found.
qa_shell_script/config_server/get_project_config.js
View file @
fe061725
This diff is collapsed.
Click to expand it.
qa_shell_script/config_server/get_project_config.js.back
0 → 100755
View file @
fe061725
This diff is collapsed.
Click to expand it.
qa_shell_script/config_server/get_project_config_from_mongo.js
deleted
100755 → 0
View file @
bf272002
var
cproc
=
require
(
'
child_process
'
);
var
execSync
=
cproc
.
execSync
;
var
project_name
,
project_attr
,
projects
=
{},
java_projects
=
[],
node_projects
=
[],
python_projects
=
[],
ui_projects
=
[];
var
param
=
{
type
:
""
,
name
:
""
,
attr
:
""
}
projects
=
{}
_projects
=
String
(
execSync
(
`curl -s http://192.168.4.3:10088/config_server/get_project_config_from_db`
))
_projects
=
JSON
.
parse
(
_projects
)
// console.log(typeof(projects))
for
(
let
pro
of
_projects
)
{
projects
[
pro
.
name
]
=
pro
;
switch
(
pro
[
'
type
'
])
{
case
"
java
"
:
java_projects
.
push
(
pro
);
break
;
case
"
node
"
:
node_projects
.
push
(
pro
);
break
;
case
"
ui
"
:
ui_projects
.
push
(
pro
);
break
;
case
"
python
"
:
python_projects
.
push
(
pro
);
break
;
}
}
var
temp
=
""
;
process
.
argv
.
forEach
(
function
(
val
,
index
,
array
)
{
if
(
index
>=
2
)
{
if
(
index
%
2
==
0
)
{
temp
=
val
.
replace
(
/
\-
/
,
""
);
param
[
temp
]
=
""
;
}
else
{
param
[
temp
]
=
val
;
}
}
});
function
getListAttr
(
projects
,
attr
)
{
var
list
=
[];
for
(
var
i
=
0
;
i
<
projects
.
length
;
i
++
)
{
// if (projects[i].is_active) {
list
.
push
(
projects
[
i
][
attr
])
// }
}
return
list
.
join
(
"
"
);
}
var
configFunction
=
function
()
{};
configFunction
.
prototype
=
{
getProjectAttr
:
function
(
pName
,
pAttr
)
{
if
(
typeof
projects
[
pName
]
==
"
undefined
"
)
{
console
.
log
(
""
)
}
else
{
var
attrs
=
pAttr
.
split
(
"
/
"
);
if
(
attrs
.
length
==
0
)
{
console
.
log
(
""
)
return
}
var
list
=
[];
for
(
var
j
=
0
;
j
<
attrs
.
length
;
j
++
)
{
if
(
projects
[
pName
][
attrs
[
j
]]){
list
.
push
(
projects
[
pName
][
attrs
[
j
]].
split
(
"
"
).
join
(
"
^
"
));
}
else
{
list
.
push
(
"
"
);
}
}
console
.
log
(
list
.
join
(
"
|
"
))
}
},
getProjectsAttrs
:
function
(
projects
,
attr
,
attr2
)
{
var
attrs
=
attr
.
split
(
"
/
"
);
if
(
attrs
.
length
==
0
)
{
return
}
var
list
=
[];
//attr2 专有参数,用来表示是否要取带有对外域名的服务
if
(
attr2
==
"
true
"
){
for
(
var
i
=
0
;
i
<
projects
.
length
;
i
++
)
{
if
(
projects
[
i
].
url
!=
""
){
var
li
=
[
projects
[
i
][
"
name
"
]];
for
(
var
j
=
0
;
j
<
attrs
.
length
;
j
++
)
{
li
.
push
(
projects
[
i
][
attrs
[
j
]]);
}
// li.push(projects[i].url);
list
.
push
(
li
.
join
(
"
|
"
));
}
}
}
else
{
for
(
var
i
=
0
;
i
<
projects
.
length
;
i
++
)
{
// if (projects[i].is_active){
var
li
=
[
projects
[
i
][
"
name
"
]];
for
(
var
j
=
0
;
j
<
attrs
.
length
;
j
++
)
{
li
.
push
(
projects
[
i
][
attrs
[
j
]]);
}
list
.
push
(
li
.
join
(
"
|
"
));
// }
}
}
return
list
.
join
(
"
"
);
},
getProjectsAttr
:
function
(
type
,
attr
)
{
switch
(
type
)
{
case
"
java
"
:
console
.
log
(
getListAttr
(
java_projects
,
attr
));
break
;
case
"
ui
"
:
console
.
log
(
getListAttr
(
ui_projects
,
attr
));
break
;
case
"
python
"
:
console
.
log
(
getListAttr
(
python_projects
,
attr
));
break
;
case
"
node
"
:
console
.
log
(
getListAttr
(
node_projects
,
attr
));
break
;
}
}
}
//tower add
module
.
exports
=
{
java
:
java_projects
,
node
:
node_projects
,
python
:
python_projects
,
ui
:
ui_projects
}
var
F
=
new
configFunction
();
try
{
if
(
param
[
"
type
"
]
==
""
)
{
F
.
getProjectAttr
(
param
[
"
name
"
],
param
[
"
attr
"
]);
}
else
if
(
param
[
"
type
"
]
==
"
multi
"
)
{
var
str
=
""
;
str
+=
F
.
getProjectsAttrs
(
java_projects
,
param
[
"
attr
"
],
param
[
"
attr2
"
]);
str
+=
"
"
+
F
.
getProjectsAttrs
(
ui_projects
,
param
[
"
attr
"
],
param
[
"
attr2
"
]);
str
+=
"
"
+
F
.
getProjectsAttrs
(
python_projects
,
param
[
"
attr
"
],
param
[
"
attr2
"
]);
str
+=
"
"
+
F
.
getProjectsAttrs
(
node_projects
,
param
[
"
attr
"
],
param
[
"
attr2
"
]);
console
.
log
(
str
)
}
else
if
(
param
[
"
type
"
]
==
"
hosts
"
)
{
console
.
log
(
JSON
.
stringify
(
hosts
));
}
else
{
F
.
getProjectsAttr
(
param
[
"
type
"
],
param
[
"
attr
"
]);
}
}
catch
(
e
)
{
console
.
log
(
e
)
}
qa_shell_script/config_server/temp.js
0 → 100644
View file @
fe061725
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
)
}
})
})
}
var
getattr
=
function
(
pro
)
{
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
"
}
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
){
console
.
log
(
i
)
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
:
""
}
// "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
)
});
}
}
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
])
}
});
}
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