Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pretend success option #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
<artifactId>parameterized-trigger</artifactId>
<version>2.25</version>
</dependency>


<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@
if ( lastBuild == null ) {
return StatusJob.DOESNT_CONTAINS_LASTBUILD;
}
if ( lastBuild.getResult() != null && lastBuild.getResult().isWorseThan(Result.UNSTABLE) ) {

Check warning on line 190 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.MultiJobBuilder.getScmChange(AbstractProject, PhaseJobsConfig, AbstractBuild, BuildListener, Launcher) due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
return StatusJob.LASTBUILD_RESULT_IS_WORSE_THAN_UNSTABLE;
}
if ( !lastBuild.getWorkspace().exists() ) {

Check warning on line 193 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.MultiJobBuilder.getScmChange(AbstractProject, PhaseJobsConfig, AbstractBuild, BuildListener, Launcher) due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
return StatusJob.WORKSPACE_IS_EMPTY;
}
if ( subjob.poll(listener).hasChanges() ) {
Expand Down Expand Up @@ -238,7 +238,7 @@
}
if(willResumeBuild) {
for (SubBuild subBuild : prevBuild.getSubBuilds()) {
Item item = Jenkins.getInstance().getItem(subBuild.getJobName(), prevBuild.getParent(),

Check warning on line 241 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.MultiJobBuilder.perform(AbstractBuild, Launcher, BuildListener) due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
AbstractProject.class);
if (item instanceof AbstractProject) {
AbstractProject childProject = (AbstractProject) item;
Expand Down Expand Up @@ -287,7 +287,7 @@
AbstractProject subJob = phaseSubJob.job;

// To be coherent with final results, we need to do this here.
PhaseJobsConfig phaseConfig = phaseSubJobs.get(phaseSubJob);

Check warning on line 290 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

WMI_WRONG_MAP_ITERATOR

NORMAL: com.tikal.jenkins.plugins.multijob.MultiJobBuilder.perform(AbstractBuild, Launcher, BuildListener) makes inefficient use of keySet iterator instead of entrySet iterator
Raw output
<p> This method accesses the value of a Map entry, using a key that was retrieved from a keySet iterator. It is more efficient to use an iterator on the entrySet of the map, to avoid the Map.get(key) lookup.</p>
StatusJob jobStatus = getScmChange(subJob,phaseConfig,multiJobBuild ,listener,launcher );
listener.getLogger().println(jobStatus.getMessage(subJob));
// We are ready to inject vars about scm status. It is useful at condition level.
Expand Down Expand Up @@ -359,7 +359,7 @@
if (resume) {
SubBuild subBuild = resumeBuildMap.get(subJob.getUrl());
if (null != subBuild) {
AbstractProject prj = Jenkins.getInstance().getItem(subBuild.getJobName(), multiJobBuild.getParent(),

Check warning on line 362 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.MultiJobBuilder.perform(AbstractBuild, Launcher, BuildListener) due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
AbstractProject.class);
AbstractBuild childBuild = prj.getBuildByNumber(subBuild.getBuildNumber());
MultiJobResumeControl childControl = new MultiJobResumeControl(childBuild);
Expand Down Expand Up @@ -410,7 +410,14 @@
}
} else {
AbstractBuild jobBuild = subTask.subJob.getBuildByNumber(subBuild.getBuildNumber());
updateSubBuild(multiJobBuild, thisProject, jobBuild, subBuild.getResult());
Result resultToUse;
if (!subTask.phaseConfig.isPretendSuccess()) {
resultToUse = subBuild.getResult();
} else {
listener.getLogger().println("Going to pretend success (instead of " + subBuild.getResult() +") for the subBuild.result of " + subTask.subJob.getDisplayName());
resultToUse = Result.SUCCESS;
}
updateSubBuild(multiJobBuild, thisProject, jobBuild, resultToUse);
}
}

Expand All @@ -422,8 +429,16 @@
if (subTask != null) {
resultCounter++;
if (subTask.result != null) {
jobResults.add(subTask.result);
phaseCounters.process(subTask.result);
//Possibly change the result to success if the pretendSuccess config was set
Result resultToUse;
if (!subTask.phaseConfig.isPretendSuccess()) {
resultToUse = subTask.result;
} else {
listener.getLogger().println("Going to pretend success (instead of " + subTask.result +") for the subTask.result of " + subTask.subJob.getDisplayName());
resultToUse = Result.SUCCESS;
}
jobResults.add(resultToUse);
phaseCounters.process(resultToUse);
checkPhaseTermination(subTask, subTasks, listener);
}
}
Expand Down Expand Up @@ -529,33 +544,41 @@
}
if (jobBuild != null && !finish) {
result = jobBuild.getResult();
reportFinish(listener, jobBuild, result);

Check warning on line 547 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.MultiJobBuilder$SubJobWorker.call() due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>

Result resultToUse;
if (!subTask.phaseConfig.isPretendSuccess()) {
resultToUse = result;
} else {
listener.getLogger().println("Going to pretend success (instead of " + result +") for the result of " + subTask.subJob.getDisplayName());
resultToUse = Result.SUCCESS;
}

if (result.isWorseOrEqualTo(Result.UNSTABLE) && result.isCompleteBuild() && subTask.phaseConfig.getEnableRetryStrategy()) {
if (isKnownRandomFailure(jobBuild)) {
if (retry <= maxRetries) {
listener.getLogger().println("Known failure detected, retrying this build. Try " + retry + " of " + maxRetries + ".");
updateSubBuild(subTask.multiJobBuild, multiJobProject, jobBuild, result, true);
updateSubBuild(subTask.multiJobBuild, multiJobProject, jobBuild, resultToUse, true);

subTask.generateFuture();
} else {
listener.getLogger().println("Known failure detected, max retries (" + maxRetries + ") exceeded.");
updateSubBuild(subTask.multiJobBuild, multiJobProject, jobBuild, result);
updateSubBuild(subTask.multiJobBuild, multiJobProject, jobBuild, resultToUse);
}
} else {
listener.getLogger().println("Failed the build, the failure doesn't match the rules.");
updateSubBuild(subTask.multiJobBuild, multiJobProject, jobBuild, result);
updateSubBuild(subTask.multiJobBuild, multiJobProject, jobBuild, resultToUse);
finish = true;
}
} else {
updateSubBuild(subTask.multiJobBuild, multiJobProject, jobBuild, result);
updateSubBuild(subTask.multiJobBuild, multiJobProject, jobBuild, resultToUse);
finish = true;
}

ChangeLogSet<Entry> changeLogSet = jobBuild.getChangeSet();
subTask.multiJobBuild.addChangeLogSet(changeLogSet);
addBuildEnvironmentVariables(subTask.multiJobBuild, jobBuild, listener);
subTask.result = result;
subTask.result = resultToUse;
}
}

