I have such configured jobs(FreestyleBuild type):

1. Job [A]
2. Job [B]
3. Job [Unit Tests]

Job A & Job B  - are identical jobs but pointed to different branches of 
same project. Job [Unit Tests] is parametrized and called from 
parametrerized trigger build step of jobs A & B.

Currently, implementations of 
Run.getPreviousBuild(), Run.getBuildStatusSummary(), 
Run.getTransitiveUpstreamBuilds() 
and others similar methods do not respect builds dependency.
For example  - if last [*Unit Tests*] #3 called from Job [*B*] was *FAILED* and 
previous [*Unit Tests*] #2 called from Job [*A*] was *SUCCESS*, then ([*Unit 
Tests*] #3).getPreviousSuccessfulBuild() returns [*Unit Tests* #2] which is 
really unrelated to current context.

It's logically if Unit Tests build caused by upstream job 
A, getPreviousBuild() will return previuos build caused by job A, not job 
B. Also result trend in builds  summary, should be equals ResultTrend.FIXED 
when build fixed in context of same upstream job.
So, my idea to extract this hierarchy dependent methods into interface 
named something like RelationsResolver. And use some custom implementations 
for dfferent workflow types.

Does this make sence? 

Reply via email to