Commit a453bf5e authored by 黎博's avatar 黎博

优化获取分支

parent 3cdcca66
...@@ -142,7 +142,7 @@ const gitBranch = async (svcName) => { ...@@ -142,7 +142,7 @@ const gitBranch = async (svcName) => {
const version = proConfig.git_lab === 'gitabc.xyqb.com' ? 'v3' : 'v4' const version = proConfig.git_lab === 'gitabc.xyqb.com' ? 'v3' : 'v4'
const token = config.gitlab.token const token = config.gitlab.token
const data = await awaitRequest({ const data = await awaitRequest({
url: `http://${proConfig.git_lab}/api/${version}/projects?per_page=300&search=${svcName}&private_token=${token}&simple=true`, url: `http://${proConfig.git_lab}/api/${version}/projects?per_page=200&search=${svcName}&private_token=${token}&simple=true`,
method: 'GET', method: 'GET',
}) })
if (data.length === 0) { if (data.length === 0) {
...@@ -164,7 +164,11 @@ const gitBranch = async (svcName) => { ...@@ -164,7 +164,11 @@ const gitBranch = async (svcName) => {
url: `http://${proConfig.git_lab}/api/${version}/projects/${projectId}/repository/branches?private_token=${token}&page=2&per_page=100`, url: `http://${proConfig.git_lab}/api/${version}/projects/${projectId}/repository/branches?private_token=${token}&page=2&per_page=100`,
method: 'GET', method: 'GET',
}) })
return branchInfo.concat(branchInfoPage2) var branchInfoPage3 = await awaitRequest({
url: `http://${proConfig.git_lab}/api/${version}/projects/${projectId}/repository/branches?private_token=${token}&page=3&per_page=100`,
method: 'GET',
})
return branchInfo.concat(branchInfoPage2).concat(branchInfoPage3)
} }
const getGitBranch = async function (ctx) { const getGitBranch = async function (ctx) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment