diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 7d62ebba..a134a307 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -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) = @_; diff --git a/src/root/build.tt b/src/root/build.tt index edd28b5a..9eff2d65 100644 --- a/src/root/build.tt +++ b/src/root/build.tt @@ -78,7 +78,6 @@
  • Reproduce locally
  • [% END %] [% IF c.user_exists %] -
  • Clone
  • [% IF available %] [% IF build.keep %]
  • Unkeep
  • diff --git a/src/root/clone-build.tt b/src/root/clone-build.tt deleted file mode 100644 index 588e9574..00000000 --- a/src/root/clone-build.tt +++ /dev/null @@ -1,51 +0,0 @@ -[% WRAPPER layout.tt title="Clone build ${build.id}" %] -[% PROCESS common.tt %] -[% USE HTML %] -[% edit=1 %] - -

    Cloning allows you to perform a build with modified inputs.

    - -
    - -

    Nix expression

    - -

    Evaluate job build.job.name) %] - /> in Nix expression build.nixexprpath) %] - /> in input build.nixexprinput) - %] />.

    - -

    Build inputs

    - - - - - - - [% FOREACH input IN build.inputs %] - - - - - - [% END %] - -
    NameTypeValue
    [% input.name %] "input-$input.name-name" value => input.name) %] /> - [% INCLUDE renderSelection curValue=input.type param="input-$input.name-type" options=inputTypes %] - - build.project.name _ ':' _ build.jobset.name _ ':' _ build.job.name _ '[id="'_ build.id _ '"]' ) %] - [% ELSE %] - [% HTML.attributes(value => input.value || input.uri) %] - [% END %] /> -
    - -

    - -
    - -[% END %] diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 07700222..23fc7925 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -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,