-
Improvement
-
Resolution: Not A Defect
-
Major
-
None
Run conditions should be passed Launcher object so that the conditions may be allowed to run scripts within the build, e.g call a Shell or groovy script.
Current implementations are
public abstract boolean runPrebuild(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception;
public abstract boolean runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception;
These should be extended to
(final AbstractBuild<?, ?> build, final BuildListener listener, final Launcher launcher)
Having looked at the code in more places I see that there are several places that do not have a launcher present in the first place, i.e Dependency.shouldTriggerBuild(AbstractBuild build, TaskListener listener, List<Action> actions), Prebuild(AbstractBuild build, TaskListener listener)
However I think that a launcher can be created within the condition using the following
runPerform(final AbstractBuild<?, ?> build, final BuildListener listener) throws Exception;
{
Launcher launcher = build.getWorkspace().createLauncher(listener);
/* some action here */
}
This is untried code, but is a better alternative than altering all of the existing uses.
If this is a usable solution close the issue.
http://javadoc.jenkins-ci.org/hudson/model/AbstractBuild.html
http://javadoc.jenkins-ci.org/hudson/FilePath.html#createLauncher(hudson.model.TaskListener)