Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #76 from hagzag/master
Fix JENKINS-30906 -> Restore build on scm changes logic
  • Loading branch information
hagzag committed Nov 12, 2015
2 parents 34eeddd + 170e19a commit 0c815f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Expand Up @@ -20,15 +20,12 @@
import hudson.model.queue.QueueTaskFuture;
import hudson.scm.ChangeLogSet;
import hudson.scm.ChangeLogSet.Entry;
import hudson.scm.SCM;
import hudson.scm.SCMRevisionState;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Builder;
import hudson.model.Executor;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
Expand All @@ -42,7 +39,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

import net.sf.json.JSONObject;
import jenkins.model.Jenkins;
Expand Down Expand Up @@ -134,7 +130,7 @@ public String expandToken(String toExpand, final AbstractBuild<?,?> build, final
* <li>If job is disabled at phase configuration
* then returns <code>{@link StatusJob#IS_DISABLED_AT_PHASECONFIG}</code>.</li>
* <li>If BuildOnlyIfSCMChanges is disabled
* then returns <code>{@link StatusJob#BUILD_ONLY_IF_SCM_CHANGES_DISABLED}</code>.</li>
* then returns <code>{@link StatusJob#BUILD_ON_SCM_CHANGES_ONLY}</code>.</li>
* <li>If 'Build Always' feature is enabled
* then returns <code>{@link StatusJob#BUILD_ALWAYS_IS_ENABLED}</code>.</li>
* <li>If job doesn't contains lastbuild
Expand All @@ -157,8 +153,8 @@ private StatusJob getScmChange(AbstractProject subjob,PhaseJobsConfig phaseConfi
if( phaseConfig.isDisableJob() ) {
return StatusJob.IS_DISABLED_AT_PHASECONFIG;
}
if ( !phaseConfig.isBuildOnlyIfSCMChanges() ){
return StatusJob.BUILD_ONLY_IF_SCM_CHANGES_DISABLED;
if ( phaseConfig.isBuildOnlyIfSCMChanges() ){
return StatusJob.BUILD_ON_SCM_CHANGES_ONLY;
}
final boolean buildAlways = Boolean.valueOf((String)(build.getBuildVariables().get(BUILD_ALWAYS_KEY)));

Expand Down
Expand Up @@ -40,7 +40,7 @@ public boolean isBuildable() {
/**
* The 'Build Only If Scm Changes' feature is disabled.
*/
BUILD_ONLY_IF_SCM_CHANGES_DISABLED("[%s] the 'build only if scm changes' feature is disabled.") {
BUILD_ON_SCM_CHANGES_ONLY("[%s] the 'build only if scm changes' feature is enabled.") {
@Override
public boolean isBuildable() {
return true;
Expand Down

1 comment on commit 0c815f7

@Brantone
Copy link

Choose a reason for hiding this comment

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

Not sure how, but something is messed up here!
Prior to upgrade, all job phases would run regardless of SCM ... now only would run if SCM change which is NOT the desired action, regardless of checkboxes.

Please sign in to comment.