Aggregate multiple upstream SCM changes in downstream job
Asked Answered
D

1

11

On my current project, I have several dozen "sub-projects", each with trunk and branches (legacy setup, can't change it)

There are multiple commits on a branch, let's say 5, and then a branch is reintegrated to trunk. When a branch is reintegrated to trunk, it triggers trunk build as a downstream job.

I need this downstream trunk build to show all upstream SCM changes since last reintegration

I've used Display Upstream Changes plugin, however that only displays the last upstream commit in corresponding trunk build.

I've also used All Changes plugin. It does allow me to see "aggregate" list of upstream commits (either by date, promotion or number), but I cannot post these to downstream job.

Note: using SVN for SCM

Alternatively

Alternatively, if there is a way to include "merged revisions" in the SCM changelist, that would solve my issue as well

Detriment answered 30/7, 2018 at 20:53 Comment(1)
Hi @slav, would appreciate if you could accept my answer.Bitters
B
5

Jenkins naturally shows changes on a job.

A downstream job is linked only in a workflow sense. Do Job B after Job A. Linking two jobs in this way does not extend to showing changes.

Option 1

MultiJob Plugin

Option 2

You could get the list of changes in job A using groovy like this and pass it to Job B as a parameter to do something with. (Like print out to an HTML file and publish to the dashboard of Job B with the HTMLPublisher plugin).

Bitters answered 6/8, 2018 at 1:20 Comment(2)
I've looked at both of your suggestions. The problem is I need Job A's changes from build-<last-integrated-build> to build-<latest-build>. That Option 2 example only does it for 1 build (not a range). Unfortunately I cannot wrap my head around groovy (and/or what methods it exposes in jenkins and in what data structure formats), so I cannot extrapolate from that to reach what I need.Detriment
From a shared library you can execute custom code and if you import relevant Jenkins Object Model classes into your library you can loop through the range of builds you are interested in and collect this information and return it to your Pipeline from there you do what you want with the information.Bitters

© 2022 - 2024 — McMap. All rights reserved.