控制台日志未通过Jenkins API返回任何结果:
curl -I http://$USER:$APITOKEN@$HOST:8080/job/Test1/121/consoleText -H "$CRUMB"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 657 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 200 OK
Date: Fri, 05 Jan 2018 08:38:35 GMT
X-Content-Type-Options: nosniff
Content-Type: text/plain;charset=utf-8
Content-Length: 657
Server: Jetty(9.4.z-SNAPSHOT)
但是,通过Chrome浏览器的控制台日志包含所有构建详细信息:
控制台是:
http://localhost:8080/job/Test1/121/api/json?pretty=true
响应回复如下:
{
"_class" : "hudson.model.FreeStyleBuild",
"actions" : [
{
"_class" : "hudson.model.CauseAction",
"causes" : [
{
"_class" : "hudson.model.Cause$RemoteCause",
"shortDescription" : "Started by remote host 0:0:0:0:0:0:0:1",
"addr" : "0:0:0:0:0:0:0:1",
"note" : null
}
]
},
{
},
{
}
],
"artifacts" : [
],
"building" : false,
"description" : null,
"displayName" : "#120",
"duration" : 1092,
"estimatedDuration" : 1070,
"executor" : null,
"fullDisplayName" : "Test1 #120",
"id" : "120",
"keepLog" : false,
"number" : 120,
"queueId" : 120,
"result" : "SUCCESS",
"timestamp" : 1515135051624,
"url" : "http://localhost:8080/job/Test1/120/",
"builtOn" : "",
"changeSet" : {
"_class" : "hudson.scm.EmptyChangeLogSet",
"items" : [
],
"kind" : null
},
"culprits" : [
]
}
有没有人遇到过这个问题?有一个团队想要监控构建状态,我觉得这将是分享所有细节的理想选择。
答案 0 :(得分:0)
我找不到暴露consoleText的REST API。因此,我参考了jenkins API文档,并将生成的日志sftp-splunk日志监视器。
通用路径是:$JENKINS_HOME/jobs/$JOB_NAME/$BUILD_NUMBER/log
现在,我使用Splunk仪表板查看构建日志状态。并且splunk有更好的rest-api支持,因为我们需要采取纠正措施。