Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tke-eos
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
tke-eos
Commits
6396dfc1
Commit
6396dfc1
authored
Mar 26, 2020
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统计dev ns
parent
d202b0b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
12 deletions
+22
-12
deleteTestSvc.js
app/deleteTestSvc.js
+16
-10
index.js
config/index.js
+5
-1
dingTalk.js
utils/dingTalk.js
+1
-1
No files found.
app/deleteTestSvc.js
View file @
6396dfc1
/* eslint-disable guard-for-in */
const
schedule
=
require
(
'
node-schedule
'
)
const
logger
=
require
(
'
koa-log4
'
).
getLogger
(
'
deleteTestSvc
'
)
const
{
...
...
@@ -14,33 +15,38 @@ const deploy = async (cluster) => {
const
summary
=
{}
for
(
const
namespace
of
ns
.
namespaces
)
{
if
(
namespace
.
description
===
'
test
'
)
{
if
(
namespace
.
description
)
{
logger
.
info
(
'
开始检查ns:
'
,
namespace
.
name
)
summary
[
namespace
.
name
]
=
[]
if
(
!
summary
[
namespace
.
description
])
{
summary
[
namespace
.
description
]
=
{}
}
summary
[
namespace
.
description
][
namespace
.
name
]
=
[]
const
svcs
=
await
getServicesFormat
(
client
.
clientInfo
,
namespace
.
name
)
for
(
const
svc
of
svcs
)
{
if
(
svc
.
labels
.
type
!==
'
base
'
&&
!~
svc
.
image
.
indexOf
(
'
latest
'
)
&&
!~
svc
.
image
.
search
(
'
:master-
'
)
&&
~
svc
.
createdAt
.
search
(
'
month
'
))
{
summary
[
namespace
.
name
].
push
(
svc
.
image
.
split
(
'
/
'
)[
2
])
summary
[
namespace
.
description
][
namespace
.
name
].
push
(
svc
.
image
.
split
(
'
/
'
)[
2
])
}
}
logger
.
info
(
'
ns:
'
,
namespace
.
name
,
'
检查完毕
'
)
}
}
let
text
=
'
早。以下测试分支已经一个月没有更新啦,请确认该服务是否还在使用,如无回复将会被删除
\n\n
'
for
(
const
i
in
summary
)
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
summary
,
i
))
{
if
(
summary
[
i
].
length
)
{
text
=
`
${
text
}${
i
}
: \n\n
${
summary
[
i
].
join
(
'
\n\n
'
)}
\n\n`
const
title
=
'
早。以下测试分支已经一个月没有更新啦,请确认该服务是否还在使用,如无回复将会被删除
\n\n
'
for
(
const
type
in
summary
)
{
let
text
=
''
for
(
const
i
in
summary
[
type
])
{
if
(
summary
[
type
][
i
].
length
)
{
text
=
`
${
text
}${
i
}
: \n\n
${
summary
[
type
][
i
].
join
(
'
\n\n
'
)}
\n\n`
}
}
if
(
text
)
text
=
title
+
text
dingTalk
(
'
daily 闲置服务检查
'
,
text
,
APP_CONFIG
.
deleteTestSvcRobot
[
type
])
}
dingTalk
(
'
daily 闲置服务检查
'
,
text
,
APP_CONFIG
.
deleteTestSvcRobot
)
logger
.
info
(
'
deleteTestSvc job end
'
)
}
module
.
exports
=
()
=>
{
// schedule.scheduleJob('*/
2
* * * *', async () => {
// schedule.scheduleJob('*/
1
* * * *', async () => {
schedule
.
scheduleJob
(
'
59 9 * * 1-5
'
,
async
()
=>
{
try
{
await
deploy
(
'
qa
'
)
...
...
config/index.js
View file @
6396dfc1
...
...
@@ -15,5 +15,9 @@ module.exports = {
],
qaapiHost
:
'
http://qaapi.liangkebang.com
'
,
latestDingRobot
:
'
https://oapi.dingtalk.com/robot/send?access_token=99e801a2cf26680e6ce09cb12f830c21a03ae3df07d18f6a38e1db54c0e95f2c
'
,
deleteTestSvcRobot
:
'
https://oapi.dingtalk.com/robot/send?access_token=e6982a86338979a03d6a1e105469e3010ab1c0b18d80a49a84705c767dbf0e3c
'
,
deleteTestSvcRobot
:
{
test
:
'
https://oapi.dingtalk.com/robot/send?access_token=e6982a86338979a03d6a1e105469e3010ab1c0b18d80a49a84705c767dbf0e3c
'
,
dev
:
'
https://oapi.dingtalk.com/robot/send?access_token=08e45c0e77fdb3c18d47559729afe3fc6de624324ced77ebf3f4d0aa1a008de2
'
,
},
}
utils/dingTalk.js
View file @
6396dfc1
...
...
@@ -9,7 +9,7 @@ module.exports = async (title, text, url) => {
text
,
},
}
if
(
url
)
{
if
(
url
&&
text
)
{
await
awaitRequest
({
url
,
method
:
'
POST
'
,
...
...
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