User interface 按描述筛选Hudson构建结果

User interface 按描述筛选Hudson构建结果,user-interface,reporting,hudson,filtering,User Interface,Reporting,Hudson,Filtering,我需要根据Hudson中的构建描述过滤作业的构建结果。我找到了一个允许根据工作描述进行过滤的插件,但是我不确定如何开始对构建进行过滤。使用Hudsons XML API和XPATH http://<your hudson url>/api/xml?depth=1&xpath=//job/description[contains(./text(),'<search string>')]&wrapper=jobs http:///api/xml?depth=

我需要根据Hudson中的构建描述过滤作业的构建结果。我找到了一个允许根据工作描述进行过滤的插件,但是我不确定如何开始对构建进行过滤。

使用Hudsons XML API和XPATH

http://<your hudson url>/api/xml?depth=1&xpath=//job/description[contains(./text(),'<search string>')]&wrapper=jobs
http:///api/xml?depth=1&xpath=//job/description[包含(./text(),'')&包装器=作业
将显示包含给定搜索字符串的所有作业的说明

使用更多的xpath魔法,您可能还可以让它显示最新构建的结果(路径为job/lastBuild/result,可能需要将深度增加到2)

http:///api
以供进一步参考

编辑:

http:///api/xml?depth=2&xpath=child::hudson/job[包含(显示名称“”)]/*[self::name或self::lastBuild]&包装器=作业
几乎适用于我,它显示了名称和上次构建,但不幸的是在这样的结构中

<jobs>
    <name>job1</name>
    <lastBuild>
        <!-- snip a lot -->
        <result>SUCCESS</result>
        <!-- snip a lot -->
    </lastBuild>
    <name>job2</name>
    <lastBuild>
        <!-- snip a lot -->
        <result>SUCCESS</result>
        <!-- snip a lot -->
    </lastBuild>
</jobs>

工作1
成功
工作2
成功
而我更喜欢这样:

<jobs>
    <job>
        <name>job1</name>
        <lastBuild>
            <!-- snip a lot -->
            <result>SUCCESS</result>
            <!-- snip a lot -->
        </lastBuild>
    </job>
    <job>
        <name>job2</name>
        <lastBuild>
            <!-- snip a lot -->
            <result>SUCCESS</result>
            <!-- snip a lot -->
        </lastBuild>
    </job>
</jobs>

工作1
成功
工作2
成功
有人能提供必要的xpath微调吗


再次编辑

现在我意识到您想要阅读有关构建的信息,而不是作业,因此请使用以下代码:

http://<your hudson url>/job/<your job name>/api/xml?depth=1&xpath=//build[contains(action/cause/shortDescription,'<search string>')]/*[self::result or self::number]&wrapper=builds
http:///job//api/xml?depth=1&xpath=//build[contains(action/cause/shortDescription,”)]/*[self::result或self::number]&wrapper=builds
http://<your hudson url>/job/<your job name>/api/xml?depth=1&xpath=//build[contains(action/cause/shortDescription,'<search string>')]/*[self::result or self::number]&wrapper=builds