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())
|
return nil, restful.NewError(utils.GetJenkinsStatusCode(err), err.Error())
|
||||||
}
|
}
|
||||||
build, err := job.GetLastBuild()
|
build, err := job.GetLastBuild()
|
||||||
if err != nil {
|
if err != nil && utils.GetJenkinsStatusCode(err) != http.StatusNotFound {
|
||||||
glog.Errorf("%+v", err)
|
glog.Errorf("%+v", err)
|
||||||
return nil, restful.NewError(utils.GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(utils.GetJenkinsStatusCode(err), err.Error())
|
||||||
|
} else if err != nil {
|
||||||
|
glog.Error("%+v", err)
|
||||||
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
sonarStatus, err := getBuildSonarResults(build)
|
sonarStatus, err := getBuildSonarResults(build)
|
||||||
@@ -288,6 +291,9 @@ func GetMultiBranchPipelineSonar(projectId, pipelineId, branchId string) ([]*Son
|
|||||||
if err != nil && utils.GetJenkinsStatusCode(err) != http.StatusNotFound {
|
if err != nil && utils.GetJenkinsStatusCode(err) != http.StatusNotFound {
|
||||||
glog.Errorf("%+v", err)
|
glog.Errorf("%+v", err)
|
||||||
return nil, restful.NewError(utils.GetJenkinsStatusCode(err), err.Error())
|
return nil, restful.NewError(utils.GetJenkinsStatusCode(err), err.Error())
|
||||||
|
} else if err != nil {
|
||||||
|
glog.Error("%+v", err)
|
||||||
|
return nil, nil
|
||||||
}
|
}
|
||||||
sonarStatus, err = getBuildSonarResults(build)
|
sonarStatus, err = getBuildSonarResults(build)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -369,7 +369,6 @@ func createOrUpdateRouterWorkload(namespace string, publishService bool, service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if deployment.Spec.Template.Annotations == nil {
|
if deployment.Spec.Template.Annotations == nil {
|
||||||
deployment.Spec.Template.Annotations = make(map[string]string, 0)
|
deployment.Spec.Template.Annotations = make(map[string]string, 0)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user