Tie custom channels into channel-contents.tt.
We should now get an overview and help text on how to add a particular channel and also a bit of information about the builds that are required for a channel to get upgraded. Right now we only select the latest successful build in the latest successful evaluation, so if someone wants to have more information about which channel has failed, (s)he still has to look at the "Channels" tab of the jobset. We can make this more fancy at some later point if this is really needed, because right now we're only interested in the latest build, because it's the only thing necessary to deliver the channel contents. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
parent
f1dd08afc8
commit
db0ef9e49b
|
@ -130,6 +130,7 @@ sub channel_contents : Chained('nix') PathPart('') Args(0) {
|
|||
# garbage-collected. That should be true for the "latest"
|
||||
# channel.
|
||||
getChannelData($c, 0);
|
||||
$c->stash->{genericChannel} = 1;
|
||||
$c->stash->{template} = 'channel-contents.tt';
|
||||
$c->stash->{nixPkgs} = [sortPkgs @{$c->stash->{nixPkgs}}];
|
||||
}
|
||||
|
|
57
src/lib/Hydra/Controller/Channel.pm
Normal file
57
src/lib/Hydra/Controller/Channel.pm
Normal file
|
@ -0,0 +1,57 @@
|
|||
package Hydra::Controller::Channel;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base 'Hydra::Base::Controller::REST';
|
||||
|
||||
|
||||
sub channel : Chained('/') PathPart('channel/custom') CaptureArgs(3) {
|
||||
my ($self, $c, $projectName, $jobsetName, $channelName) = @_;
|
||||
|
||||
$c->stash->{project} = $c->model('DB::Projects')->find($projectName);
|
||||
|
||||
notFound($c, "Project $projectName doesn't exist.")
|
||||
if !$c->stash->{project};
|
||||
|
||||
$c->stash->{jobset} = $c->stash->{project}->jobsets->find({
|
||||
name => $jobsetName
|
||||
});
|
||||
|
||||
notFound($c, "Jobset $jobsetName doesn't exist.")
|
||||
if !$c->stash->{jobset};
|
||||
|
||||
my $lastSuccessful = $c->model('DB::Builds')->find(
|
||||
{ 'eval.hasnewbuilds' => 1
|
||||
, project => $projectName
|
||||
, jobset => $jobsetName
|
||||
, job => $channelName
|
||||
, buildstatus => 0
|
||||
},
|
||||
{ rows => 1, order_by => "eval.id desc"
|
||||
, join => { jobsetevalmembers => 'eval' }
|
||||
}
|
||||
);
|
||||
|
||||
notFound($c, "Channel $channelName either doesn't exist ".
|
||||
"or was never built successfully.")
|
||||
if !$lastSuccessful;
|
||||
|
||||
$c->stash->{lastSuccessful} = $lastSuccessful;
|
||||
}
|
||||
|
||||
|
||||
sub overview : Chained('channel') PathPart('') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
$c->stash->{constituents} = [
|
||||
$c->stash->{lastSuccessful}->constituents_->search(
|
||||
{}, {order_by => ["job"]}
|
||||
)
|
||||
];
|
||||
|
||||
$c->stash->{genericChannel} = 0;
|
||||
$c->stash->{template} = 'channel-contents.tt';
|
||||
}
|
||||
|
||||
|
||||
1;
|
|
@ -27,6 +27,7 @@ $ nix-env -u '*'</pre>
|
|||
<tt>nix-install-package</tt> program in your web browser, you can
|
||||
install the package simply by clicking on the packages below.</p>
|
||||
|
||||
[% IF genericChannel %]
|
||||
|
||||
<h2>Packages</h2>
|
||||
|
||||
|
@ -69,5 +70,17 @@ install the package simply by clicking on the packages below.</p>
|
|||
|
||||
</table>
|
||||
|
||||
[% ELSE %]
|
||||
[% PROCESS "product-list.tt" %]
|
||||
|
||||
<h2>Contents</h2>
|
||||
|
||||
[% INCLUDE renderProductList build=lastSuccessful %]
|
||||
|
||||
<p>Upgrades depend on the success/failure of the following constituents:</p>
|
||||
|
||||
[% INCLUDE renderBuildList builds=constituents %]
|
||||
|
||||
[% END %]
|
||||
|
||||
[% END %]
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<tbody>
|
||||
[% FOREACH chan IN channels-%]
|
||||
<tr>
|
||||
<th><span>[% INCLUDE renderJobName project=project.name jobset=jobset.name job=chan %]</span></th>
|
||||
<th><span><a href="[% c.uri_for('/channel/custom' project.name jobset.name chan) %]">[% chan %]</a></span></th>
|
||||
[% FOREACH eval IN evalIds %]
|
||||
<td>[% r = evals.$eval.builds.$chan; IF r.id %]<a href="[% c.uri_for('/build' r.id) %]">[% INCLUDE renderBuildStatusIcon size=16 build=r %]</a>[% END %]</td>
|
||||
[% END %]
|
||||
|
|
Loading…
Reference in a new issue