From 607d5641b65e54d5b9ecc496f663c6c9b82b0bba Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 8 Apr 2009 22:08:00 +0000 Subject: [PATCH] * Added a page to quickly see all failed builds and failed evaluations per project or jobset or job or globally. --- src/lib/Hydra/Base/Controller/ListBuilds.pm | 16 ++++ src/lib/Hydra/Controller/Job.pm | 4 +- src/lib/Hydra/Controller/Jobset.pm | 5 +- src/lib/Hydra/Controller/Project.pm | 2 + src/lib/Hydra/Controller/Root.pm | 2 + src/root/common.tt | 7 ++ src/root/errors.tt | 82 +++++++++++++++++++++ src/root/navbar.tt | 12 +++ 8 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 src/root/errors.tt diff --git a/src/lib/Hydra/Base/Controller/ListBuilds.pm b/src/lib/Hydra/Base/Controller/ListBuilds.pm index 22d46e70..19c2cb6e 100644 --- a/src/lib/Hydra/Base/Controller/ListBuilds.pm +++ b/src/lib/Hydra/Base/Controller/ListBuilds.pm @@ -14,6 +14,22 @@ sub jobstatus : Chained('get_builds') PathPart Args(0) { [joinWithResultInfo($c, $c->stash->{jobStatus})->all]; } + +# A convenient way to see all the errors - i.e. things demanding +# attention - at a glance. +sub errors : Chained('get_builds') PathPart Args(0) { + my ($self, $c) = @_; + $c->stash->{template} = 'errors.tt'; + $c->stash->{brokenJobsets} = + [$c->stash->{allJobsets}->search({errormsg => {'!=' => ''}})] + if defined $c->stash->{allJobsets}; + $c->stash->{brokenJobs} = + [$c->stash->{allJobs}->search({errormsg => {'!=' => ''}})] + if defined $c->stash->{allJobs}; + $c->stash->{brokenBuilds} = + [joinWithResultInfo($c, $c->stash->{jobStatus})->search({buildstatus => {'!=' => 0}})]; +} + sub all : Chained('get_builds') PathPart { my ($self, $c, $page) = @_; diff --git a/src/lib/Hydra/Controller/Job.pm b/src/lib/Hydra/Controller/Job.pm index 20ca09f4..7f2052d7 100644 --- a/src/lib/Hydra/Controller/Job.pm +++ b/src/lib/Hydra/Controller/Job.pm @@ -10,7 +10,8 @@ use Hydra::Helper::CatalystUtils; sub job : Chained('/') PathPart('job') CaptureArgs(3) { my ($self, $c, $projectName, $jobsetName, $jobName) = @_; - $c->stash->{job} = $c->model('DB::Jobs')->find({project => $projectName, jobset => $jobsetName, name => $jobName}) + $c->stash->{job_} = $c->model('DB::Jobs')->search({project => $projectName, jobset => $jobsetName, name => $jobName}); + $c->stash->{job} = $c->stash->{job_}->single or notFound($c, "Job $projectName:$jobsetName:$jobName doesn't exist."); $c->stash->{project} = $c->stash->{job}->project; $c->stash->{jobset} = $c->stash->{job}->jobset; @@ -34,6 +35,7 @@ sub get_builds : Chained('job') PathPart('') CaptureArgs(0) { $c->stash->{allBuilds} = $c->stash->{job}->builds; $c->stash->{jobStatus} = $c->model('DB')->resultset('JobStatusForJob') ->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name, $c->stash->{job}->name]}); + $c->stash->{allJobs} = $c->stash->{job_}; $c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJob') ->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name, $c->stash->{job}->name]}); $c->stash->{channelBaseName} = diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index 99601894..93b2741a 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -15,7 +15,8 @@ sub jobset : Chained('/') PathPart('jobset') CaptureArgs(2) { $c->stash->{project} = $project; - $c->stash->{jobset} = $project->jobsets->find({name => $jobsetName}) + $c->stash->{jobset_} = $project->jobsets->search({name => $jobsetName}); + $c->stash->{jobset} = $c->stash->{jobset_}->single or notFound($c, "Jobset $jobsetName doesn't exist."); } @@ -38,6 +39,8 @@ sub get_builds : Chained('jobset') PathPart('') CaptureArgs(0) { $c->stash->{allBuilds} = $c->stash->{jobset}->builds; $c->stash->{jobStatus} = $c->model('DB')->resultset('JobStatusForJobset') ->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name]}); + $c->stash->{allJobsets} = $c->stash->{jobset_}; + $c->stash->{allJobs} = $c->stash->{jobset}->jobs; $c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForJobset') ->search({}, {bind => [$c->stash->{project}->name, $c->stash->{jobset}->name]}); $c->stash->{channelBaseName} = diff --git a/src/lib/Hydra/Controller/Project.pm b/src/lib/Hydra/Controller/Project.pm index 1c2c0514..22084153 100644 --- a/src/lib/Hydra/Controller/Project.pm +++ b/src/lib/Hydra/Controller/Project.pm @@ -172,6 +172,8 @@ sub get_builds : Chained('project') PathPart('') CaptureArgs(0) { $c->stash->{allBuilds} = $c->stash->{project}->builds; $c->stash->{jobStatus} = $c->model('DB')->resultset('JobStatusForProject') ->search({}, {bind => [$c->stash->{project}->name]}); + $c->stash->{allJobsets} = $c->stash->{project}->jobsets; + $c->stash->{allJobs} = $c->stash->{project}->jobs; $c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceededForProject') ->search({}, {bind => [$c->stash->{project}->name]}); $c->stash->{channelBaseName} = $c->stash->{project}->name; diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index ffdd56b8..75e217a9 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -242,6 +242,8 @@ sub get_builds : Chained('/') PathPart('') CaptureArgs(0) { my ($self, $c) = @_; $c->stash->{allBuilds} = $c->model('DB::Builds'); $c->stash->{jobStatus} = $c->model('DB')->resultset('JobStatus'); + $c->stash->{allJobsets} = $c->model('DB::Jobsets'); + $c->stash->{allJobs} = $c->model('DB::Jobs'); $c->stash->{latestSucceeded} = $c->model('DB')->resultset('LatestSucceeded'); $c->stash->{channelBaseName} = "everything"; } diff --git a/src/root/common.tt b/src/root/common.tt index 9a460d45..58fcad64 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -31,6 +31,13 @@ [% job %][% END -%] +[% BLOCK renderFullJobsetName %] + + [% INCLUDE renderProjectName %]:[% INCLUDE renderJobsetName %] + +[% END %] + + [% BLOCK renderFullJobName %] [% INCLUDE renderProjectName %]:[% INCLUDE renderJobsetName %]:[% INCLUDE renderJobName %] diff --git a/src/root/errors.tt b/src/root/errors.tt new file mode 100644 index 00000000..2dc6e00f --- /dev/null +++ b/src/root/errors.tt @@ -0,0 +1,82 @@ +[% WRAPPER layout.tt title="Errors" %] +[% PROCESS common.tt %] + +

