代码之家  ›  专栏  ›  技术社区  ›  LOrD_ARaGOrN

如何从Jenkins的Global Builds Stats插件中通过脚本提取信息

  •  1
  • LOrD_ARaGOrN  · 技术社区  · 7 年前

    我有一个要求,每周发送邮件与有关的工作,在詹金斯运行的细节。我已经设法安装插件,可以看到图形以及。

    enter image description here

    使用下面的命令我可以直接在浏览器中看到图表。

    <jenkins/hudson_url>/plugin/global-build-stats/showChart?buildStatId=<Chart id>
    

    但是,当我尝试使用下面的curl命令下载图像时,我没有得到它。

    curl -O <jenkins/hudson_url>/plugin/global-build-stats/showChart?buildStatId=<Chart id>
    

    -rw-r--r--. 1 root    root         62 Nov 14 07:04 osw.hb
    -rw-------. 1 root    root        969 Nov 14 07:04 showChart?buildStatId=<chart id>
    

    “showchartfile”的内容如下。

    Authentication required
    <!--
    You are authenticated as: anonymous
    Groups that you are in:
    
    Permission you need to have (but didn't): hudson.model.Hudson.Read
     ... which is implied by: hudson.security.Permission.GenericRead
     ... which is implied by: hudson.model.Hudson.Administer
    -->
    
    </body></html>  
    

    https://wiki.jenkins.io/pages/viewpage.action?pageId=46336030
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   LOrD_ARaGOrN    7 年前

    我发现了问题所在。图表id仅适用于现有用户。这意味着username和passwd需要通过curl命令提供。用过一个以下的。现在开始工作了。

    curl -u Username:Passwd -O <jenkins/hudson_url>/plugin/global-build-stats/showChart?buildStatId=<Chart id>