forked from lix-project/hydra
* Boolean inputs.
This commit is contained in:
parent
1698e490d0
commit
c72f4dd67a
|
@ -134,7 +134,7 @@ sub updateProject {
|
|||
my $inputType = trim $c->request->params->{"jobset-$baseName-input-$baseName2-type"};
|
||||
die "Invalid input type: $inputType" unless
|
||||
$inputType eq "svn" || $inputType eq "cvs" || $inputType eq "tarball" ||
|
||||
$inputType eq "string" || $inputType eq "path";
|
||||
$inputType eq "string" || $inputType eq "path" || $inputType eq "boolean";
|
||||
|
||||
$inputNames{$inputName} = 1;
|
||||
|
||||
|
@ -161,7 +161,10 @@ sub updateProject {
|
|||
my $altnr = 0;
|
||||
foreach my $value (@{$values}) {
|
||||
print STDERR "VALUE: $value\n";
|
||||
$input->jobsetinputalts->create({altnr => $altnr++, value => trim $value});
|
||||
my $value = trim $value;
|
||||
die "Invalid Boolean value: $value" if
|
||||
$inputType eq "boolean" && !($value eq "true" || $value eq "false");
|
||||
$input->jobsetinputalts->create({altnr => $altnr++, value => $value});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ use base 'DBIx::Class::Schema';
|
|||
__PACKAGE__->load_classes;
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:woBkuPRoV3DnJmHdcZ2ZIg
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TBu7KS/p71rCVTI6cl7Thw
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -36,8 +36,8 @@ __PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" });
|
|||
__PACKAGE__->belongs_to("dependency", "Hydra::Schema::Builds", { id => "dependency" });
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Mwn4Pp+vduPrAU9s089pAg
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Z/kUflLoTmq+0tM82kxVYw
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -33,8 +33,8 @@ __PACKAGE__->set_primary_key("build", "productnr");
|
|||
__PACKAGE__->belongs_to("build", "Hydra::Schema::Builds", { id => "build" });
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kzQauEWWXur6WilY/1LcfA
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gmWXPz3CSN4WOUTrcxXzQw
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -29,8 +29,8 @@ __PACKAGE__->set_primary_key("id");
|
|||
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" });
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:85sz3phT3arumqXladRtMQ
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7iNqQ1Q912X3/TiDPk/RWA
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -70,8 +70,8 @@ __PACKAGE__->has_many(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1fnKUzCj0eAt4HWx0UB3SA
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:u9AGxpJIQFY0RAILvnaIKA
|
||||
|
||||
__PACKAGE__->has_many(dependents => 'Hydra::Schema::Buildinputs', 'dependency');
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ __PACKAGE__->set_primary_key("id");
|
|||
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" });
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+a/kUdHtdjxdAOBSWdUsVA
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cqaeltO0pjpVPv2Ah54SQg
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -35,8 +35,8 @@ __PACKAGE__->set_primary_key("id", "stepnr");
|
|||
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" });
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FYosIfp2O9OAolXdzalK+Q
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dJac1j1n7A2sQBrfgdLdYg
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -22,8 +22,8 @@ __PACKAGE__->add_columns(
|
|||
__PACKAGE__->set_primary_key("srcpath", "sha256hash");
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KhMAz8E3CDxG2D+zleQEFw
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5sHH9qbQ5WtUf2oRjXbwuw
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -20,8 +20,8 @@ __PACKAGE__->add_columns(
|
|||
__PACKAGE__->set_primary_key("uri", "revision");
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:S62F6Z2wPT/+NoIApQcBmQ
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:k1xO/rt0fxTjvtkPY/Jwfw
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -31,8 +31,8 @@ __PACKAGE__->belongs_to(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6N8dRzQi9IYgP5F2rbDtWg
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:B8hAt4GezVJ1/uo4ZQ3Q2g
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -43,8 +43,8 @@ __PACKAGE__->has_many(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QeB1Zh2L3q81y5j+fLcazw
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4ev1n8miWroPWPRoQBc0cA
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -48,8 +48,8 @@ __PACKAGE__->has_many(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6aZCPgci+SLJuoGHcR3boA
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7kRl30K427lecYirFGBxew
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -30,8 +30,8 @@ __PACKAGE__->has_many(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 18:59:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:meEhwhiWsywgQlrkwOz48A
|
||||
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-11-25 19:24:09
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZBkLod0Yw87pgQGAEuk7Zg
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
@ -162,6 +162,11 @@ sub fetchInput {
|
|||
$$inputInfo{$input->name} = {type => $type, value => $alt->value};
|
||||
}
|
||||
|
||||
elsif ($type eq "boolean") {
|
||||
die unless defined $alt->value && ($alt->value eq "true" || $alt->value eq "false");
|
||||
$$inputInfo{$input->name} = {type => $type, value => $alt->value};
|
||||
}
|
||||
|
||||
else {
|
||||
die "input `" . $input->name . "' has unknown type `$type'";
|
||||
}
|
||||
|
@ -285,8 +290,10 @@ sub checkJobAlternatives {
|
|||
push @newArgs, "--arg", $argName,
|
||||
"{path = builtins.storePath " . $inputInfo->{$argName}->{storePath} . ";" .
|
||||
" rev = \"" . $inputInfo->{$argName}->{revision} . "\";}";
|
||||
} elsif (defined $inputInfo->{$argName}->{value}) {
|
||||
} elsif ($inputInfo->{$argName}->{type} eq "string") {
|
||||
push @newArgs, "--argstr", $argName, $inputInfo->{$argName}->{value};
|
||||
} elsif ($inputInfo->{$argName}->{type} eq "boolean") {
|
||||
push @newArgs, "--arg", $argName, $inputInfo->{$argName}->{value};
|
||||
}
|
||||
checkJobAlternatives(
|
||||
$project, $jobset, $inputInfo, $nixExprPath,
|
||||
|
@ -382,7 +389,10 @@ sub checkJobSet {
|
|||
$project, $jobset, {}, $nixExprPath,
|
||||
$jobName, $jobExpr, [], \@argsNeeded, 0);
|
||||
};
|
||||
warn $@ if $@;
|
||||
if ($@) {
|
||||
print "error checking job ", $jobName, ": $@";
|
||||
setJobsetError($jobset, $@);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
<td>
|
||||
[% IF input.type == "build" %]
|
||||
<a href="[% c.uri_for('/build' input.dependency.id) %]">Job <tt>[% input.dependency.project.name %]:[% input.dependency.attrname %]</tt> build [% input.dependency.id %]</a>
|
||||
[% ELSIF input.type == "string" %]
|
||||
[% ELSIF input.type == "string" || input.type == "boolean" %]
|
||||
<tt>"[% input.value %]"</tt>
|
||||
[% ELSE %]
|
||||
<tt>[% input.uri %]</tt>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
, "cvs" = "CVS checkout"
|
||||
, "tarball" = "Download of a tarball"
|
||||
, "string" = "String value"
|
||||
, "boolean" = "Boolean"
|
||||
, "path" = "Local path"
|
||||
, "build" = "Build output"
|
||||
}
|
||||
|
|
|
@ -26,9 +26,13 @@
|
|||
|
||||
|
||||
[% BLOCK renderInputAlt %]
|
||||
[% IF edit %]<button type="button" onclick='$(this).parents(".inputalt").remove()'><img src="/static/images/failure.gif" alt="Delete value" /></button>[% END -%]
|
||||
[% IF edit %]
|
||||
<button type="button" onclick='$(this).parents(".inputalt").remove()'><img src="/static/images/failure.gif" alt="Delete value" /></button>
|
||||
[% INCLUDE maybeEditString param=param value=alt.value %]
|
||||
[% IF edit %]<br />[% END %]
|
||||
<br />
|
||||
[% ELSE %]
|
||||
[% INCLUDE maybeEditString param=param value=alt.value %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ create table JobsetInputs (
|
|||
project text not null,
|
||||
jobset text not null,
|
||||
name text not null,
|
||||
type text not null, -- "svn", "cvs", "path", "uri", "string"
|
||||
type text not null, -- "svn", "cvs", "path", "uri", "string", "boolean"
|
||||
primary key (project, jobset, name),
|
||||
foreign key (project, jobset) references Jobsets(project, name) on delete cascade -- ignored by sqlite
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue