Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-api
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
1
Merge Requests
1
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-api
Commits
1dca0342
Commit
1dca0342
authored
Dec 03, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git项目适配
parent
c1f49288
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
pipeline.js
app/controller/pipeline.js
+5
-6
sonar.js
app/controller/sonar.js
+1
-1
No files found.
app/controller/pipeline.js
View file @
1dca0342
...
@@ -14,7 +14,7 @@ const config = require(global.configPath)
...
@@ -14,7 +14,7 @@ const config = require(global.configPath)
const
pipelineJenkinsBuild
=
async
function
(
data
)
{
const
pipelineJenkinsBuild
=
async
function
(
data
)
{
const
{
const
{
projectName
,
branchName
,
type
,
gitUser
,
commitMes
,
timestamp
,
projectName
,
branchName
,
type
,
gitUser
,
commitMes
,
}
=
data
}
=
data
const
jobName
=
`tke-
${
type
}
`
const
jobName
=
`tke-
${
type
}
`
const
buildData
=
{
const
buildData
=
{
...
@@ -37,7 +37,7 @@ const pipelineJenkinsBuild = async function (data) {
...
@@ -37,7 +37,7 @@ const pipelineJenkinsBuild = async function (data) {
branchName
,
branchName
,
commitMes
,
commitMes
,
gitUser
,
gitUser
,
gitEventTime
:
timestamp
||
moment
().
format
(
'
YYYY-MM-DD HH:mm:ss
'
),
gitEventTime
:
moment
().
format
(
'
YYYY-MM-DD HH:mm:ss
'
),
}
}
await
PipeLinePush
.
savePipesPush
(
store
)
await
PipeLinePush
.
savePipesPush
(
store
)
}
}
...
@@ -102,8 +102,7 @@ const webhooks = async function (ctx) {
...
@@ -102,8 +102,7 @@ const webhooks = async function (ctx) {
}
}
const
gitUser
=
req
.
user_username
const
gitUser
=
req
.
user_username
const
commitMes
=
req
.
commits
[
0
].
message
const
commitMes
=
req
.
commits
[
req
.
commits
-
1
].
messagesuccess
const
timestamp
=
req
.
commits
[
0
].
timestamp
// const project = await ProConfig.getOneProject({ project_name: projectName })
// const project = await ProConfig.getOneProject({ project_name: projectName })
// if (project.sonar) {
// if (project.sonar) {
...
@@ -128,7 +127,7 @@ const webhooks = async function (ctx) {
...
@@ -128,7 +127,7 @@ const webhooks = async function (ctx) {
if
(
gitObject
)
{
if
(
gitObject
)
{
logger
.
info
(
'
webhooks 触发 pipeline jenkins build
'
,
projectName
,
branchName
,
req
.
checkout_sha
)
logger
.
info
(
'
webhooks 触发 pipeline jenkins build
'
,
projectName
,
branchName
,
req
.
checkout_sha
)
pipelineJenkinsBuild
({
pipelineJenkinsBuild
({
projectName
,
branchName
,
type
:
gitObject
.
type
,
gitUser
,
commitMes
,
timestamp
,
projectName
,
branchName
,
type
:
gitObject
.
type
,
gitUser
,
commitMes
,
})
})
}
else
{
}
else
{
logger
.
info
(
`未查询到订阅信息->>>项目名:
${
projectName
}
分支名:
${
branchName
}
,不执行pipeline jenkins`
)
logger
.
info
(
`未查询到订阅信息->>>项目名:
${
projectName
}
分支名:
${
branchName
}
,不执行pipeline jenkins`
)
...
@@ -157,7 +156,7 @@ const getMaster = async function (ctx) {
...
@@ -157,7 +156,7 @@ const getMaster = async function (ctx) {
}
}
data
.
forEach
((
item
)
=>
{
data
.
forEach
((
item
)
=>
{
// 再次筛选下数据 因为gitlab返回的数据是模糊查询
// 再次筛选下数据 因为gitlab返回的数据是模糊查询
if
(
item
.
name
===
name
)
{
if
(
item
.
name
===
name
||
item
.
path
===
name
)
{
projectId
=
item
.
id
projectId
=
item
.
id
}
}
})
})
...
...
app/controller/sonar.js
View file @
1dca0342
...
@@ -40,7 +40,7 @@ const sendExistMail = async (data) => {
...
@@ -40,7 +40,7 @@ const sendExistMail = async (data) => {
+
`GITHASH :
${
data
.
branchHash
}
<br/>`
+
`GITHASH :
${
data
.
branchHash
}
<br/>`
+
`扫描分析日期 :
${
data
.
analysisDate
}
<br/>`
+
`扫描分析日期 :
${
data
.
analysisDate
}
<br/>`
+
`查看详情 :
${
config
.
sonarHost
}
/project/activity?id=
${
data
.
projectName
}
&&selected_date=
${
data
.
analysisDate
}
`
+
`查看详情 :
${
config
.
sonarHost
}
/project/activity?id=
${
data
.
projectName
}
&&selected_date=
${
data
.
analysisDate
}
`
sendMail
(
data
.
gitUserMail
,
`
${
data
.
project
}
${
title
}
`
,
text
)
sendMail
(
data
.
gitUserMail
,
`
${
data
.
project
Name
}
${
title
}
`
,
text
)
}
}
const
callback
=
async
(
ctx
)
=>
{
const
callback
=
async
(
ctx
)
=>
{
...
...
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