[ 
https://issues.jenkins-ci.org/browse/JENKINS-12982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160407#comment-160407
 ] 

cjo9900 commented on JENKINS-12982:
-----------------------------------

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)

                
> Run conditions should be passed Launcher object
> -----------------------------------------------
>
>                 Key: JENKINS-12982
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-12982
>             Project: Jenkins
>          Issue Type: Improvement
>          Components: run-condition
>            Reporter: cjo9900
>            Assignee: bap
>
> 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) 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to