* Release sets: need to include the jobset name to disambiguate

between jobs with the same name from different jobsets (e.g. trunk
  vs. branch).
This commit is contained in:
Eelco Dolstra 2009-03-14 22:34:22 +00:00
parent 7c7c43335d
commit 4404800ad8
4 changed files with 18 additions and 6 deletions

View file

@ -117,10 +117,20 @@ sub updateReleaseSet {
my $description = trim $c->request->params->{"job-$baseName-description"};
my $attrs = trim $c->request->params->{"job-$baseName-attrs"};
die "Invalid job name: $name" unless $name =~ /^\w+$/;
$name =~ /^(\w+):(\w+)$/ or error($c, "Invalid job name: $name");
my $jobsetName = $1;
my $jobName = $2;
error($c, "Jobset `$jobsetName' doesn't exist.")
unless $releaseSet->project->jobsets->find({name => $jobsetName});
# !!! We could check whether the job exists, but that would
# require the scheduler to have seen the job, which may not be
# the case.
$releaseSet->releasesetjobs->create(
{ job => $name
{ jobset => $jobsetName
, job => $jobName
, description => $description
, attrs => $attrs
, isprimary => $c->request->params->{"primary"} eq $baseName ? 1 : 0

View file

@ -124,7 +124,7 @@ sub attrsToSQL {
sub getPrimaryBuildsForReleaseSet {
my ($project, $primaryJob) = @_;
my @primaryBuilds = $project->builds->search(
{ job => $primaryJob->get_column('job'), finished => 1 },
{ jobset => $primaryJob->get_column('jobset'), job => $primaryJob->get_column('job'), finished => 1 },
{ join => 'resultInfo', order_by => "timestamp DESC"
, '+select' => ["resultInfo.releasename"], '+as' => ["releasename"]
, where => \ attrsToSQL($primaryJob->attrs, "me.id")
@ -154,7 +154,7 @@ sub getRelease {
# as input. If there are multiple, prefer successful
# ones, and then oldest. !!! order_by buildstatus is hacky
($thisBuild) = $primaryBuild->dependentBuilds->search(
{ job => $job->get_column('job'), finished => 1 },
{ jobset => $job->get_column('jobset'), job => $job->get_column('job'), finished => 1 },
{ join => 'resultInfo', rows => 1
, order_by => ["buildstatus", "timestamp"]
, where => \ attrsToSQL($job->attrs, "build.id")

View file

@ -14,7 +14,7 @@
</td>
<td><input type="radio" id="[% "$baseName-primary" %]" name="primary" [% IF job.isprimary %]
checked="checked" [% END %] [% HTML.attributes(value => "$n") %] /></td>
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-name", name => "$baseName-name", value => job.job) %] /></td>
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-name", name => "$baseName-name", value => "$job.jobset:$job.job") %] /></td>
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-description", name => "$baseName-description", value => job.description) %] /></td>
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-attrs", name => "$baseName-attrs", value => job.attrs) %] /></td>
</tr>

View file

@ -43,7 +43,7 @@ create table BuildSchedulingInfo (
logfile text, -- if busy, the path of the logfile
disabled integer not null default 0, -- true means hold this job until its re-enabled
disabled integer not null default 0,
startTime integer, -- if busy, time we started
@ -269,6 +269,8 @@ create table Jobs (
firstEvalTime integer, -- first time the scheduler saw this job
lastEvalTime integer, -- last time the scheduler saw this job
disabled integer not null default 0,
primary key (project, jobset, name),
foreign key (project) references Projects(name) on delete cascade, -- ignored by sqlite
foreign key (project, jobset) references Jobsets(project, name) on delete cascade -- ignored by sqlite