Workaround: Aggregate downstream test results

后端 未结 3 1107
南笙
南笙 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:37

    Two additions to malenkiy_scot's post:

    1. You don't actually need a script for step 3 in the description: The "copy artifacts from another project" build step allows specifying the source job including parameters already.

      For example, using the parent's notation, it can copy artifacts from the correct execution of job D by using D/PARENT_ID=EXPECTED_VALUE as the "project name".

    2. Instead of manually concatenating $JOB_NAME and $BUILD_ID you can use the predefined $BUILD_TAG (which does essentially the same). See https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables for the full list of standard environment variables.

    0 讨论(0)
  • 2021-02-06 06:46

    Jenkins Plugin https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin should help in such requirements.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题