Remove the "clone build" feature
This commit is contained in:
		@@ -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) = @_;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user