fix sonarStatus api NEP, return [] if could not get last run
Signed-off-by: runzexia <runzexia@yunify.com>
This commit is contained in:
@@ -273,9 +273,12 @@ func GetMultiBranchPipelineSonar(projectId, pipelineId, branchId string) ([]*Son
|
||||
return nil, restful.NewError(utils.GetJenkinsStatusCode(err), err.Error())
|
||||
}
|
||||
build, err := job.GetLastBuild()
|
||||
if err != nil {
|
||||
if err != nil && utils.GetJenkinsStatusCode(err) != http.StatusNotFound {
|
||||
glog.Errorf("%+v", err)
|
||||
return nil, restful.NewError(utils.GetJenkinsStatusCode(err), err.Error())
|
||||
} else if err != nil {
|
||||
glog.Error("%+v", err)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
sonarStatus, err := getBuildSonarResults(build)
|
||||
@@ -288,6 +291,9 @@ func GetMultiBranchPipelineSonar(projectId, pipelineId, branchId string) ([]*Son
|
||||
if err != nil && utils.GetJenkinsStatusCode(err) != http.StatusNotFound {
|
||||
glog.Errorf("%+v", err)
|
||||
return nil, restful.NewError(utils.GetJenkinsStatusCode(err), err.Error())
|
||||
} else if err != nil {
|
||||
glog.Error("%+v", err)
|
||||
return nil, nil
|
||||
}
|
||||
sonarStatus, err = getBuildSonarResults(build)
|
||||
if err != nil {
|
||||
|
||||
@@ -369,7 +369,6 @@ func createOrUpdateRouterWorkload(namespace string, publishService bool, service
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if deployment.Spec.Template.Annotations == nil {
|
||||
deployment.Spec.Template.Annotations = make(map[string]string, 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user