Accessing workspace after job is complete

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing workspace after job is complete

Tal Yanai
Hi,

Suppose the Java plugin I'm writing is producing a report file.  Within its node (slave) I will use filePath.child(fileOnDiskPath) to persist that report into that node workspace.

What happened now when I want to reference that report once the build is over?  How do I gain access to that node's location now that the job is over?

If I do run.getExecutor().getCurrentWorkspace() for getting the FilePath, I'm getting NullPointerException Obviously as nothing is running.

Is something wrong in this methodology?

Thanks,

Tal.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/6ec4c472-0b0c-4008-a0e8-f379494725e1n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Accessing workspace after job is complete

Ulli Hafner
Am 10.11.2020 um 19:52 schrieb Tal Yanai <[hidden email]>:

Hi,

Suppose the Java plugin I'm writing is producing a report file.  Within its node (slave) I will use filePath.child(fileOnDiskPath) to persist that report into that node workspace.

What happened now when I want to reference that report once the build is over? 

From where do you want to access the file? UI, file system, web service?

How do I gain access to that node's location now that the job is over?


This is not possible, the node may be already destroyed or cleaned. 

If I do run.getExecutor().getCurrentWorkspace() for getting the FilePath, I'm getting NullPointerException Obviously as nothing is running.

Is something wrong in this methodology?


Yes, your planned approach will never work. You need to register a new https://javadoc.jenkins-ci.org/hudson/model/Action.html that will be attached to the build. This action can serialize all information you need for retrieval and is visible in the UI. Or simply copy the file to the master build folder.


Thanks,

Tal.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/6ec4c472-0b0c-4008-a0e8-f379494725e1n%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/F94F0ECE-321E-4928-A4E9-E4E77871DA5D%40gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Accessing workspace after job is complete

Tal Yanai
In reply to this post by Tal Yanai
Thank you,

Coping it from the node into the master will be the best approach. 

How do I achieve that (copying) if the node and master don’t share NFS?

Thanks,

Tal. 

On Tue, 10 Nov 2020 at 20:52 Tal Yanai <[hidden email]> wrote:
Hi,

Suppose the Java plugin I'm writing is producing a report file.  Within its node (slave) I will use filePath.child(fileOnDiskPath) to persist that report into that node workspace.

What happened now when I want to reference that report once the build is over?  How do I gain access to that node's location now that the job is over?

If I do run.getExecutor().getCurrentWorkspace() for getting the FilePath, I'm getting NullPointerException Obviously as nothing is running.

Is something wrong in this methodology?

Thanks,

Tal.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/M6gDEaUMaDk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/6ec4c472-0b0c-4008-a0e8-f379494725e1n%40googlegroups.com.
--
Thanks, Tal.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAFrc0SyGOKTUqB8t%3DHCxHN2fk%3DB970tLeH2f8MnLf5EOT8g2PA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Accessing workspace after job is complete

Jesse Glick-4
On Tue, Nov 10, 2020 at 2:56 PM Tal Yanai <[hidden email]> wrote:
> How do I achieve that (copying) if the node and master don’t share NFS?

Check Javadoc of `FilePath`. Numerous plugins defining `Publisher`s do this.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2hcOt9-%2B58DEGP2h6bv_dTxOaMW8n%3D%2BEbCenw8-C4%3DJQ%40mail.gmail.com.