forked from lix-project/hydra
Allow dashes in jobset input names
Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
parent
6d5a3d0580
commit
1a313ad566
|
@ -248,7 +248,7 @@ sub nixExprPathFromParams {
|
||||||
error($c, "Invalid Nix expression path: $nixExprPath") if $nixExprPath !~ /^$relPathRE$/;
|
error($c, "Invalid Nix expression path: $nixExprPath") if $nixExprPath !~ /^$relPathRE$/;
|
||||||
|
|
||||||
my $nixExprInput = trim $c->stash->{params}->{"nixexprinput"};
|
my $nixExprInput = trim $c->stash->{params}->{"nixexprinput"};
|
||||||
error($c, "Invalid Nix expression input name: $nixExprInput") unless $nixExprInput =~ /^\w+$/;
|
error($c, "Invalid Nix expression input name: $nixExprInput") unless $nixExprInput =~ /^[[:alpha:]][\w-]*$/;
|
||||||
|
|
||||||
return ($nixExprPath, $nixExprInput);
|
return ($nixExprPath, $nixExprInput);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ sub updateJobset {
|
||||||
|
|
||||||
foreach my $inputName (keys %{$c->stash->{params}->{inputs}}) {
|
foreach my $inputName (keys %{$c->stash->{params}->{inputs}}) {
|
||||||
my $inputData = $c->stash->{params}->{inputs}->{$inputName};
|
my $inputData = $c->stash->{params}->{inputs}->{$inputName};
|
||||||
error($c, "Invalid input name: $inputName") unless $inputName =~ /^[[:alpha:]]\w*$/;
|
error($c, "Invalid input name: $inputName") unless $inputName =~ /^[[:alpha:]][\w-]*$/;
|
||||||
|
|
||||||
my $inputType = $inputData->{type};
|
my $inputType = $inputData->{type};
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ sub end : ActionClass('RenderView') {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scalar @{$c->error}) {
|
if (scalar @{$c->error}) {
|
||||||
$c->stash->{resource} = { errors => "$c->error" };
|
$c->stash->{resource} = { errors => $c->error };
|
||||||
$c->stash->{template} = 'error.tt';
|
$c->stash->{template} = 'error.tt';
|
||||||
$c->stash->{errors} = $c->error;
|
$c->stash->{errors} = $c->error;
|
||||||
$c->response->status(500) if $c->response->status == 200;
|
$c->response->status(500) if $c->response->status == 200;
|
||||||
|
|
|
@ -37,13 +37,13 @@ my $project = decode_json(request_json({ uri => '/project/sample' })->content())
|
||||||
|
|
||||||
ok((not @{$project->{jobsets}}), "A new project has no jobsets");
|
ok((not @{$project->{jobsets}}), "A new project has no jobsets");
|
||||||
|
|
||||||
$result = request_json({ uri => '/jobset/sample/default', method => 'PUT', data => { nixexprpath => "default.nix", nixexprinput => "src", inputs => { src => { type => "path", values => "/run/jobset" } }, enabled => "1", checkinterval => "3600"} });
|
$result = request_json({ uri => '/jobset/sample/default', method => 'PUT', data => { nixexprpath => "default.nix", nixexprinput => "my-src", inputs => { "my-src" => { type => "path", values => "/run/jobset" } }, enabled => "1", checkinterval => "3600"} });
|
||||||
ok($result->code() == 201, "PUTting a new jobset creates it");
|
ok($result->code() == 201, "PUTting a new jobset creates it");
|
||||||
|
|
||||||
my $jobset = decode_json(request_json({ uri => '/jobset/sample/default' })->content());
|
my $jobset = decode_json(request_json({ uri => '/jobset/sample/default' })->content());
|
||||||
|
|
||||||
ok($jobset->{jobsetinputs}->[0]->{name} eq "src", "The new jobset has an 'src' input");
|
ok($jobset->{jobsetinputs}->[0]->{name} eq "my-src", "The new jobset has a 'my-src' input");
|
||||||
ok($jobset->{jobsetinputs}->[0]->{jobsetinputalts}->[0]->{value} eq "/run/jobset", "The 'src' input is in /run/jobset");
|
ok($jobset->{jobsetinputs}->[0]->{jobsetinputalts}->[0]->{value} eq "/run/jobset", "The 'my-src' input is in /run/jobset");
|
||||||
|
|
||||||
system("LOGNAME=root NIX_STORE_DIR=/run/nix/store NIX_LOG_DIR=/run/nix/var/log/nix NIX_STATE_DIR=/run/nix/var/nix HYDRA_DATA=/var/lib/hydra HYDRA_DBI='dbi:Pg:dbname=hydra;user=root;' hydra-evaluator sample default");
|
system("LOGNAME=root NIX_STORE_DIR=/run/nix/store NIX_LOG_DIR=/run/nix/var/log/nix NIX_STATE_DIR=/run/nix/var/nix HYDRA_DATA=/var/lib/hydra HYDRA_DBI='dbi:Pg:dbname=hydra;user=root;' hydra-evaluator sample default");
|
||||||
$result = request_json({ uri => '/jobset/sample/default/evals' });
|
$result = request_json({ uri => '/jobset/sample/default/evals' });
|
||||||
|
|
Loading…
Reference in a new issue