1. <legend id='DpcBZ'><style id='DpcBZ'><dir id='DpcBZ'><q id='DpcBZ'></q></dir></style></legend>
        <i id='DpcBZ'><tr id='DpcBZ'><dt id='DpcBZ'><q id='DpcBZ'><span id='DpcBZ'><b id='DpcBZ'><form id='DpcBZ'><ins id='DpcBZ'></ins><ul id='DpcBZ'></ul><sub id='DpcBZ'></sub></form><legend id='DpcBZ'></legend><bdo id='DpcBZ'><pre id='DpcBZ'><center id='DpcBZ'></center></pre></bdo></b><th id='DpcBZ'></th></span></q></dt></tr></i><div id='DpcBZ'><tfoot id='DpcBZ'></tfoot><dl id='DpcBZ'><fieldset id='DpcBZ'></fieldset></dl></div>

        <small id='DpcBZ'></small><noframes id='DpcBZ'>

          <bdo id='DpcBZ'></bdo><ul id='DpcBZ'></ul>
      2. <tfoot id='DpcBZ'></tfoot>

        Jenkins REST API 获取作业和作业控制台日志

        时间:2023-11-10
      3. <small id='V1cOP'></small><noframes id='V1cOP'>

              <i id='V1cOP'><tr id='V1cOP'><dt id='V1cOP'><q id='V1cOP'><span id='V1cOP'><b id='V1cOP'><form id='V1cOP'><ins id='V1cOP'></ins><ul id='V1cOP'></ul><sub id='V1cOP'></sub></form><legend id='V1cOP'></legend><bdo id='V1cOP'><pre id='V1cOP'><center id='V1cOP'></center></pre></bdo></b><th id='V1cOP'></th></span></q></dt></tr></i><div id='V1cOP'><tfoot id='V1cOP'></tfoot><dl id='V1cOP'><fieldset id='V1cOP'></fieldset></dl></div>
                <tbody id='V1cOP'></tbody>
              <tfoot id='V1cOP'></tfoot>

                <bdo id='V1cOP'></bdo><ul id='V1cOP'></ul>

                <legend id='V1cOP'><style id='V1cOP'><dir id='V1cOP'><q id='V1cOP'></q></dir></style></legend>

                  本文介绍了Jenkins REST API 获取作业和作业控制台日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何使用 Jenkins REST API 获取作业的详细信息及其控制台输出

                  构建示例

                  控制台输出:

                  我正在使用以下命令来获取控制台日志的路径

                  回显 $JENKINS_HOME/jobs/$JOB_NAME/builds/${BUILD_NUMBER}/log

                  回显 $BUILD_URL/consoleText

                  它将提供控制台日志的路径

                  解决方案

                  所以对于使用 consoleFull,我使用 curl 得到了非常 dirty 的输出代码>

                  示例:

                  curl -s -S -u "user":"password" "http://jenkins.domain.com/job/my_job_name/1077/consoleFull"

                  输出:许多行都用 html 东西包裹:

                   <span class="timestamp"><b>09:04:32</b></span><span style="color:#00CD00;">ok:</span>

                  所以我的解决方案是使用:

                  curl -s -S -u "user":"password" "http://jenkins.domain.com/job/my_job_name/1077/logText/progressiveText?start=0"

                  您将获得相同的控制台日志输出,而无需 html、span 内容

                  How to get the details of the job along with it console output using Jenkins REST API

                  example of builds

                  console output:

                  I am using following commands to get the path of console log

                  echo $JENKINS_HOME/jobs/$JOB_NAME/builds/${BUILD_NUMBER}/log

                  echo $BUILD_URL/consoleText

                  It would provide the path to console log

                  http://localhost:8080/job/Echo/25//consoleText

                  but if i try to get the data from it using c#.net it would through me a exception

                  I am using following code to get the data

                   public string Download_Contents(string URI)
                      {
                          string Data = string.Empty;
                          try
                          {
                              using (var wc = new System.Net.WebClient())
                                  Data = wc.DownloadString(URI);
                          }
                          catch (Exception ex)
                          {
                              throw ex;
                          }
                          return Data;
                      }
                  

                  Exception:

                  解决方案

                  So for using the consoleFull i'm getting very dirty output using curl

                  example:

                  curl -s -S  -u "user":"password" "http://jenkins.domain.com/job/my_job_name/1077/consoleFull"
                  

                  output: many lines wrapped with html stuff:

                   <span class="timestamp"><b>09:04:32</b> </span><span style="color: #00CD00;">ok:</span>
                  

                  so my solution is to use:

                  curl -s -S  -u "user":"password" "http://jenkins.domain.com/job/my_job_name/1077/logText/progressiveText?start=0"
                  

                  and you will get the same console log output without the html,span stuff

                  这篇关于Jenkins REST API 获取作业和作业控制台日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  <small id='L0R3h'></small><noframes id='L0R3h'>

                  <tfoot id='L0R3h'></tfoot>

                    <bdo id='L0R3h'></bdo><ul id='L0R3h'></ul>
                        <legend id='L0R3h'><style id='L0R3h'><dir id='L0R3h'><q id='L0R3h'></q></dir></style></legend>

                            <tbody id='L0R3h'></tbody>

                          <i id='L0R3h'><tr id='L0R3h'><dt id='L0R3h'><q id='L0R3h'><span id='L0R3h'><b id='L0R3h'><form id='L0R3h'><ins id='L0R3h'></ins><ul id='L0R3h'></ul><sub id='L0R3h'></sub></form><legend id='L0R3h'></legend><bdo id='L0R3h'><pre id='L0R3h'><center id='L0R3h'></center></pre></bdo></b><th id='L0R3h'></th></span></q></dt></tr></i><div id='L0R3h'><tfoot id='L0R3h'></tfoot><dl id='L0R3h'><fieldset id='L0R3h'></fieldset></dl></div>