You can get the Workspace from the run object by doing
run.getExecutor().getCurrentWorkspace().

Since you're a build wrapper you have a footprint just after checkout of
workspace....so you should have a workspace at that point in the run object.


[image: ____________________________________________________________]
Mads Nielsen
Consultant
m...@praqma.net
+45 50 98 18 09 <+45%2050%2098%2018%2009>
Skype: inkspot
Praqma
www.praqma.com
Allerød Stationsvej 4
DK-3450 Allerød
+45 36 77 27 62 <+45%203677%202762>

On Fri, Aug 28, 2015 at 6:20 AM, Vinodhini Vijay <vinodhini.vi...@gmail.com>
wrote:

>
> Hello All,
>
> I would like to get the workspace of the Run object. To make workflow
> compatible, my custom build wrapper class extends SimpleBuildWrapper.
>
> I  had overridden the method :
>
> public void setUp(Context context, *Run*<?, ?> run, FilePath workspace,
> Launcher launcher, TaskListener listener, EnvVars initialEnvironment)
>             throws IOException, InterruptedException
>
> But, how to get the workspace directory location from the *Run *object?
> (As I have to read some file within workspace)
>
> I tried to typecast to AbstractBuild, but during build I got
> ClassCastException
>
> java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowRun 
> cannot be cast to hudson.model.AbstractBuild
>
> My Workflow code was:
>
> node{
> wrap([$class: 'MyCustomBuildWrapper']) {
>    print ('Hello')
> }
> }
>
>
> Also, after workflow build is completed, will the workspace gets deleted?
> (As, I couldn't find the workspace folder in my Jenkins home (Also couldn't
> find Workspace Icon/link in Jenkins GUI) after the build completes)
>
> Or will the workspace gets created only after SCM checkout?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/eccdf524-e7a2-4eb2-bba7-839b9a062cc7%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/eccdf524-e7a2-4eb2-bba7-839b9a062cc7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAFariuu0t6koK0ENYmKRAzqTsZsD0wZBr%3D%2Bjy13F3hhqrb2aXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to