Errors

+ +

This page provides a quick way to see how FUBARed your packages +are. It shows job expressions that don’t evaluate properly and jobs +that don’t build.

+ + +[% haveErrors = 0 %] + + +[% IF brokenJobsets && brokenJobsets.size > 0; haveErrors = 1 %] + +

Evaluation errors in jobsets

+ + + + + + + + + + [% FOREACH j IN brokenJobsets %] + + + + + [% END %] + +
NameError
[% INCLUDE renderFullJobsetName project=j.project.name jobset=j.name %] +
[% HTML.escape(j.errormsg) %]
+
+ +[% END %] + + +[% IF brokenJobs && brokenJobs.size > 0; haveErrors = 1 %] + +

Evaluation errors in jobs

+ + + + + + + + + + [% FOREACH j IN brokenJobs %] + + + + + [% END %] + +
NameError
[% INCLUDE renderFullJobName project=j.project.name jobset=j.jobset.name job=j.name %] +
[% HTML.escape(j.errormsg) %]
+
+ +[% END %] + + +[% IF brokenBuilds && brokenBuilds.size > 0; haveErrors = 1 %] + +

Broken builds

+ +[% INCLUDE renderBuildList builds=brokenBuilds %] + +[% END %] + + +[% IF !haveErrors %] + +

There are currently no problems.

+ +[% END %] + + +[% END %] diff --git a/src/root/navbar.tt b/src/root/navbar.tt index c306de3a..f1e343bb 100644 --- a/src/root/navbar.tt +++ b/src/root/navbar.tt @@ -37,6 +37,9 @@ [% INCLUDE makeLink uri = c.uri_for(c.controller('Root').action_for('jobstatus')) title = "Job status" %] + [% INCLUDE makeLink + uri = c.uri_for(c.controller('Root').action_for('errors')) + title = "Errors" %] [% END %] @@ -51,6 +54,9 @@ [% INCLUDE makeLink uri = c.uri_for(c.controller('Project').action_for('jobstatus'), [project.name]) title = "Job status" %] + [% INCLUDE makeLink + uri = c.uri_for(c.controller('Project').action_for('errors'), [project.name]) + title = "Errors" %] [% END %] [% END %] @@ -66,6 +72,9 @@ [% INCLUDE makeLink uri = c.uri_for(c.controller('Jobset').action_for('jobstatus'), [project.name, jobset.name]) title = "Job status" %] + [% INCLUDE makeLink + uri = c.uri_for(c.controller('Jobset').action_for('errors'), [project.name, jobset.name]) + title = "Errors" %] [% END %] [% END %] @@ -81,6 +90,9 @@ [% INCLUDE makeLink uri = c.uri_for(c.controller('Job').action_for('jobstatus'), [project.name, jobset.name, job.name]) title = "Job status" %] + [% INCLUDE makeLink + uri = c.uri_for(c.controller('Job').action_for('errors'), [project.name, jobset.name, job.name]) + title = "Errors" %] [% END %] [% END %]