Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-17955] fix job (full)Name comparison
  • Loading branch information
ndeloof committed May 28, 2013
1 parent 95e21a1 commit 063a50b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Expand Up @@ -42,7 +42,7 @@ public String getProcess() {
}

public boolean appliesTo(PromotionProcess proc) {
return proc.getName().equals(process) && proc.getParent().getOwner().getFullDisplayName().equals(jobName);
return proc.getName().equals(process) && proc.getParent().getOwner().getFullName().equals(jobName);
}

public void consider(Promotion p) {
Expand Down
Expand Up @@ -117,17 +117,24 @@ public List<AbstractProject<?,?>> getJobList(ItemGroup context) {
return r;
}

public boolean contains(ItemGroup ctx, AbstractProject<?,?> job) {
// quick rejection test
if(!jobs.contains(job.getName())) return false;

String name = job.getFullName();
for (AbstractProject<?, ?> project : getJobList(ctx)) {
if (project.getFullName().equals(name)) return true;
}
return false;
}


/**
* Short-cut for {@code getJobList().contains(job)}.
* @deprecated use {@link #contains(hudson.model.ItemGroup, hudson.model.AbstractProject)}
*/
public boolean contains(AbstractProject<?,?> job) {
if(!jobs.contains(job.getFullName())) return false; // quick rejection test

for (String name : Util.tokenize(jobs,",")) {
if(name.trim().equals(job.getFullName()))
return true;
}
return false;
return contains(Jenkins.getInstance(), job);
}

public static final class Badge extends PromotionBadge {
Expand Down Expand Up @@ -214,7 +221,7 @@ public void onCompleted(AbstractBuild<?,?> build, TaskListener listener) {
for (PromotionCondition cond : p.conditions) {
if (cond instanceof DownstreamPassCondition) {
DownstreamPassCondition dpcond = (DownstreamPassCondition) cond;
if(dpcond.contains(build.getParent())) {
if(dpcond.contains(j.getParent(), build.getParent())) {
considerPromotion = true;
break;
}
Expand Down

0 comments on commit 063a50b

Please sign in to comment.