Skip to content
Permalink
Browse files
[FIXED JENKINS-12799]
Do not allow non-active promotion process to promote a build
  • Loading branch information
kohsuke committed Oct 30, 2012
1 parent 932a018 commit 2f054ac0702768e0091a23c7a492d5bab475c1ae
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/main/java/hudson/plugins/promoted_builds/PromotionProcess.java
@@ -299,6 +299,9 @@ public boolean considerPromotion(AbstractBuild<?,?> build) throws IOException {
* null if the build was not promoted, otherwise Future that kicks in when the build is completed.
*/
public Future<Promotion> considerPromotion2(AbstractBuild<?,?> build) throws IOException {
if (!isActive())
return null; // not active

PromotedBuildAction a = build.getAction(PromotedBuildAction.class);

// if it's already promoted, no need to do anything.
@@ -461,6 +464,10 @@ public String getShortUrl() {
return "";
}

public boolean isActive() {
return !isDisabled();
}

@Extension
public static class DescriptorImpl extends Descriptor<PromotionProcess> {
@Override

1 comment on commit 2f054ac

@jglick

This comment has been minimized.

Copy link
Member

@jglick jglick commented on 2f054ac Oct 31, 2012

Why introduce the new method, producing a confusing double negative? Would seem to simpler to just write

if (isDisabled()) return null;
Please sign in to comment.