Remove the "clone build" feature

This commit is contained in:
Eelco Dolstra 2013-10-04 15:43:51 +02:00
parent 7818bb75ed
commit aa49b128a8
4 changed files with 1 additions and 130 deletions

View file

@ -516,83 +516,6 @@ sub add_to_release : Chained('buildChain') PathPart('add-to-release') Args(0) {
}
sub clone : Chained('buildChain') PathPart('clone') Args(0) {
my ($self, $c) = @_;
my $build = $c->stash->{build};
requireProjectOwner($c, $build->project);
$c->stash->{template} = 'clone-build.tt';
}
sub clone_submit : Chained('buildChain') PathPart('clone/submit') Args(0) {
my ($self, $c) = @_;
my $build = $c->stash->{build};
requireProjectOwner($c, $build->project);
my ($nixExprPath, $nixExprInputName) = Hydra::Controller::Jobset::nixExprPathFromParams $c;
# When the expression is in a .scm file, assume it's a Guile + Guix
# build expression.
my $exprType =
$c->request->params->{"nixexprpath"} =~ /.scm$/ ? "guile" : "nix";
my $jobName = trim $c->request->params->{"jobname"};
error($c, "Invalid job name: $jobName") if $jobName !~ /^$jobNameRE$/;
my $inputInfo = {};
foreach my $param (keys %{$c->request->params}) {
next unless $param =~ /^input-(\w+)-name$/;
my $baseName = $1;
my ($inputName, $inputType) =
Hydra::Controller::Jobset::checkInput($c, $baseName);
my $inputValue = Hydra::Controller::Jobset::checkInputValue(
$c, $inputType, $c->request->params->{"input-$baseName-value"});
eval {
# !!! fetchInput can take a long time, which might cause
# the current HTTP request to time out. So maybe this
# should be done asynchronously. But then error reporting
# becomes harder.
my $info = fetchInput(
$c->hydra_plugins, $c->model('DB'), $build->project, $build->jobset,
$inputName, $inputType, $inputValue);
push @{$$inputInfo{$inputName}}, $info if defined $info;
};
error($c, $@) if $@;
}
my ($jobs, $nixExprInput) = evalJobs($inputInfo, $exprType, $nixExprInputName, $nixExprPath);
my $job;
foreach my $j (@{$jobs->{job}}) {
print STDERR $j->{jobName}, "\n";
if ($j->{jobName} eq $jobName) {
error($c, "Nix expression returned multiple builds for job $jobName.")
if $job;
$job = $j;
}
}
error($c, "Nix expression did not return a job named $jobName.") unless $job;
my %currentBuilds;
my $newBuild = checkBuild(
$c->model('DB'), $build->jobset,
$inputInfo, $nixExprInput, $job, \%currentBuilds, undef, {}, $c->hydra_plugins);
error($c, "This build has already been performed.") unless $newBuild;
$c->flash->{successMsg} = "Build " . $newBuild->id . " added to the queue.";
$c->res->redirect($c->uri_for($c->controller('Root')->action_for('queue')));
}
sub evals : Chained('buildChain') PathPart('evals') Args(0) {
my ($self, $c) = @_;

View file

@ -78,7 +78,6 @@
<li><a href="#reproduce" data-toggle="modal">Reproduce locally</a></li>
[% END %]
[% IF c.user_exists %]
<li><a href="[% c.uri_for('/build' build.id 'clone') %]">Clone</a></li>
[% IF available %]
[% IF build.keep %]
<li><a href="[% c.uri_for('/build' build.id 'keep' 0) %]">Unkeep</a></li>

View file

@ -1,51 +0,0 @@
[% WRAPPER layout.tt title="Clone build ${build.id}" %]
[% PROCESS common.tt %]
[% USE HTML %]
[% edit=1 %]
<p>Cloning allows you to perform a build with modified inputs.</p>
<form action="[% c.uri_for('/build' build.id 'clone' 'submit') %]" method="post">
<h2>Nix expression</h2>
<p>Evaluate job <tt><input type="text" class="string"
name="jobname" [% HTML.attributes(value => build.job.name) %]
/></tt> in Nix expression <tt><input type="text" class="string"
name="nixexprpath" [% HTML.attributes(value => build.nixexprpath) %]
/></tt> in input <tt><input type="text" class="string"
name="nixexprinput" [% HTML.attributes(value => build.nixexprinput)
%] /></tt>.</p>
<h2>Build inputs</h2>
<table class="table table-condensed table-striped">
<thead>
<tr><th>Name</th><th>Type</th><th>Value</th></tr>
</thead>
<tbody>
[% FOREACH input IN build.inputs %]
<tr>
<td><tt>[% input.name %]<input type="hidden" [% HTML.attributes(name => "input-$input.name-name" value => input.name) %] /></tt></td>
<td>
[% INCLUDE renderSelection curValue=input.type param="input-$input.name-type" options=inputTypes %]
</td>
<td>
<tt><input type="text" class="string" name="input-[% input.name %]-value"
[% IF input.type == "build" || input.type == "sysbuild" %]
[% build = input.dependency %]
[% HTML.attributes(value => build.project.name _ ':' _ build.jobset.name _ ':' _ build.job.name _ '[id="'_ build.id _ '"]' ) %]
[% ELSE %]
[% HTML.attributes(value => input.value || input.uri) %]
[% END %] /></tt>
</td>
</tr>
[% END %]
</tbody>
</table>
<p><button type="submit"><img alt="Add" src="[% c.uri_for("/static/images/success.gif") %]" />Add to queue</button></p>
</form>
[% END %]

View file

@ -142,7 +142,7 @@ create table Builds (
isCurrent integer default 0,
-- Copy of the nixExprInput/nixExprPath fields of the jobset that
-- instantiated this build. Needed if we want to clone this
-- instantiated this build. Needed if we want to reproduce this
-- build.
nixExprInput text,
nixExprPath text,