Workaround: Aggregate downstream test results

后端 未结 3 1108
南笙
南笙 2021-02-06 05:52

As far as I know, the feature \"Aggregate downstream test results\" does not work as expected (and it is very hard to find useful documentation). I\'d like to achieve very simil

3条回答
  •  死守一世寂寞
    2021-02-06 06:53

    Here is an outline for a somewhat simpler scenario, but I think you can easily generalize it to your case of multiple downstream jobs. The trick is to use "marking" parameters in downstream jobs.

    Let P be the parent job and D be a downstream job.

    1. An instance (build) of P invokes D via Parameterized Trigger Plugin via a build step (not as a post-build step) and waits for D's to finish. Along with other parameters, P passes to D a parameter - let's call it PARENT_ID - based on P's build's BUILD_ID.
    2. D executes the tests and archives them as artifacts (along with jUnit reports - if applicable).
    3. P then executes an external Python (or internal Groovy) script that finds the appropriate build of D via PARENT_ID (you iterate over builds of D and examine the value of PARENT_ID parameter). The script then copies the artifacts from D to P and P publishes them.

    If using Python (that's what I do) - utilize Python JenkinsAPI wrapper. If using Groovy - utilize Groovy Plugin and run your script as system script. You then can access Jenkins via its Java API.

提交回复
热议问题