Jobset: list known inputs in invalid input type response
[?]
Apr 30, 2021, 12:41 AM
WQYAGTX3RIB4PW6WZC7FDW3FNXMOJ4HTRGZMB4OVDWGPUKDSK2GACDependencies
- [2]
ZDH6UX5UJobset: add HTTP API test - [3]
OOQ2D3KC* Refactoring: move fetchInput out of hydra_scheduler into a separate - [4]
KYSBJAYNAllow dashes in jobset input names - [5]
VZX6HJ3IFix jobset input handling in the API - [6]
ZFEN2MAOSimplify jobset cloning - [7]
LZVO64YGMerge in the first bits of the API work - [8]
TQVKZQUGUse the REST API in the web interface for editing jobsets - [9]
ZCTQCN3EUse inputTypes from plugins to determine valid input types - [10]
ODNCGFQ5* Improved the navigation bar: don't include all projects (since that - [11]
QUMWPGCUAdd flake configuration to the web interface - [*]
3HZY24CX* Make jobsets viewable under
Change contents
- edit in src/lib/Hydra/Controller/Jobset.pm at line 214
- edit in src/lib/Hydra/Controller/Jobset.pm at line 216
sub knownInputTypes {my ($c) = @_; - edit in src/lib/Hydra/Controller/Jobset.pm at line 219
my @keys = keys %{$c->stash->{inputTypes}};my $types = "";my $counter = 0;foreach my $key (@keys) {$types = $types . "and ‘$key’" if ++$counter == scalar(@keys);$types = $types . "‘$key’, " if $counter != scalar(@keys);}return $types;} - edit in src/lib/Hydra/Controller/Jobset.pm at line 294
my $types = knownInputTypes($c); - replacement in src/lib/Hydra/Controller/Jobset.pm at line 296
error($c, "Invalid input name ‘$name’.") unless $name =~ /^[[:alpha:]][\w-]*$/;error($c, "Invalid input type ‘$type’.") unless defined $c->stash->{inputTypes}->{$type};badRequest($c, "Invalid input name ‘$name’.") unless $name =~ /^[[:alpha:]][\w-]*$/;badRequest($c, "Invalid input type ‘$type’; valid types: $types.") unless defined $c->stash->{inputTypes}->{$type}; - edit in t/Controller/Jobset/http.t at line 157
};subtest 'Update jobset "job" to have an invalid input type' => sub {my $jobsetupdate = request(PUT '/jobset/tests/job',Accept => 'application/json',Content_Type => 'application/json',Cookie => $cookie,Content => encode_json({enabled => 3,visible => JSON::true,name => "job",type => 0,nixexprinput => "ofborg",nixexprpath => "release.nix",inputs => {ofborg => {name => "ofborg",type => "123",value => "https://github.com/NixOS/ofborg.git released"}},description => "test jobset",checkinterval => 0,schedulingshares => 50,keepnr => 1}));ok(!$jobsetupdate->is_success);ok($jobsetupdate->content =~ m/Invalid input type.*valid types:/);