PPJN6SDP3BIWOB5LB3B2F3HEWM4IG7WZMG7JICERVBR7CDMBOPOQC
A63IHCMXH3F4V56HDXJLJVVHKXRSJCJMT2PWXXI2IW3J734J6SGQC
T2232OBSNVDGHY46RY5BBB2IET5LV5OLKSSBDYUF7KAEDBUOTC7QC
G6HJY2V4CSSZF6BPIMRMRAJYRKPLTCBUFTJWZWK3BSNT235CZQ6QC
DR4F6YUTVOY2PEWA3OLS5TVQ5L5GWVFAK3EJDNKWIEVB5NTB52QAC
J5UVLXOK6EDIL5I7VKWH4V2QDS4DPD7FHRK6XBWSXFRQS4JKXFZQC
FHF6IZJQPUQHY5QWQYRPZVDBRLHREWRHGNKVQDT7F3GQKKLZXJKQC
IN272KZWHENW2TCR3LWQ6OZAEESJL5S7AEL3GYLJTWHJUDE6HADAC
JFZNAYJXKCMXYHGCLTRH7Q6TOFGJ4BT6332GONCWVYRLNMDDG3KAC
2T42QGZDK23C5V4ZHO4R7EBJESIQ62GKWDBWVX7OBEE3YVBUNUFAC
2GK5DOU7ODF4WBSN3QTD3WIO52VTL2LOAXKGCDEMMAQPTEO4A4HAC
E6IC7YIKCWI3LIG3DK7VTACIKCMMQWCOYROXXZL5FYHUWJ7CPN4AC
S5PV6IIMKJ7PGWIFLLXERHYF3BCP2UEGFRZEZLD6UUBLVEZXJLUAC
3E6IP3R3JGH76PNGG7RCADV65KOV24HQXPXNLVVYIQ46AVYJRG3AC
ZNFDFJHGXHSUP3NT5BZSGZPUFYMXCNTJRLSVD6PYF3N6O6ONAWRAC
push @releases, getRelease($_, $jobs) foreach getPrimaryBuildsForReleaseSet($project, $primaryJob);
push @releases, getRelease($_, $jobs) foreach getPrimaryBuildsForReleaseSet($project, $primaryJob, $page, $resultsPerPage);
$c->stash->{baseUri} = $c->uri_for($self->action_for("releases"), $projectName, $releaseSetName);
sub allPrimaryBuilds {
my ($project, $primaryJob) = @_;
my $allPrimaryBuilds = $project->builds->search(
{ jobset => $primaryJob->get_column('jobset'), job => $primaryJob->get_column('job'), finished => 1 },
{ join => 'resultInfo', order_by => "timestamp DESC"
, '+select' => ["resultInfo.releasename", "resultInfo.buildstatus"]
, '+as' => ["releasename", "buildstatus"]
, where => \ attrsToSQL($primaryJob->attrs, "me.id")
});
return $allPrimaryBuilds;
}
my @primaryBuilds = $project->builds->search(
{ jobset => $primaryJob->get_column('jobset'), job => $primaryJob->get_column('job'), finished => 1 },
{ join => 'resultInfo', order_by => "timestamp DESC"
, '+select' => ["resultInfo.releasename", "resultInfo.buildstatus"]
, '+as' => ["releasename", "buildstatus"]
, where => \ attrsToSQL($primaryJob->attrs, "me.id")
return scalar(allPrimaryBuilds($project, $primaryJob)) ;
}
sub getPrimaryBuildsForReleaseSet {
my ($project, $primaryJob, $page, $resultsPerPage) = @_;
$page = (defined $page ? int($page) : 1) || 1;
$resultsPerPage = (defined $resultsPerPage ? int($resultsPerPage) : 20) || 20;
my @primaryBuilds = allPrimaryBuilds($project, $primaryJob)->search( {},
{ rows => $resultsPerPage
, page => $page
# 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')
, job => $job->get_column('job'), finished => 1
}
, { join => 'resultInfo', rows => 1
, order_by => ["buildstatus", "timestamp"]
, where => \ attrsToSQL($job->attrs, "build.id")
, '+select' => ["resultInfo.buildstatus"], '+as' => ["buildstatus"]
});
return $thisBuild ;
}
sub findLastJobForPrimaryBuild {
my ($primaryBuild, $job) = @_;
my $thisBuild;
my $depBuilds;
$depBuilds = $primaryBuild->dependentBuilds;
$thisBuild = findLastJobForBuilds($depBuilds, $job) ;
# don't do recursive yet
# if (!defined $thisBuild) {
#
# foreach my $build ($depBuilds->all) {
# $thisBuild = findLastJobForPrimaryBuild($build, $job) ;
# if (defined $thisBuild) {
# last ;
# }
# }
# }
return $thisBuild;
}
# 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) = $primaryBuild->dependentBuilds->search(
{ project => $job->get_column('project'), jobset => $job->get_column('jobset')
, job => $job->get_column('job'), finished => 1 },
{ join => 'resultInfo', rows => 1
, order_by => ["buildstatus", "timestamp"]
, where => \ attrsToSQL($job->attrs, "build.id")
, '+select' => ["resultInfo.buildstatus"], '+as' => ["buildstatus"]
});
$thisBuild = findLastJobForPrimaryBuild($primaryBuild, $job) ;