Views are deprecated.
2RFR6NLVJSRWTJGMBOONQLFBTDG535GT7RINFBYJ75GSFV4WJZTAC
I3X25POIIRIY47QTN2PA3WMDVROM6TLFJAV3Q5W6AU526TFPNHKAC
ONAQU4BRGYO6MGPGIQIK5KF4JE4TBJMFFBU5XBKFTYQ5RPW7FOYQC
IN272KZWHENW2TCR3LWQ6OZAEESJL5S7AEL3GYLJTWHJUDE6HADAC
WZ3AEJ67LOG5L335AAC2BDLIJPIU4VSCGBMATBHDZC26ECRS5A6AC
HLYVEJX74DMSDR7VTGSLZCLUKQDZFDIK4FFDV4S27UPBN5JH4KDQC
KJQWSRCCQEKF64L4NYYZ7VKAF2YEPYXXTRW6BI464P6Q6KU34TQAC
PMNWRTGJ4GVSMSSAWSUD57B26PCRAHMZIQ5SIWJIK7A74ENKEQLAC
4X6NS66QDWR4S4ZZFKN2QOJQII5ZYIMTDYRHK25N6NJSROVLHJ6QC
XBU2ODSPGKXUPOV5CFKOBOJLCIU5BMMZ5YVWFR7CP2G5QQZ5GAJAC
NEWDDAOFCDLYBXQCZNQ2GDH7HPAHVN3YRDL52ZYEMVA4YH6LBDXAC
ZCTGG25SELGUTOYLG72N2I2OF7YQ6B7CIBPCP5ANMDDD4FIQ3YPQC
}
# Go over all views in this project.
foreach my $view ($project->views->all) {
print STDERR "*** looking for builds to keep in view ", $project->name, ":", $view->name, "\n";
(my $primaryJob) = $view->viewjobs->search({isprimary => 1});
my $jobs = [$view->viewjobs->all];
# Keep all builds belonging to the most recent successful view result.
my $latest = getLatestSuccessfulViewResult($project, $primaryJob, $jobs, 0);
if (defined $latest) {
print STDERR " keeping latest successful view result ", $latest->id, " (", $latest->get_column('releasename') // "unnamed", ")\n";
my $result = getViewResult($latest, $jobs);
keepBuild $_->{build} foreach @{$result->{jobs}};
}