* 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")