-
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)
[JENKINS-12982] Run conditions should be passed Launcher object
Assignee | Original: bap [ bap ] | New: cjo9900 [ cjo9900 ] |
Resolution | New: Not A Defect [ 7 ] | |
Status | Original: Open [ 1 ] | New: Resolved [ 5 ] |
Assignee | Original: cjo9900 [ cjo9900 ] | New: bap [ bap ] |
Assignee | Original: bap [ bap ] | New: cjo9900 [ cjo9900 ] |
Workflow | Original: JNJira [ 143442 ] | New: JNJira + In-Review [ 190555 ] |
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)