Remove trailing whitespace
This commit is contained in:
@ -9,7 +9,7 @@ use Hydra::Helper::CatalystUtils;
|
||||
|
||||
sub getJobStatus {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
|
||||
my $maintainer = $c->request->params->{"maintainer"};
|
||||
|
||||
my $latest = $c->stash->{jobStatus}->search(
|
||||
@ -30,7 +30,7 @@ sub jobstatus : Chained('get_builds') PathPart Args(0) {
|
||||
|
||||
|
||||
# A convenient way to see all the errors - i.e. things demanding
|
||||
# attention - at a glance.
|
||||
# attention - at a glance.
|
||||
sub errors : Chained('get_builds') PathPart Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{template} = 'errors.tt';
|
||||
@ -44,7 +44,7 @@ sub errors : Chained('get_builds') PathPart Args(0) {
|
||||
[getJobStatus($self, $c)->search({buildStatus => {'!=' => 0}})];
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub all : Chained('get_builds') PathPart {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
@ -96,7 +96,7 @@ sub latest : Chained('get_builds') PathPart('latest') {
|
||||
{finished => 1, buildstatus => 0}, {order_by => ["isCurrent DESC", "timestamp DESC"]});
|
||||
|
||||
notFound($c, "There is no successful build to redirect to.") unless defined $latest;
|
||||
|
||||
|
||||
$c->res->redirect($c->uri_for($c->controller('Build')->action_for("view_build"), [$latest->id], @rest));
|
||||
}
|
||||
|
||||
@ -106,12 +106,12 @@ sub latest_for : Chained('get_builds') PathPart('latest-for') {
|
||||
my ($self, $c, $system, @rest) = @_;
|
||||
|
||||
notFound($c, "You need to specify a platform type in the URL.") unless defined $system;
|
||||
|
||||
|
||||
my ($latest) = $c->stash->{allBuilds}->search(
|
||||
{finished => 1, buildstatus => 0, system => $system}, {order_by => ["isCurrent DESC", "timestamp DESC"]});
|
||||
|
||||
notFound($c, "There is no successful build for platform `$system' to redirect to.") unless defined $latest;
|
||||
|
||||
|
||||
$c->res->redirect($c->uri_for($c->controller('Build')->action_for("view_build"), [$latest->id], @rest));
|
||||
}
|
||||
|
||||
|
@ -27,22 +27,22 @@ sub projectToHash {
|
||||
return {
|
||||
name => $project->name,
|
||||
description => $project->description
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
sub projects : Chained('api') PathPart('projects') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
|
||||
my @projects = $c->model('DB::Projects')->search({hidden => 0}, {order_by => 'name'});
|
||||
|
||||
my @list;
|
||||
foreach my $p (@projects) {
|
||||
push @list, projectToHash($p);
|
||||
}
|
||||
|
||||
$c->stash->{'plain'} = {
|
||||
data => scalar (JSON::Any->objToJson(\@list))
|
||||
|
||||
$c->stash->{'plain'} = {
|
||||
data => scalar (JSON::Any->objToJson(\@list))
|
||||
};
|
||||
$c->forward('Hydra::View::Plain');
|
||||
}
|
||||
@ -61,13 +61,13 @@ sub buildToHash {
|
||||
timestamp => $build->timestamp
|
||||
};
|
||||
|
||||
if($build->finished) {
|
||||
if($build->finished) {
|
||||
$result->{'buildstatus'} = $build->get_column("buildstatus");
|
||||
} else {
|
||||
$result->{'busy'} = $build->get_column("busy");
|
||||
$result->{'priority'} = $build->get_column("priority");
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
};
|
||||
|
||||
@ -81,20 +81,20 @@ sub latestbuilds : Chained('api') PathPart('latestbuilds') Args(0) {
|
||||
my $jobset = $c->request->params->{jobset};
|
||||
my $job = $c->request->params->{job};
|
||||
my $system = $c->request->params->{system};
|
||||
|
||||
|
||||
my $filter = {finished => 1};
|
||||
$filter->{project} = $project if ! $project eq "";
|
||||
$filter->{jobset} = $jobset if ! $jobset eq "";
|
||||
$filter->{job} = $job if !$job eq "";
|
||||
$filter->{system} = $system if !$system eq "";
|
||||
|
||||
$filter->{project} = $project if ! $project eq "";
|
||||
$filter->{jobset} = $jobset if ! $jobset eq "";
|
||||
$filter->{job} = $job if !$job eq "";
|
||||
$filter->{system} = $system if !$system eq "";
|
||||
|
||||
my @latest = $c->model('DB::Builds')->search($filter, {rows => $nr, order_by => ["timestamp DESC"] });
|
||||
|
||||
|
||||
my @list;
|
||||
push @list, buildToHash($_) foreach @latest;
|
||||
|
||||
$c->stash->{'plain'} = {
|
||||
data => scalar (JSON::Any->objToJson(\@list))
|
||||
|
||||
$c->stash->{'plain'} = {
|
||||
data => scalar (JSON::Any->objToJson(\@list))
|
||||
};
|
||||
$c->forward('Hydra::View::Plain');
|
||||
}
|
||||
@ -110,7 +110,7 @@ sub jobsetToHash {
|
||||
nrfailed => $jobset->get_column("nrfailed"),
|
||||
nrtotal => $jobset->get_column("nrtotal")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub jobsets : Chained('api') PathPart('jobsets') Args(0) {
|
||||
@ -123,12 +123,12 @@ sub jobsets : Chained('api') PathPart('jobsets') Args(0) {
|
||||
or notFound($c, "Project $projectName doesn't exist.");
|
||||
|
||||
my @jobsets = jobsetOverview($c, $project);
|
||||
|
||||
|
||||
my @list;
|
||||
push @list, jobsetToHash($_) foreach @jobsets;
|
||||
|
||||
$c->stash->{'plain'} = {
|
||||
data => scalar (JSON::Any->objToJson(\@list))
|
||||
|
||||
$c->stash->{'plain'} = {
|
||||
data => scalar (JSON::Any->objToJson(\@list))
|
||||
};
|
||||
$c->forward('Hydra::View::Plain');
|
||||
}
|
||||
@ -141,12 +141,12 @@ sub queue : Chained('api') PathPart('queue') Args(0) {
|
||||
error($c, "Parameter not defined!") if !defined $nr;
|
||||
|
||||
my @builds = $c->model('DB::Builds')->search({finished => 0}, {rows => $nr, order_by => ["busy DESC", "priority DESC", "timestamp"]});
|
||||
|
||||
|
||||
my @list;
|
||||
push @list, buildToHash($_) foreach @builds;
|
||||
|
||||
$c->stash->{'plain'} = {
|
||||
data => scalar (JSON::Any->objToJson(\@list))
|
||||
$c->stash->{'plain'} = {
|
||||
data => scalar (JSON::Any->objToJson(\@list))
|
||||
};
|
||||
$c->forward('Hydra::View::Plain');
|
||||
}
|
||||
@ -155,7 +155,7 @@ sub queue : Chained('api') PathPart('queue') Args(0) {
|
||||
sub nrqueue : Chained('api') PathPart('nrqueue') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
my $nrQueuedBuilds = $c->model('DB::Builds')->search({finished => 0})->count();
|
||||
$c->stash->{'plain'} = {
|
||||
$c->stash->{'plain'} = {
|
||||
data => "$nrQueuedBuilds"
|
||||
};
|
||||
$c->forward('Hydra::View::Plain');
|
||||
@ -176,7 +176,7 @@ sub nrbuilds : Chained('api') PathPart('nrbuilds') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
my $nr = $c->request->params->{nr};
|
||||
my $period = $c->request->params->{period};
|
||||
|
||||
|
||||
error($c, "Parameter not defined!") if !defined $nr || !defined $period;
|
||||
my $base;
|
||||
|
||||
@ -186,21 +186,21 @@ sub nrbuilds : Chained('api') PathPart('nrbuilds') Args(0) {
|
||||
my $system = $c->request->params->{system};
|
||||
|
||||
my $filter = {finished => 1};
|
||||
$filter->{project} = $project if ! $project eq "";
|
||||
$filter->{jobset} = $jobset if ! $jobset eq "";
|
||||
$filter->{job} = $job if !$job eq "";
|
||||
$filter->{system} = $system if !$system eq "";
|
||||
$filter->{project} = $project if ! $project eq "";
|
||||
$filter->{jobset} = $jobset if ! $jobset eq "";
|
||||
$filter->{job} = $job if !$job eq "";
|
||||
$filter->{system} = $system if !$system eq "";
|
||||
|
||||
$base = 60*60 if($period eq "hour");
|
||||
$base = 24*60*60 if($period eq "day");
|
||||
|
||||
|
||||
my @stats = $c->model('DB::Builds')->search($filter, {select => [{ count => "*" }], as => ["nr"], group_by => ["timestamp - timestamp % $base"], order_by => "timestamp - timestamp % $base DESC", rows => $nr});
|
||||
my @arr;
|
||||
push @arr, int($_->get_column("nr")) foreach @stats;
|
||||
@arr = reverse(@arr);
|
||||
|
||||
$c->stash->{'plain'} = {
|
||||
data => scalar (JSON::Any->objToJson(\@arr))
|
||||
|
||||
$c->stash->{'plain'} = {
|
||||
data => scalar (JSON::Any->objToJson(\@arr))
|
||||
};
|
||||
$c->forward('Hydra::View::Plain');
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ sub create_user : Chained('admin') PathPart('create-user') Args(0) {
|
||||
|
||||
$c->stash->{template} = 'user.tt';
|
||||
$c->stash->{edit} = 1;
|
||||
$c->stash->{create} = 1;
|
||||
$c->stash->{create} = 1;
|
||||
}
|
||||
|
||||
sub create_user_submit : Chained('admin') PathPart('create-user/submit') Args(0) {
|
||||
@ -160,7 +160,7 @@ sub user_edit_submit : Chained('user') PathPart('submit') Args(0) {
|
||||
updateUser($c, $c->stash->{user});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$c->res->redirect("/admin/users");
|
||||
}
|
||||
|
||||
@ -252,9 +252,9 @@ sub machine_edit_submit : Chained('machine') PathPart('submit') Args(0) {
|
||||
updateMachine($c, $c->stash->{machine});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
saveNixMachines($c);
|
||||
|
||||
|
||||
$c->res->redirect("/admin/machines");
|
||||
}
|
||||
|
||||
|
@ -27,18 +27,18 @@ sub overview : Chained('job') PathPart('') Args(0) {
|
||||
|
||||
$c->stash->{currentBuilds} = [$c->stash->{job}->builds->search({finished => 1, iscurrent => 1}, { order_by => 'system' })];
|
||||
|
||||
$c->stash->{lastBuilds} =
|
||||
[ $c->stash->{job}->builds->search({ finished => 1 },
|
||||
$c->stash->{lastBuilds} =
|
||||
[ $c->stash->{job}->builds->search({ finished => 1 },
|
||||
{ order_by => 'timestamp DESC', rows => 10, columns => [@buildListColumns] }) ];
|
||||
|
||||
$c->stash->{runningBuilds} = [
|
||||
$c->stash->{job}->builds->search(
|
||||
{ busy => 1 },
|
||||
{ busy => 1 },
|
||||
{ join => ['project']
|
||||
, order_by => ["priority DESC", "timestamp"]
|
||||
, '+select' => ['project.enabled']
|
||||
, '+as' => ['enabled']
|
||||
}
|
||||
, '+as' => ['enabled']
|
||||
}
|
||||
) ];
|
||||
|
||||
$c->stash->{systems} = [$c->stash->{job}->builds->search({iscurrent => 1}, {select => ["system"], distinct => 1})];
|
||||
|
@ -51,7 +51,7 @@ sub jobsetIndex {
|
||||
|
||||
$c->stash->{evals} = getEvals($self, $c, 0, 5);
|
||||
|
||||
$c->stash->{systems} =
|
||||
$c->stash->{systems} =
|
||||
[ $c->stash->{jobset}->builds->search({ iscurrent => 1 }, { select => ["system"], distinct => 1, order_by => "system" }) ];
|
||||
|
||||
# status per system
|
||||
@ -332,9 +332,9 @@ sub clone_submit : Chained('jobset') PathPart('clone/submit') Args(0) {
|
||||
|
||||
sub getEvals {
|
||||
my ($self, $c, $offset, $rows) = @_;
|
||||
|
||||
|
||||
my @evals = $c->stash->{jobset}->jobsetevals->search(
|
||||
{ hasnewbuilds => 1 },
|
||||
{ hasnewbuilds => 1 },
|
||||
{ order_by => "id DESC", rows => $rows + 1, offset => $offset });
|
||||
|
||||
my @res = ();
|
||||
@ -366,12 +366,12 @@ sub getEvals {
|
||||
foreach my $input (@{$curInputs}) {
|
||||
my $p = $prevInputsHash{$input->name};
|
||||
push @changedInputs, $input
|
||||
if !defined $p || ($input->revision || "") ne ($p->revision || "") || $input->type ne $p->type || ($input->uri || "") ne ($p->uri || "") ||
|
||||
if !defined $p || ($input->revision || "") ne ($p->revision || "") || $input->type ne $p->type || ($input->uri || "") ne ($p->uri || "") ||
|
||||
( defined $input->dependency && defined $p->dependency && $input->dependency->id ne $p->dependency->id);
|
||||
}
|
||||
$prevInputs = $curInputs;
|
||||
|
||||
my $e =
|
||||
my $e =
|
||||
{ eval => $cur
|
||||
, nrScheduled => $nrScheduled
|
||||
, nrSucceeded => $nrSucceeded
|
||||
@ -382,7 +382,7 @@ sub getEvals {
|
||||
push @res, $e if $n < $rows;
|
||||
$prev = $e;
|
||||
}
|
||||
|
||||
|
||||
return [reverse @res];
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ use Hydra::Helper::CatalystUtils;
|
||||
|
||||
sub eval : Chained('/') PathPart('eval') CaptureArgs(1) {
|
||||
my ($self, $c, $evalId) = @_;
|
||||
|
||||
|
||||
my $eval = $c->model('DB::JobsetEvals')->find($evalId)
|
||||
or notFound($c, "Evaluation $evalId doesn't exist.");
|
||||
|
||||
@ -50,7 +50,7 @@ sub view : Chained('eval') PathPart('') Args(0) {
|
||||
}
|
||||
|
||||
$c->stash->{otherEval} = $eval2 if defined $eval2;
|
||||
|
||||
|
||||
my @builds = $eval->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] });
|
||||
my @builds2 = defined $eval2
|
||||
? $eval2->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] })
|
||||
@ -94,7 +94,7 @@ sub view : Chained('eval') PathPart('') Args(0) {
|
||||
}
|
||||
push @{$c->stash->{new}}, $build if !$found;
|
||||
}
|
||||
|
||||
|
||||
$c->stash->{full} = ($c->req->params->{full} || "0") eq "1";
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ sub release : Chained('eval') PathPart('release') Args(0) {
|
||||
my $eval = $c->stash->{eval};
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
|
||||
my @builds = $eval->builds;
|
||||
|
||||
my $releaseName;
|
||||
|
@ -9,7 +9,7 @@ use Hydra::Helper::CatalystUtils;
|
||||
|
||||
sub project : Chained('/') PathPart('project') CaptureArgs(1) {
|
||||
my ($self, $c, $projectName) = @_;
|
||||
|
||||
|
||||
my $project = $c->model('DB::Projects')->find($projectName)
|
||||
or notFound($c, "Project $projectName doesn't exist.");
|
||||
|
||||
@ -44,7 +44,7 @@ sub submit : Chained('project') PathPart Args(0) {
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
requirePost($c);
|
||||
|
||||
|
||||
if (($c->request->params->{submit} || "") eq "delete") {
|
||||
$c->stash->{project}->delete;
|
||||
$c->res->redirect($c->uri_for("/"));
|
||||
@ -53,7 +53,7 @@ sub submit : Chained('project') PathPart Args(0) {
|
||||
txn_do($c->model('DB')->schema, sub {
|
||||
updateProject($c, $c->stash->{project});
|
||||
});
|
||||
|
||||
|
||||
$c->res->redirect($c->uri_for($self->action_for("view"), [$c->stash->{project}->name]));
|
||||
}
|
||||
|
||||
@ -62,11 +62,11 @@ sub hide : Chained('project') PathPart Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
|
||||
txn_do($c->model('DB')->schema, sub {
|
||||
$c->stash->{project}->update({ hidden => 1, enabled => 0 });
|
||||
});
|
||||
|
||||
|
||||
$c->res->redirect($c->uri_for("/"));
|
||||
}
|
||||
|
||||
@ -75,18 +75,18 @@ sub unhide : Chained('project') PathPart Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
|
||||
txn_do($c->model('DB')->schema, sub {
|
||||
$c->stash->{project}->update({ hidden => 0 });
|
||||
});
|
||||
|
||||
|
||||
$c->res->redirect($c->uri_for("/"));
|
||||
}
|
||||
|
||||
|
||||
sub requireMayCreateProjects {
|
||||
my ($c) = @_;
|
||||
|
||||
|
||||
requireLogin($c) if !$c->user_exists;
|
||||
|
||||
error($c, "Only administrators or authorised users can perform this operation.")
|
||||
@ -111,7 +111,7 @@ sub create_submit : Path('/create-project/submit') {
|
||||
requireMayCreateProjects($c);
|
||||
|
||||
my $projectName = trim $c->request->params->{name};
|
||||
|
||||
|
||||
error($c, "Invalid project name: ‘$projectName’") if $projectName !~ /^$projectNameRE$/;
|
||||
|
||||
txn_do($c->model('DB')->schema, sub {
|
||||
@ -124,7 +124,7 @@ sub create_submit : Path('/create-project/submit') {
|
||||
{name => $projectName, displayname => "", owner => $owner});
|
||||
updateProject($c, $project);
|
||||
});
|
||||
|
||||
|
||||
$c->res->redirect($c->uri_for($self->action_for("view"), [$projectName]));
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ sub create_jobset : Chained('project') PathPart('create-jobset') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
|
||||
$c->stash->{template} = 'jobset.tt';
|
||||
$c->stash->{create} = 1;
|
||||
$c->stash->{edit} = 1;
|
||||
@ -144,7 +144,7 @@ sub create_jobset_submit : Chained('project') PathPart('create-jobset/submit') A
|
||||
my ($self, $c) = @_;
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
|
||||
my $jobsetName = trim $c->request->params->{name};
|
||||
my $exprType =
|
||||
$c->request->params->{"nixexprpath"} =~ /.scm$/ ? "guile" : "nix";
|
||||
@ -158,7 +158,7 @@ sub create_jobset_submit : Chained('project') PathPart('create-jobset/submit') A
|
||||
{name => $jobsetName, nixexprinput => "", nixexprpath => "", emailoverride => ""});
|
||||
Hydra::Controller::Jobset::updateJobset($c, $jobset);
|
||||
});
|
||||
|
||||
|
||||
$c->res->redirect($c->uri_for($c->controller('Jobset')->action_for("index"),
|
||||
[$c->stash->{project}->name, $jobsetName]));
|
||||
}
|
||||
@ -166,7 +166,7 @@ sub create_jobset_submit : Chained('project') PathPart('create-jobset/submit') A
|
||||
|
||||
sub updateProject {
|
||||
my ($c, $project) = @_;
|
||||
|
||||
|
||||
my $owner = $project->owner;
|
||||
if ($c->check_user_roles('admin')) {
|
||||
$owner = trim $c->request->params->{owner};
|
||||
@ -176,7 +176,7 @@ sub updateProject {
|
||||
|
||||
my $projectName = trim $c->request->params->{name};
|
||||
error($c, "Invalid project name: ‘$projectName’") if $projectName !~ /^$projectNameRE$/;
|
||||
|
||||
|
||||
my $displayName = trim $c->request->params->{displayname};
|
||||
error($c, "Invalid display name: $displayName") if $displayName eq "";
|
||||
|
||||
@ -209,7 +209,7 @@ sub create_view_submit : Chained('project') PathPart('create-view/submit') Args(
|
||||
my ($self, $c) = @_;
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
|
||||
my $viewName = $c->request->params->{name};
|
||||
|
||||
my $view;
|
||||
@ -253,7 +253,7 @@ sub create_release : Chained('project') PathPart('create-release') Args(0) {
|
||||
|
||||
sub create_release_submit : Chained('project') PathPart('create-release/submit') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
my $releaseName = $c->request->params->{name};
|
||||
|
@ -28,11 +28,11 @@ sub view : Chained('release') PathPart('') Args(0) {
|
||||
|
||||
sub updateRelease {
|
||||
my ($c, $release) = @_;
|
||||
|
||||
|
||||
my $releaseName = trim $c->request->params->{name};
|
||||
error($c, "Invalid release name: $releaseName")
|
||||
unless $releaseName =~ /^$relNameRE$/;
|
||||
|
||||
|
||||
$release->update(
|
||||
{ name => $releaseName
|
||||
, description => trim $c->request->params->{description}
|
||||
@ -59,7 +59,7 @@ sub edit : Chained('release') PathPart('edit') Args(0) {
|
||||
|
||||
sub submit : Chained('release') PathPart('submit') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
if (($c->request->params->{action} || "") eq "delete") {
|
||||
|
@ -87,7 +87,7 @@ sub timeline :Local {
|
||||
$c->stash->{template} = 'timeline.tt';
|
||||
$c->stash->{builds} = [ $c->model('DB::Builds')->search
|
||||
( { finished => 1, stoptime => { '>' => $pit } }
|
||||
, { order_by => ["starttime"] }
|
||||
, { order_by => ["starttime"] }
|
||||
) ];
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ sub nar :Local :Args(1) {
|
||||
sub nix_cache_info :Path('nix-cache-info') :Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
$c->response->content_type('text/plain');
|
||||
$c->stash->{'plain'} = { data =>
|
||||
$c->stash->{'plain'} = { data =>
|
||||
#"StoreDir: $Nix::Config::storeDir\n" . # FIXME
|
||||
"StoreDir: /nix/store\n" .
|
||||
"WantMassQuery: 0\n" .
|
||||
|
@ -9,7 +9,7 @@ use Hydra::Helper::CatalystUtils;
|
||||
|
||||
sub getView {
|
||||
my ($c, $projectName, $viewName) = @_;
|
||||
|
||||
|
||||
my $project = $c->model('DB::Projects')->find($projectName);
|
||||
notFound($c, "Project $projectName doesn't exist.") if !defined $project;
|
||||
$c->stash->{project} = $project;
|
||||
@ -32,11 +32,11 @@ sub getView {
|
||||
|
||||
sub updateView {
|
||||
my ($c, $view) = @_;
|
||||
|
||||
|
||||
my $viewName = trim $c->request->params->{name};
|
||||
error($c, "Invalid view name: $viewName")
|
||||
unless $viewName =~ /^[[:alpha:]][\w\-]*$/;
|
||||
|
||||
|
||||
$view->update(
|
||||
{ name => $viewName
|
||||
, description => trim $c->request->params->{description} });
|
||||
@ -61,7 +61,7 @@ sub updateView {
|
||||
# !!! We could check whether the job exists, but that would
|
||||
# require the evaluator to have seen the job, which may not be
|
||||
# the case.
|
||||
|
||||
|
||||
$view->viewjobs->create(
|
||||
{ jobset => $jobsetName
|
||||
, job => $jobName
|
||||
@ -112,7 +112,7 @@ sub edit : Chained('view') PathPart('edit') Args(0) {
|
||||
$c->stash->{template} = 'edit-view.tt';
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub submit : Chained('view') PathPart('submit') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
@ -127,10 +127,10 @@ sub submit : Chained('view') PathPart('submit') Args(0) {
|
||||
$c->res->redirect($c->uri_for($self->action_for("view_view"), $c->req->captures));
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub latest : Chained('view') PathPart('latest') {
|
||||
my ($self, $c, @args) = @_;
|
||||
|
||||
|
||||
# Redirect to the latest result in the view in which every build
|
||||
# is successful.
|
||||
my $latest = getLatestSuccessfulViewResult(
|
||||
@ -142,7 +142,7 @@ sub latest : Chained('view') PathPart('latest') {
|
||||
|
||||
sub latest_finished : Chained('view') PathPart('latest-finished') {
|
||||
my ($self, $c, @args) = @_;
|
||||
|
||||
|
||||
# Redirect to the latest result in the view in which every build
|
||||
# is successful *and* where the jobset evaluation has finished
|
||||
# completely.
|
||||
@ -155,7 +155,7 @@ sub latest_finished : Chained('view') PathPart('latest-finished') {
|
||||
|
||||
sub result : Chained('view') PathPart('') {
|
||||
my ($self, $c, $id, @args) = @_;
|
||||
|
||||
|
||||
$c->stash->{template} = 'view-result.tt';
|
||||
|
||||
# Note: we don't actually check whether $id is a primary build,
|
||||
@ -206,9 +206,9 @@ sub result : Chained('view') PathPart('') {
|
||||
$c->res->redirect($c->uri_for($c->controller('JobsetEval')->action_for("view"),
|
||||
[$eval->id], @args[1..$#args], $c->req->params));
|
||||
}
|
||||
|
||||
|
||||
# Provide a redirect to the specified job of this view result
|
||||
# through `http://.../view/$project/$viewName/$viewResult/$jobName'.
|
||||
# through `http://.../view/$project/$viewName/$viewResult/$jobName'.
|
||||
# Optionally, you can append `-$system' to the $jobName to get a
|
||||
# build for a specific platform.
|
||||
elsif (scalar @args != 0) {
|
||||
|
@ -39,9 +39,9 @@ sub getPreviousBuild {
|
||||
, project => $build->project->name
|
||||
, jobset => $build->jobset->name
|
||||
, job => $build->job->name
|
||||
, 'me.id' => { '<' => $build->id }
|
||||
, 'me.id' => { '<' => $build->id }
|
||||
}, {rows => 1, order_by => "me.id DESC"});
|
||||
|
||||
|
||||
return $prevBuild;
|
||||
}
|
||||
|
||||
@ -56,9 +56,9 @@ sub getNextBuild {
|
||||
, project => $build->project->name
|
||||
, jobset => $build->jobset->name
|
||||
, job => $build->job->name
|
||||
, 'me.id' => { '>' => $build->id }
|
||||
, 'me.id' => { '>' => $build->id }
|
||||
}, {rows => 1, order_by => "me.id ASC"});
|
||||
|
||||
|
||||
return $nextBuild;
|
||||
}
|
||||
|
||||
@ -74,27 +74,27 @@ sub getPreviousSuccessfulBuild {
|
||||
, jobset => $build->jobset->name
|
||||
, job => $build->job->name
|
||||
, buildstatus => 0
|
||||
, 'me.id' => { '<' => $build->id }
|
||||
, 'me.id' => { '<' => $build->id }
|
||||
}, {rows => 1, order_by => "me.id DESC"});
|
||||
|
||||
|
||||
return $prevBuild;
|
||||
}
|
||||
|
||||
|
||||
sub getBuildStats {
|
||||
my ($c, $builds) = @_;
|
||||
|
||||
|
||||
$c->stash->{finishedBuilds} = $builds->search({finished => 1}) || 0;
|
||||
|
||||
|
||||
$c->stash->{succeededBuilds} = $builds->search({finished => 1, buildStatus => 0}) || 0;
|
||||
|
||||
|
||||
$c->stash->{scheduledBuilds} = $builds->search({finished => 0}) || 0;
|
||||
|
||||
|
||||
$c->stash->{busyBuilds} = $builds->search({finished => 0, busy => 1}) || 0;
|
||||
|
||||
my $res;
|
||||
$res = $builds->search({}, {select => {sum => 'stoptime - starttime'}, as => ['sum']})->first;
|
||||
|
||||
|
||||
$c->stash->{totalBuildTime} = defined ($res) ? $res->get_column('sum') : 0 ;
|
||||
|
||||
}
|
||||
@ -131,7 +131,7 @@ sub isProjectOwner {
|
||||
|
||||
sub requireProjectOwner {
|
||||
my ($c, $project) = @_;
|
||||
|
||||
|
||||
requireLogin($c) if !$c->user_exists;
|
||||
|
||||
error($c, "Only the project members or administrators can perform this operation.")
|
||||
@ -150,7 +150,7 @@ sub requireAdmin {
|
||||
my ($c) = @_;
|
||||
|
||||
requireLogin($c) if !$c->user_exists;
|
||||
|
||||
|
||||
error($c, "Only administrators can perform this operation.")
|
||||
unless isAdmin($c);
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ __PACKAGE__->has_many(
|
||||
__PACKAGE__->has_one(
|
||||
"actualBuildStep",
|
||||
"Hydra::Schema::BuildSteps",
|
||||
{ 'foreign.outpath' => 'self.outpath'
|
||||
{ 'foreign.outpath' => 'self.outpath'
|
||||
, 'foreign.build' => 'self.id'
|
||||
},
|
||||
);
|
||||
@ -480,7 +480,7 @@ sub makeSource {
|
||||
|
||||
sub makeQueries {
|
||||
my ($name, $constraint) = @_;
|
||||
|
||||
|
||||
my $activeJobs = "(select distinct project, jobset, job, system from Builds where isCurrent = 1 $constraint)";
|
||||
|
||||
makeSource(
|
||||
@ -489,11 +489,11 @@ sub makeQueries {
|
||||
<<QUERY
|
||||
select x.*, b.id as statusChangeId, b.timestamp as statusChangeTime
|
||||
from
|
||||
(select
|
||||
(select
|
||||
(select max(b.id) from Builds b
|
||||
where
|
||||
project = activeJobs.project and jobset = activeJobs.jobset
|
||||
and job = activeJobs.job and system = activeJobs.system
|
||||
where
|
||||
project = activeJobs.project and jobset = activeJobs.jobset
|
||||
and job = activeJobs.job and system = activeJobs.system
|
||||
and finished = 1
|
||||
) as id
|
||||
from $activeJobs as activeJobs
|
||||
@ -512,17 +512,17 @@ QUERY
|
||||
);
|
||||
|
||||
makeSource("ActiveJobs$name", "(select distinct project, jobset, job from Builds where isCurrent = 1 $constraint)");
|
||||
|
||||
|
||||
makeSource(
|
||||
"LatestSucceeded$name",
|
||||
<<QUERY
|
||||
select *
|
||||
from
|
||||
(select
|
||||
(select
|
||||
(select max(b.id) from builds b
|
||||
where
|
||||
project = activeJobs.project and jobset = activeJobs.jobset
|
||||
and job = activeJobs.job and system = activeJobs.system
|
||||
where
|
||||
project = activeJobs.project and jobset = activeJobs.jobset
|
||||
and job = activeJobs.job and system = activeJobs.system
|
||||
and finished = 1 and buildstatus = 0
|
||||
) as id
|
||||
from $activeJobs as activeJobs
|
||||
|
@ -276,7 +276,7 @@ __PACKAGE__->has_many(
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vHluB+s1FkpJBPWmpv+wUQ
|
||||
|
||||
1;
|
||||
# End of lines loaded from '/home/rbvermaa/src/hydra/src/lib/Hydra/Schema/Users.pm'
|
||||
# End of lines loaded from '/home/rbvermaa/src/hydra/src/lib/Hydra/Schema/Users.pm'
|
||||
# These lines were loaded from '/home/rbvermaa/src/hydra/src/lib/Hydra/Schema/Users.pm' found in @INC.
|
||||
# They are now part of the custom portion of this file
|
||||
# for you to hand-edit. If you do not either delete
|
||||
|
@ -9,7 +9,7 @@ sub process {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
my $storePath = $c->stash->{storePath};
|
||||
|
||||
|
||||
$c->response->content_type('text/x-nix-narinfo'); # !!! check MIME type
|
||||
|
||||
my ($deriver, $narHash, $time, $narSize, $refs) = queryPathInfo($storePath, 1);
|
||||
|
@ -6,17 +6,17 @@ use IO::Pipe;
|
||||
|
||||
sub process {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
|
||||
$c->response->content_type('application/x-nix-export');
|
||||
|
||||
my @storePaths = @{$c->stash->{storePaths}};
|
||||
|
||||
my $fh = new IO::Handle;
|
||||
|
||||
|
||||
open $fh, "nix-store --export `nix-store -qR @storePaths` | gzip |";
|
||||
|
||||
$c->response->body($fh);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ sub process {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
my @storePaths = @{$c->stash->{storePaths}};
|
||||
|
||||
|
||||
$c->response->content_type('text/x-nix-manifest');
|
||||
|
||||
my @paths = computeFSClosure(0, 1, @storePaths);
|
||||
@ -19,7 +19,7 @@ sub process {
|
||||
"version {\n" .
|
||||
" ManifestVersion: 4\n" .
|
||||
"}\n";
|
||||
|
||||
|
||||
foreach my $path (@paths) {
|
||||
my ($deriver, $hash, $time, $narSize, $refs) = queryPathInfo($path, 0);
|
||||
|
||||
@ -30,7 +30,7 @@ sub process {
|
||||
$escaped =~ s/\+/%2b/g;
|
||||
$escaped =~ s/\=/%3d/g;
|
||||
$escaped =~ s/\?/%3f/g;
|
||||
|
||||
|
||||
my $url = $c->stash->{narBase} . "/" . $escaped;
|
||||
|
||||
my $system = $c->stash->{systemForPath}->{$path};
|
||||
|
@ -7,11 +7,11 @@ sub process {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
my $storePath = $c->stash->{storePath};
|
||||
|
||||
|
||||
$c->response->content_type('application/x-nix-archive'); # !!! check MIME type
|
||||
|
||||
my $fh = new IO::Handle;
|
||||
|
||||
|
||||
open $fh, "nix-store --dump '$storePath' | bzip2 |";
|
||||
|
||||
$c->response->body($fh);
|
||||
|
@ -14,7 +14,7 @@ sub process {
|
||||
. " " . $build->nixname . " " . $build->system
|
||||
. " " . $build->drvpath . " " . $build->outpath
|
||||
. " " . $c->uri_for('/');
|
||||
|
||||
|
||||
$c->response->body($s);
|
||||
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user