Expand Down Expand Up @@ -710,6 +733,10 @@

protected boolean checkPhaseTermination(SubTask subTask, List<SubTask> subTasks, final BuildListener listener) {
try {
if (subTask.phaseConfig.isPretendSuccess()) {
listener.getLogger().println("Pretend success is enabled for" + subTask.subJob.getDisplayName() + "; not going to terminate phase");
return false;
}
KillPhaseOnJobResultCondition killCondition = subTask.phaseConfig.getKillPhaseOnJobResultCondition();
if (killCondition.equals(KillPhaseOnJobResultCondition.NEVER) && subTask.result != Result.ABORTED) {
return false;
Expand All @@ -730,7 +757,7 @@
}

private void reportStart(BuildListener listener, AbstractProject subJob) {
listener.getLogger().printf(

Check warning on line 760 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

VA_FORMAT_STRING_USES_NEWLINE

NORMAL: Format string should use %n rather than \n in com.tikal.jenkins.plugins.multijob.MultiJobBuilder.reportStart(BuildListener, AbstractProject)
Raw output
<p> This format string includes a newline character (\n). In format strings, it is generally preferable to use %n, which will produce the platform-specific line separator. </p>
"Starting build job %s.\n",
HyperlinkNote.encodeTo('/' + subJob.getUrl(),
subJob.getFullName()));
Expand All @@ -754,7 +781,7 @@
MultiJobProject multiJobProject, PhaseJobsConfig phaseConfig) {
SubBuild subBuild = new SubBuild(multiJobProject.getName(),
multiJobBuild.getNumber(), phaseConfig.getJobName(), 0,
phaseName, null, BallColor.NOTBUILT.getImage(), "not built", "", null);

Check warning on line 784 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_PARAM_DEREF_NONVIRTUAL

HIGH: Non-virtual method call in com.tikal.jenkins.plugins.multijob.MultiJobBuilder.updateSubBuild(MultiJobBuild, MultiJobProject, PhaseJobsConfig) passes null for non-null parameter of new MultiJobBuild$SubBuild(String, int, String, int, String, Result, String, String, String, AbstractBuild)
Raw output
<p> A possibly-null value is passed to a non-null method parameter. Either the parameter is annotated as a parameter that should always be non-null, or analysis has shown that it will always be dereferenced. </p>
multiJobBuild.addSubBuild(subBuild);
}

Expand Down Expand Up @@ -824,7 +851,7 @@
String jobNameSafe = jobName.replaceAll("[^A-Za-z0-9]", "_")
.toUpperCase();
String buildNumber = Integer.toString(jobBuild.getNumber());
String buildResult = jobBuild.getResult().toString();

Check warning on line 854 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.MultiJobBuilder.addBuildEnvironmentVariables(MultiJobBuild, AbstractBuild, BuildListener) due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
String buildName = jobBuild.getDisplayName().toString();

// If the job is run a second time, store the first job's number and result with unique keys
Expand Down Expand Up @@ -1178,13 +1205,13 @@
if (null != control) {
MultiJobBuild prevBuild = (MultiJobBuild) control.getRun();
for (SubBuild subBuild : prevBuild.getSubBuilds()) {
Item item = Jenkins.getInstance().getItem(subBuild.getJobName(), prevBuild.getParent(),

Check warning on line 1208 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.MultiJobBuilder.prebuild(Build, BuildListener) due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
AbstractProject.class);
if (item instanceof AbstractProject) {
AbstractProject childProject = (AbstractProject) item;
AbstractBuild childBuild = childProject.getBuildByNumber(subBuild.getBuildNumber());
if (null != childBuild) {
if (childBuild.getResult().equals(Result.FAILURE)) {

Check warning on line 1214 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.MultiJobBuilder.prebuild(Build, BuildListener) due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
resume = true;
}
}
Expand All @@ -1198,7 +1225,7 @@
Map<String, String> persistentEnvVars = new HashMap<String, String>();
for (String key : previousEnvVars.keySet()) {
if(key.startsWith(PERSISTENT_VARS_PREFIX)) {
persistentEnvVars.put(key, previousEnvVars.get(key));

Check warning on line 1228 in src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java

View check run for this annotation

ci.jenkins.io / SpotBugs

WMI_WRONG_MAP_ITERATOR

NORMAL: com.tikal.jenkins.plugins.multijob.MultiJobBuilder.prebuild(Build, BuildListener) makes inefficient use of keySet iterator instead of entrySet iterator
Raw output
<p> This method accesses the value of a Map entry, using a key that was retrieved from a keySet iterator. It is more efficient to use an iterator on the entrySet of the map, to avoid the Map.get(key) lookup.</p>
}
}
persistentEnvVars.put("RESUMED_BUILD", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
private boolean aggregatedTestResults;
private boolean exposedSCM;
private boolean disableJob;
private boolean pretendSuccess;
private String parsingRulesPath;
private int maxRetries;
private boolean enableRetryStrategy;
Expand Down Expand Up @@ -133,6 +134,14 @@
this.disableJob = disableJob;
}

public boolean isPretendSuccess() {
return pretendSuccess;
}

public void setPretendSuccess(boolean pretendSuccess) {
this.pretendSuccess = pretendSuccess;
}

public KillPhaseOnJobResultCondition getKillPhaseOnJobResultCondition() {
return killPhaseOnJobResultCondition;
}
Expand Down Expand Up @@ -183,7 +192,7 @@
}

public Descriptor<PhaseJobsConfig> getDescriptor() {
return Hudson.getInstance().getDescriptorOrDie(getClass());

Check warning on line 195 in src/main/java/com/tikal/jenkins/plugins/multijob/PhaseJobsConfig.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.PhaseJobsConfig.getDescriptor() due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
}

public String getDisplayName() {
Expand All @@ -193,20 +202,20 @@
public PhaseJobsConfig(String jobName, String jobProperties,
boolean currParams, List<AbstractBuildParameters> configs,
KillPhaseOnJobResultCondition killPhaseOnJobResultCondition,
boolean disableJob, boolean enableRetryStrategy,
boolean disableJob, boolean pretendSuccess, boolean enableRetryStrategy,
String parsingRulesPath, int maxRetries, boolean enableCondition,
boolean abortAllJob, String condition, boolean buildOnlyIfSCMChanges,
boolean applyConditionOnlyIfNoSCMChanges) {
this(jobName, jobProperties, currParams, configs, killPhaseOnJobResultCondition,
disableJob, enableRetryStrategy, parsingRulesPath, maxRetries, enableCondition,
disableJob, pretendSuccess, enableRetryStrategy, parsingRulesPath, maxRetries, enableCondition,
abortAllJob, condition, buildOnlyIfSCMChanges, applyConditionOnlyIfNoSCMChanges, false);
}

@DataBoundConstructor
public PhaseJobsConfig(String jobName, String jobProperties,
boolean currParams, List<AbstractBuildParameters> configs,
KillPhaseOnJobResultCondition killPhaseOnJobResultCondition,
boolean disableJob, boolean enableRetryStrategy,
boolean disableJob, boolean pretendSuccess, boolean enableRetryStrategy,
String parsingRulesPath, int maxRetries, boolean enableCondition,
boolean abortAllJob, String condition, boolean buildOnlyIfSCMChanges,
boolean applyConditionOnlyIfNoSCMChanges, boolean aggregatedTestResults) {
Expand All @@ -215,6 +224,7 @@
this.currParams = currParams;
this.killPhaseOnJobResultCondition = killPhaseOnJobResultCondition;
this.disableJob = disableJob;
this.pretendSuccess = pretendSuccess;
this.configs = Util.fixNull(configs);
this.enableRetryStrategy = enableRetryStrategy;
this.maxRetries = maxRetries;
Expand Down Expand Up @@ -250,14 +260,14 @@
public List<Descriptor<AbstractBuildParameters>> getBuilderConfigDescriptors() {
return Hudson
.getInstance()
.<AbstractBuildParameters, Descriptor<AbstractBuildParameters>> getDescriptorList(

Check warning on line 263 in src/main/java/com/tikal/jenkins/plugins/multijob/PhaseJobsConfig.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.PhaseJobsConfig$DescriptorImpl.getBuilderConfigDescriptors() due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
AbstractBuildParameters.class);
}

public AutoCompletionCandidates doAutoCompleteJobName(
@QueryParameter String value) {
AutoCompletionCandidates c = new AutoCompletionCandidates();
for (String localJobName : Hudson.getInstance().getJobNames()) {

Check warning on line 270 in src/main/java/com/tikal/jenkins/plugins/multijob/PhaseJobsConfig.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.PhaseJobsConfig$DescriptorImpl.doAutoCompleteJobName(String) due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
if (localJobName.toLowerCase().startsWith(value.toLowerCase()))
c.add(localJobName);
}
Expand Down Expand Up @@ -322,7 +332,7 @@

private static AbstractProject getCurrentJob() {
String jobName = getCurrentJobName();
return (AbstractProject) Jenkins.getInstance().getItemByFullName(

Check warning on line 335 in src/main/java/com/tikal/jenkins/plugins/multijob/PhaseJobsConfig.java

View check run for this annotation

ci.jenkins.io / SpotBugs

NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE

NORMAL: Possible null pointer dereference in com.tikal.jenkins.plugins.multijob.PhaseJobsConfig$DescriptorImpl.getCurrentJob() due to return value of called method
Raw output
<p> The return value from a method is dereferenced without a null check, and the return value of that method is one that should generally be checked for null. This may lead to a <code>NullPointerException</code> when the code is executed. </p>
jobName);
}

Expand Down Expand Up @@ -355,7 +365,7 @@
}

public ParserRuleFile[] getParsingRulesGlobal() {
return parsingRulesGlobal;

Check warning on line 368 in src/main/java/com/tikal/jenkins/plugins/multijob/PhaseJobsConfig.java

View check run for this annotation

ci.jenkins.io / SpotBugs

EI_EXPOSE_REP

NORMAL: com.tikal.jenkins.plugins.multijob.PhaseJobsConfig$DescriptorImpl.getParsingRulesGlobal() may expose internal representation by returning PhaseJobsConfig$DescriptorImpl.parsingRulesGlobal
Raw output
<p> Returning a reference to a mutable object value stored in one of the object's fields exposes the internal representation of the object.&nbsp; If instances are accessed by untrusted code, and unchecked changes to the mutable object would compromise security or other important properties, you will need to do something different. Returning a new copy of the object is better approach in many situations.</p>
}

@Override
Expand All @@ -373,7 +383,7 @@
TaskListener listener) {
ParametersAction action = build.getAction(ParametersAction.class);
List<ParameterValue> values = new ArrayList<ParameterValue>(action
.getParameters().size());

Check warning on line 386 in src/main/java/com/tikal/jenkins/plugins/multijob/PhaseJobsConfig.java

View check run for this annotation

ci.jenkins.io / SpotBugs

RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE

NORMAL: Nullcheck of action at line 386 of value previously dereferenced in com.tikal.jenkins.plugins.multijob.PhaseJobsConfig.getJobParameters(AbstractBuild, TaskListener)
Raw output
<p> A value is checked here to see whether it is null, but this value can't be null because it was previously dereferenced and if it were null a null pointer exception would have occurred at the earlier dereference. Essentially, this code and the previous dereference disagree as to whether this value is allowed to be null. Either the check is redundant or the previous dereference is erroneous.</p>
if (action != null) {
for (ParameterValue value : action.getParameters())
// FileParameterValue is currently not reusable, so omit these:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<f:entry title="Disable" field="disableJob">
<f:checkbox name="disableJob" checked="${instance.disableJob}" default="false"/>
</f:entry>
<f:entry title="Pretend Success" field="pretendSuccess" help="/plugin/jenkins-multijob-plugin/help-pretendSuccess.html">
<f:checkbox name="pretendSuccess" checked="${instance.pretendSuccess}" default="false"/>
</f:entry>
<f:entry title="Abort all other job" field="abortAllJob" help="/plugin/jenkins-multijob-plugin/help-abort.html">
<f:checkbox name="abortAllJob" checked="${instance.abortAllJob}" default="true"/>
</f:entry>
Expand Down
4 changes: 4 additions & 0 deletions src/main/webapp/help-pretendSuccess.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
Ignore the result of this job and pretend that sucess was returned.<br/>
Great for adding out a new phase job in production without having it break functionality
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public void run(JenkinsRule j) throws Throwable {
final MultiJobProject multi = j.jenkins.createProject(MultiJobProject.class, "MultiTop");

// create 'FirstPhase' containing job 'free'
PhaseJobsConfig firstPhase = new PhaseJobsConfig("free", null, true, null, KillPhaseOnJobResultCondition.NEVER, false, false, "", 0, false, false, "",false, false);
PhaseJobsConfig firstPhase = new PhaseJobsConfig("free", null, true, null, KillPhaseOnJobResultCondition.NEVER, false, false, false, "", 0, false, false, "",false, false);
List<PhaseJobsConfig> configTopList = new ArrayList<PhaseJobsConfig>();
configTopList.add(firstPhase);
MultiJobBuilder firstPhaseBuilder = new MultiJobBuilder("FirstPhase", configTopList, ContinuationCondition.SUCCESSFUL, MultiJobBuilder.ExecutionType.PARALLEL);


// create 'SecondPhase' containing job 'free2'
PhaseJobsConfig secondPhase = new PhaseJobsConfig("free2", null, true, null, KillPhaseOnJobResultCondition.NEVER, false, false, "", 0, false, false, "",false, false);
PhaseJobsConfig secondPhase = new PhaseJobsConfig("free2", null, true, null, KillPhaseOnJobResultCondition.NEVER, false, false, false, "", 0, false, false, "",false, false);
List<PhaseJobsConfig> configTopList2 = new ArrayList<PhaseJobsConfig>();
configTopList.add(secondPhase);
MultiJobBuilder secondPhaseBuilder = new MultiJobBuilder("SecondPhase", configTopList2, ContinuationCondition.SUCCESSFUL, MultiJobBuilder.ExecutionType.PARALLEL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testNoParameters() throws Exception {
AbstractProject projectB = createTriggeredProject(null);
MultiJobBuild mjb =createTriggeringBuild(null);

PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, null, KillPhaseOnJobResultCondition.NEVER, false, false, "", 0, false, false, "" , true, false);
PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, null, KillPhaseOnJobResultCondition.NEVER, false, false, false, "", 0, false, false, "" , true, false);

List<Action> actions = pjc.getActions(mjb, TaskListener.NULL, projectB, true);
// check single ParametersAction created
Expand All @@ -93,7 +93,7 @@ public void testDefaultParameters() throws Exception {
AbstractProject projectB = createTriggeredProject(DEFAULT_KEY_VALUES);
MultiJobBuild mjb = createTriggeringBuild(null);

PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, null, KillPhaseOnJobResultCondition.NEVER, false, false, "", 0, false, false, "",false, false);
PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, null, KillPhaseOnJobResultCondition.NEVER, false, false, false, "", 0, false, false, "",false, false);
List<Action> actions = pjc.getActions(mjb, TaskListener.NULL, projectB, true);

// check single ParametersAction created
Expand All @@ -113,7 +113,7 @@ public void testCurrentDefaultParameters() throws Exception {
AbstractProject projectB = createTriggeredProject(DEFAULT_KEY_VALUES);
MultiJobBuild mjb = createTriggeringBuild(createParametersAction(CURRENT_KEY_VALUES));

PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, null, KillPhaseOnJobResultCondition.NEVER, false, false, "", 0, false, false, "" , false, false);
PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, null, KillPhaseOnJobResultCondition.NEVER, false, false, false, "", 0, false, false, "" , false, false);

List<Action> actions = pjc.getActions(mjb, TaskListener.NULL, projectB, true);

Expand All @@ -136,7 +136,7 @@ public void testCurrentOverridesDefaultParameters() throws Exception {
AbstractProject projectB = createTriggeredProject(DEFAULT_KEY_VALUES);
MultiJobBuild mjb = createTriggeringBuild(createParametersAction(OVERRIDES_KEY_VALUES));

PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, null, KillPhaseOnJobResultCondition.NEVER, false, false, "", 0, false, false, "",false, false);
PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, null, KillPhaseOnJobResultCondition.NEVER, false, false, false, "", 0, false, false, "",false, false);

List<Action> actions = pjc.getActions(mjb, TaskListener.NULL, projectB, true);

Expand All @@ -158,7 +158,7 @@ public void testCurrentIgnoredDefaultParameters() throws Exception {
AbstractProject projectB = createTriggeredProject(DEFAULT_KEY_VALUES);
MultiJobBuild mjb = createTriggeringBuild(createParametersAction(OVERRIDES_KEY_VALUES));

PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, null, KillPhaseOnJobResultCondition.NEVER, false, false, "", 0, false, false, "",false, false);
PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, null, KillPhaseOnJobResultCondition.NEVER, false, false, false, "", 0, false, false, "",false, false);
List<Action> actions = pjc.getActions(mjb, TaskListener.NULL, projectB, false);

// check single ParametersAction created
Expand All @@ -181,7 +181,7 @@ public void testConfigsDefaultParameters() throws Exception {
configs.add(new TestParametersConfig());
configs.add(new TestParametersConfig(OVERRIDES_KEY_VALUES));

PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, configs, KillPhaseOnJobResultCondition.NEVER, false, false, "", 0, false, false, "",false, false);
PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, configs, KillPhaseOnJobResultCondition.NEVER, false, false, false, "", 0, false, false, "",false, false);


List<Action> actions = pjc.getActions(mjb, TaskListener.NULL, projectB, true);
Expand Down Expand Up @@ -210,7 +210,7 @@ public void testCurrentConfigsDefaultParameters() throws Exception {
configs.add(new TestParametersConfig());
configs.add(new TestParametersConfig(CONFIG_OVERRIDES_KEY_VALUES));

PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, configs, KillPhaseOnJobResultCondition.NEVER, false, false, "", 0, false, false, "",false, false);
PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, configs, KillPhaseOnJobResultCondition.NEVER, false, false, false, "", 0, false, false, "",false, false);

List<Action> actions = pjc.getActions(mjb, TaskListener.NULL, projectB, true);

Expand Down Expand Up @@ -239,7 +239,7 @@ public void testNotCurrentConfigsDefaultParameters() throws Exception {
configs.add(new TestParametersConfig());
configs.add(new TestParametersConfig(CONFIG_OVERRIDES_KEY_VALUES));

PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, configs, KillPhaseOnJobResultCondition.NEVER, false, false, "", 0, false, false, "",false, false);
PhaseJobsConfig pjc = new PhaseJobsConfig("dummy", "", true, configs, KillPhaseOnJobResultCondition.NEVER, false, false, false, "", 0, false, false, "",false, false);


List<Action> actions = pjc.getActions(mjb, TaskListener.NULL, projectB, false);
Expand Down
Loading