* 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 $description = trim $c->request->params->{"job-$baseName-description"};
my $attrs = trim $c->request->params->{"job-$baseName-attrs"}; 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( $releaseSet->releasesetjobs->create(
{ job => $name { jobset => $jobsetName
, job => $jobName
, description => $description , description => $description
, attrs => $attrs , attrs => $attrs
, isprimary => $c->request->params->{"primary"} eq $baseName ? 1 : 0 , isprimary => $c->request->params->{"primary"} eq $baseName ? 1 : 0

View file

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

View file

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

View file

@ -43,7 +43,7 @@ create table BuildSchedulingInfo (
logfile text, -- if busy, the path of the logfile 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 startTime integer, -- if busy, time we started
@ -269,6 +269,8 @@ create table Jobs (
firstEvalTime integer, -- first time the scheduler saw this job firstEvalTime integer, -- first time the scheduler saw this job
lastEvalTime integer, -- last 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), primary key (project, jobset, name),
foreign key (project) references Projects(name) on delete cascade, -- ignored by sqlite 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 foreign key (project, jobset) references Jobsets(project, name) on delete cascade -- ignored by sqlite