Remove all entry points to modify machines
[?]
Mar 4, 2013, 9:05 PM
JOVVHIJXYJN3RNRXZHPMHYHMIA3KRCL4UCJ5RM6S6ZOZY66LKKHQCDependencies
- [2]
LSZLZHJYAllow users to edit their own settings - [3]
WRIU3S5E* UI for cloning builds (not functional yet). - [4]
OX6NYJDVSplit viewing and editing a jobset - [5]
UICHT2PSAdd a search feature - [6]
EFWN7JBV* Added a status page that shows all the currently executing build steps. - [7]
IQ5NESOOmachines: Read /etc/nix.machines instead of using the BuildMachines table - [8]
NEQ4BISOAdd bootstrap.zip - [9]
ZWCTAZGLadded newsitems, added some admin options to clear various caches. - [10]
36M6DGITShow the runtime/build dependencies in the build page - [11]
JY7BXXOPSplit viewing and editing a project - [12]
VH5ZABDRAdd a page to show the latest evaluations for the entire server - [13]
JARRBLZDBootstrapify the Hydra forms (except the project and jobset edit pages) - [14]
67NFGL7Dadd links in admin page to clear queue (all non-running builds, and all non-running old (non-current) builds) - [15]
TRDGNILTRemove unused file - [16]
RBNQKATL* Adding persistant releases. A release is a named set of builds. - [17]
ODNCGFQ5* Improved the navigation bar: don't include all projects (since that - [18]
PALLP4UYis not in hydra-server's scope - [19]
QT4FO2HPrefactored admin controller, using chains, to avoid using requireadmin on each endpoint - [20]
KXGOUX7P* Creating releases. - [21]
MOX7XJ2EMerge the BuildSchedulingInfo table into the Builds table - [22]
PP4LPADGhydra: buildmachine disabled by default, add some default constraints - [23]
XDDCO6CH* hydra: add dependency list with links to logfiles - [24]
SMCOU72Fhydra: add some admin for adding/enabling/etc build machines - [25]
SGNXIOI4Hydra/32: Add option to force evaluation of a certain jobset via web interface (for admins only) - [26]
SMTMFEKEhydra: add missing templates - [27]
IK2KI6KZAdd create-user action that was mostly present already. - [28]
AS2OXLRM* Editing releases. - [29]
Q5WS4WKQhydra: add comment that file is generated by hydra to /etc/nix.machines - [30]
5DSDXORDhydra: missing plain.tt - [31]
6FRLEP4Pfirst try for timeline of last 24 hours in hydra - [32]
3JBUMW3Eforgot to commit a file - [33]
RXSEJG7WDo not delete builds when clearing the queue. Fixes #8. - [34]
3PNG7NIBRemove trailing whitespace - [35]
R2PON6R7Allow non-admin users to see the machine status page - [36]
OR5SJ42YShow releases in a tab on the project page - [37]
QL55ECJ6- adapted ui for hydra, more in line with nixos.org website - [38]
QTC3SYBMJobset page: Load the jobs and status tabs on demand - [39]
6KJXJB7Nqualify ordery_by clauses when necessary, remove unnecessary order_by's, reported by Ludo, resulted in errors in sqlite - [40]
PZL3SZM3Give every page a consistent title - [41]
D5ZR3ZY6hydra: missing property - [42]
SZYDW2DGhydra: added some user admin - [43]
2BUX775I* More release -> view. - [44]
P5X4P6VK* Renaming "release sets" to "views" (not finished yet). Having - [45]
75XUS62Y* Added a page to quickly see all failed builds and failed evaluations - [46]
RSEGBU6CHydra/20: Jobset clone feature - [47]
CQTN62OHDie tabs die - [48]
FV2M6MOThydra: use autoconf/-make - [49]
U4TD3AIQAdd support for viewing jobset evaluations - [50]
D5QIOJGP* Move everything up one directory.
Change contents
- edit in src/lib/Hydra/Controller/Admin.pm at line 14[3.26]→[3.26:62](∅→∅),[3.62]→[3.0:43](∅→∅),[3.43]→[3.0:1](∅→∅),[3.1]→[3.85:149](∅→∅),[3.85]→[3.85:149](∅→∅),[3.149]→[3.540:983](∅→∅),[3.983]→[3.568:597](∅→∅),[3.568]→[3.568:597](∅→∅),[3.597]→[3.2:3](∅→∅),[3.3]→[3.597:716](∅→∅),[3.597]→[3.597:716](∅→∅),[3.30]→[3.0:1](∅→∅),[3.716]→[3.0:1](∅→∅),[3.155]→[3.0:1](∅→∅),[3.1]→[3.717:849](∅→∅),[3.849]→[3.2:27](∅→∅),[3.27]→[3.879:882](∅→∅),[3.879]→[3.879:882](∅→∅),[3.882]→[3.4:5](∅→∅)
sub nixMachines {my ($c) = @_;my $result = "# GENERATED BY HYDRA\n";foreach my $machine ($c->model("DB::BuildMachines")->all) {if($machine->enabled) {$result = $result . $machine->username . '@'. $machine->hostname . ' ';foreach my $system ($machine->buildmachinesystemtypes) {$result = $result . $system->system .',';}chop $result;$result = $result . ' '. $machine->ssh_key . ' ' . $machine->maxconcurrent . ' '. $machine->speedfactor . ' ' . $machine->options . "\n";}}return $result;}sub saveNixMachines {my ($c) = @_;die("File not writable: /etc/nix.machines") if ! -w "/etc/nix.machines" ;open (NIXMACHINES, '>/etc/nix.machines') or die("Could not write to /etc/nix.machines");print NIXMACHINES nixMachines($c);close (NIXMACHINES);} - edit in src/lib/Hydra/Controller/Admin.pm at line 32
}sub machine : Chained('admin') PathPart('machine') CaptureArgs(1) {my ($self, $c, $machineName) = @_;requireAdmin($c);my $machine = $c->model('DB::BuildMachines')->find($machineName)or notFound($c, "Machine $machineName doesn't exist.");$c->stash->{machine} = $machine; - edit in src/lib/Hydra/Controller/Admin.pm at line 35[3.385]→[3.2288:2549](∅→∅),[3.283]→[3.2288:2549](∅→∅),[3.2549]→[3.386:387](∅→∅),[3.387]→[3.2549:2712](∅→∅),[3.2549]→[3.2549:2712](∅→∅),[3.2712]→[3.388:575](∅→∅),[3.575]→[3.2759:2767](∅→∅),[3.2759]→[3.2759:2767](∅→∅),[3.2767]→[3.1793:1794](∅→∅),[3.581]→[3.2767:2792](∅→∅),[3.1794]→[3.2767:2792](∅→∅),[3.2767]→[3.2767:2792](∅→∅),[3.2792]→[3.1795:1796](∅→∅),[3.587]→[3.2792:2837](∅→∅),[3.1796]→[3.2792:2837](∅→∅),[3.2792]→[3.2792:2837](∅→∅),[3.2837]→[3.588:589](∅→∅),[3.589]→[3.2837:2857](∅→∅),[3.2837]→[3.2837:2857](∅→∅),[3.2857]→[3.590:618](∅→∅),[3.618]→[3.2882:3210](∅→∅),[3.2882]→[3.2882:3210](∅→∅),[3.3210]→[3.0:63](∅→∅),[3.63]→[3.279:339](∅→∅),[3.339]→[3.3272:3631](∅→∅),[3.3272]→[3.3272:3631](∅→∅),[3.3631]→[3.340:341](∅→∅),[3.341]→[3.3637:3801](∅→∅),[3.3637]→[3.3637:3801](∅→∅),[3.3801]→[3.64:94](∅→∅),[3.94]→[3.3801:3899](∅→∅),[3.3801]→[3.3801:3899](∅→∅),[3.3899]→[3.984:1111](∅→∅),[3.349]→[3.4012:4100](∅→∅),[3.1111]→[3.4012:4100](∅→∅),[3.4012]→[3.4012:4100](∅→∅),[3.4100]→[3.350:356](∅→∅),[3.356]→[3.4109:4111](∅→∅),[3.4109]→[3.4109:4111](∅→∅),[3.4111]→[3.619:620](∅→∅),[3.620]→[3.4111:4235](∅→∅),[3.4111]→[3.4111:4235](∅→∅),[3.4235]→[3.357:358](∅→∅),[3.358]→[3.4240:4578](∅→∅),[3.4240]→[3.4240:4578](∅→∅),[3.4578]→[3.359:360](∅→∅),[3.360]→[3.0:59](∅→∅),[3.4583]→[3.0:59](∅→∅),[3.59]→[3.4647:4711](∅→∅),[3.4647]→[3.4647:4711](∅→∅),[3.4711]→[3.361:362](∅→∅),[3.362]→[3.4716:4860](∅→∅),[3.4716]→[3.4716:4860](∅→∅),[3.4860]→[3.60:97](∅→∅),[3.97]→[3.4908:4916](∅→∅),[3.4908]→[3.4908:4916](∅→∅),[3.4916]→[3.98:123](∅→∅),[3.123]→[3.4916:4961](∅→∅),[3.4916]→[3.4916:4961](∅→∅),[3.5076]→[3.5076:5077](∅→∅),[3.5239]→[3.5239:5453](∅→∅),[3.5453]→[3.621:622](∅→∅),[3.622]→[2.4:5](∅→∅),[2.5]→[3.5454:5668](∅→∅),[3.5454]→[3.5454:5668](∅→∅),[3.5668]→[3.0:2](∅→∅),[3.2]→[3.623:624](∅→∅),[3.624]→[3.2:3](∅→∅),[3.2]→[3.2:3](∅→∅)
sub machine_edit : Chained('machine') PathPart('edit') Args(0) {my ($self, $c) = @_;$c->stash->{template} = 'machine.tt';$c->stash->{systemtypes} = [$c->model('DB::SystemTypes')->search({}, {order_by => "system"})];$c->stash->{edit} = 1;}sub machine_edit_submit : Chained('machine') PathPart('submit') Args(0) {my ($self, $c) = @_;requirePost($c);txn_do($c->model('DB')->schema, sub {if (($c->request->params->{submit} || "") eq "delete") {$c->stash->{machine}->delete;} else {updateMachine($c, $c->stash->{machine});}});saveNixMachines($c);$c->res->redirect("/admin/machines");}sub updateMachine {my ($c, $machine) = @_;my $hostname = trim $c->request->params->{"hostname"};my $username = trim $c->request->params->{"username"};my $maxconcurrent = trim $c->request->params->{"maxconcurrent"};my $speedfactor = trim $c->request->params->{"speedfactor"};my $ssh_key = trim $c->request->params->{"ssh_key"};my $options = trim $c->request->params->{"options"};my $systems = $c->request->params->{"systems"} ;error($c, "Invalid or empty username.") if $username eq "";error($c, "Max concurrent builds should be an integer > 0.") if $maxconcurrent eq "" || ! $maxconcurrent =~ m/[0-9]+/;error($c, "Speed factor should be an integer > 0.") if $speedfactor eq "" || ! $speedfactor =~ m/[0-9]+/;error($c, "Invalid or empty SSH key.") if $ssh_key eq "";$machine->update({ username => $username, maxconcurrent => $maxconcurrent, speedfactor => $speedfactor, ssh_key => $ssh_key, options => $options});$machine->buildmachinesystemtypes->delete_all;if(ref($systems) eq 'ARRAY') {for my $s (@$systems) {$machine->buildmachinesystemtypes->create({ system => $s}) ;}} else {$machine->buildmachinesystemtypes->create({ system => $systems}) ;}}sub create_machine : Chained('admin') PathPart('create-machine') Args(0) {my ($self, $c) = @_;requireAdmin($c);$c->stash->{template} = 'machine.tt';$c->stash->{systemtypes} = [$c->model('DB::SystemTypes')->search({}, {order_by => "system"})];$c->stash->{edit} = 1;$c->stash->{create} = 1;}sub create_machine_submit : Chained('admin') PathPart('create-machine/submit') Args(0) {my ($self, $c) = @_;requireAdmin($c);my $hostname = trim $c->request->params->{"hostname"};error($c, "Invalid or empty hostname.") if $hostname eq "";txn_do($c->model('DB')->schema, sub {my $machine = $c->model('DB::BuildMachines')->create({ hostname => $hostname });updateMachine($c, $machine);});saveNixMachines($c);$c->res->redirect("/admin/machines");}sub machine_enable : Chained('machine') PathPart('enable') Args(0) {my ($self, $c) = @_;$c->stash->{machine}->update({ enabled => 1});saveNixMachines($c);$c->res->redirect("/admin/machines");}sub machine_disable : Chained('machine') PathPart('disable') Args(0) {my ($self, $c) = @_;$c->stash->{machine}->update({ enabled => 0});saveNixMachines($c);$c->res->redirect("/admin/machines");} - file deletion: machine.tt
[% PROCESS common.tt %]<form class="form-horizontal" method="post"action="[% IF create %][% c.uri_for('/admin/create-machine/submit') %][% ELSE %][% c.uri_for('/admin/machine' machine.hostname 'submit') %][% END %]"><fieldset>[% IF create %]<div class="control-group"><label class="control-label">Host name</label><div class="controls"><input type="text" class="span3" name="hostname" value="[% machine.hostname %]"></input></div></div>[% END %]<div class="control-group"><label class="control-label">User name</label><div class="controls"><input type="text" class="span3" name="username" value="[% machine.username %]"></input></div></div><div class="control-group"><label class="control-label">SSH key location</label><div class="controls"><input type="text" class="span3" name="ssh_key" value="[% machine.ssh_key %]"></input></div></div><div class="control-group"><label class="control-label">Options</label><div class="controls"><input type="text" class="span3" name="options" value="[% machine.options %]"></input></div></div><div class="control-group"><label class="control-label">Max concurrent builds</label><div class="controls"><input type="text" class="span3" name="maxconcurrent" value="[% machine.maxconcurrent %]"></input></div></div><div class="control-group"><label class="control-label">Speed factor</label><div class="controls"><input type="text" class="span3" name="speedfactor" value="[% machine.speedfactor %]"></input></div></div><div class="control-group"><label class="control-label">Systems</label><div class="controls"><select class="span3" multiple="1" name="systems">[% FOREACH s IN systemtypes;checked = false;FOREACH ms IN machine.buildmachinesystemtypes;checked = ms.system == s.system;BREAK IF checked;END %]<option value="[% s.system %]" [% IF checked %]selected="1"[% END %]>[% s.system %]</option>[% END %]</select></div></div><div class="form-actions"><button type="submit" class="btn btn-primary"><i class="icon-ok icon-white"></i>[%IF create %]Create[% ELSE %]Apply changes[% END %]</button>[% IF !create %]<button id="delete-machine" type="submit" class="btn btn-danger" name="submit" value="delete"><i class="icon-trash icon-white"></i>Delete this machine</button><script type="text/javascript">$("#delete-machine").click(function() {return confirm("Are you sure you want to delete this machine?");});</script>[% END %]</div></fieldset>[% END %][% WRAPPER layout.tt title=(create ? "New machine" : "Machine $machine.hostname") %]