Skip to content

Commit

Permalink
[FIXED JENKINS-12799]
Browse files Browse the repository at this point in the history
Do not allow non-active promotion process to promote a build
  • Loading branch information
kohsuke committed Oct 30, 2012
1 parent 932a018 commit 2f054ac
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -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.
Expand Down Expand Up @@ -461,6 +464,10 @@ public String getShortUrl() {
return "";
}

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

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

1 comment on commit 2f054ac

@jglick
Copy link
Member

@jglick jglick commented on 2f054ac Oct 31, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.