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
2bbe4b13
Commit
2bbe4b13
authored
Oct 22, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兼容gitabc
parent
df2432df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
pipeline.js
app/controller/pipeline.js
+3
-2
No files found.
app/controller/pipeline.js
View file @
2bbe4b13
...
@@ -78,8 +78,9 @@ const webhooks = async function (ctx) {
...
@@ -78,8 +78,9 @@ const webhooks = async function (ctx) {
const
getMaster
=
async
function
(
ctx
)
{
const
getMaster
=
async
function
(
ctx
)
{
const
{
name
,
gitlabAddress
}
=
ctx
.
request
.
body
const
{
name
,
gitlabAddress
}
=
ctx
.
request
.
body
let
projectId
let
projectId
const
version
=
gitlabAddress
===
'
gitabc.xyqb.com
'
?
'
v3
'
:
'
v4
'
const
data
=
await
awaitRequest
({
const
data
=
await
awaitRequest
({
url
:
`http://
${
gitlabAddress
}
/api/
v4
/projects?per_page=200&search=
${
name
}
&private_token=
${
config
.
gitlab
.
token
}
`
,
url
:
`http://
${
gitlabAddress
}
/api/
${
version
}
/projects?per_page=200&search=
${
name
}
&private_token=
${
config
.
gitlab
.
token
}
`
,
method
:
'
GET
'
,
method
:
'
GET
'
,
})
})
if
(
JSON
.
parse
(
data
).
length
===
0
)
{
if
(
JSON
.
parse
(
data
).
length
===
0
)
{
...
@@ -93,7 +94,7 @@ const getMaster = async function (ctx) {
...
@@ -93,7 +94,7 @@ const getMaster = async function (ctx) {
}
}
})
})
const
dataMaster
=
await
awaitRequest
({
const
dataMaster
=
await
awaitRequest
({
url
:
`http://
${
gitlabAddress
}
/api/
v4
/projects/
${
projectId
}
/repository/branches?private_token=
${
config
.
gitlab
.
token
}
`
,
url
:
`http://
${
gitlabAddress
}
/api/
${
version
}
/projects/
${
projectId
}
/repository/branches?private_token=
${
config
.
gitlab
.
token
}
`
,
method
:
'
GET
'
,
method
:
'
GET
'
,
})
})
ctx
.
body
=
ctx
.
ok
(
JSON
.
parse
(
dataMaster
))
ctx
.
body
=
ctx
.
ok
(
JSON
.
parse
(
dataMaster
))
...
...
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