提交 fdc708ea 编写于 作者: LinuxSuRen's avatar LinuxSuRen

Fix job history cannot print the real detail

上级 3323b671
......@@ -344,6 +344,35 @@ func (q *JobClient) GetHistory(name string) (builds []JobBuild, err error) {
var job *Job
if job, err = q.GetJob(name); err == nil {
builds = job.Builds
for i, build := range builds {
api := fmt.Sprintf("%sapi/json", build.URL)
var (
req *http.Request
response *http.Response
)
req, err = http.NewRequest("GET", api, nil)
if err == nil {
q.AuthHandle(req)
} else {
return
}
client := q.GetClient()
if response, err = client.Do(req); err == nil {
code := response.StatusCode
var data []byte
data, err = ioutil.ReadAll(response.Body)
if code == 200 {
err = json.Unmarshal(data, &build)
builds[i] = build
} else {
log.Fatal(string(data))
}
} else {
log.Fatal(err)
}
}
}
return
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册