primary job, but is in the same jobset.
KPZNJ33UUF6TK5OPB6K5KLM3ZEK7YV3IF32HTLJFURCO6ICDMGYAC
RFE6T5LGBFFNEPHZOPF4UNMFC2L4CGD5TPAMOXDLRPH3TZJ43UBAC
ID5DHUFUROHFV4UHHMCLH3S4BWDSK7JRYIAZ2QF37LJERXIDQKMQC
P5X4P6VKS5CJOOLJRVL66GRJLDLVC3EKAVAHP2RJOXQJ7WTYAUBQC
PPJN6SDP3BIWOB5LB3B2F3HEWM4IG7WZMG7JICERVBR7CDMBOPOQC
2GK5DOU7ODF4WBSN3QTD3WIO52VTL2LOAXKGCDEMMAQPTEO4A4HAC
IN272KZWHENW2TCR3LWQ6OZAEESJL5S7AEL3GYLJTWHJUDE6HADAC
XBU2ODSPGKXUPOV5CFKOBOJLCIU5BMMZ5YVWFR7CP2G5QQZ5GAJAC
5SHCWE7XPQORSOLY7HGAIK2ODKBFPY4KVXRL2W7X6D4WALU544HQC
my $project = $job->get_column('project');
my $jobset = $job->get_column('jobset');
# If the job is in the same jobset as the primary build, then
# search for a build of the job among the members of the jobset
# evaluation ($ev) that produced the primary build.
if (defined $ev && $project eq $ev->get_column('project')
&& $jobset eq $ev->get_column('jobset'))
{
$thisBuild = $ev->builds->find(
{ job => $job->get_column('job'), finished => 1 },
{ join => 'resultInfo', rows => 1
, order_by => ["id"]
, where => \ attrsToSQL($job->attrs, "build.id")
, '+select' => ["resultInfo.buildstatus"], '+as' => ["buildstatus"]
});
}
# Find a build of this job that had the primary build
# as input. If there are multiple, prefer successful
# ones, and then oldest. !!! order_by buildstatus is hacky
($thisBuild) = $builds->search(
{ project => $job->get_column('project'), jobset => $job->get_column('jobset')
# As backwards compatibility, find a build of this job that had
# the primary build as input. If there are multiple, prefer
# successful ones, and then oldest. !!! order_by buildstatus is
# hacky
$thisBuild = $depBuilds->find(
{ project => $project, jobset => $jobset
# Get the jobset evaluation of which the primary build is a
# member. If there are multiple, pick the oldest one (i.e. the
# lowest id). (Note that for old builds in the database there
# might not be a evaluation record, so $ev may be undefined.)
my $ev = $primaryBuild->jobsetevalmembers->find({}, { rows => 1, order_by => "eval" });
$ev = $ev->eval if defined $ev;