未验证 提交 a2ef07ed 编写于 作者: R rick

Move the code lines about getting pipelineRuns with remote paging into a new...

Move the code lines about getting pipelineRuns with remote paging into a new function: listPipelineRunsByRemotePaging
Signed-off-by: Nrick <1450685+LinuxSuRen@users.noreply.github.com>
上级 8d8f685d
......@@ -171,29 +171,35 @@ func (p *Pipeline) GetPipelineRun() (*devops.PipelineRun, error) {
}
func (p *Pipeline) ListPipelineRuns() (*devops.PipelineRunList, error) {
// please don't remove below code lines until blueocen fixed
//res, err := p.Jenkins.SendPureRequest(p.Path, p.HttpParameters)
//if err != nil {
// klog.Error(err)
// return nil, err
//}
//
//var pipelineRunList devops.PipelineRunList
//err = json.Unmarshal(res, &pipelineRunList.Items)
//if err != nil {
// klog.Error(err)
// return nil, err
//}
//total, err := p.searchPipelineRunsCount()
//if err != nil {
// klog.Error(err)
// return nil, err
//}
//pipelineRunList.Total = total
//return &pipelineRunList, err
// prefer to use listPipelineRunsByRemotePaging once the corresponding issues from BlueOcean fixed
return p.listPipelineRunsByLocalPaging()
}
// listPipelineRunsByRemotePaging get the pipeline runs with pagination by remote (Jenkins BlueOcean plugin)
// get the pagination information from the server side is better than the local side, but the API has some issues
// see also https://github.com/kubesphere/kubesphere/issues/3507
func (p *Pipeline) listPipelineRunsByRemotePaging() (*devops.PipelineRunList, error) {
res, err := p.Jenkins.SendPureRequest(p.Path, p.HttpParameters)
if err != nil {
klog.Error(err)
return nil, err
}
var pipelineRunList devops.PipelineRunList
err = json.Unmarshal(res, &pipelineRunList.Items)
if err != nil {
klog.Error(err)
return nil, err
}
total, err := p.searchPipelineRunsCount()
if err != nil {
klog.Error(err)
return nil, err
}
pipelineRunList.Total = total
return &pipelineRunList, err
}
// listPipelineRunsByLocalPaging should be a temporary solution
// see also https://github.com/kubesphere/kubesphere/issues/3507
func (p *Pipeline) listPipelineRunsByLocalPaging() (runList *devops.PipelineRunList, err error) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册