How to get workspace folder content of slave nodes?

1,120 views
Skip to first unread message

Xiaocheng Wang

unread,
Oct 8, 2018, 7:55:56 AM10/8/18
to Jenkins Developers
Hello Jenkins team,

We have deployed 1 Jenkins master node + 3 slave node. Jobs are building on different slaves, and generates some artifacts in the workspace. We wonder info there's a way (or API) to get the workspace folder content of EACH running build in realtime?

We tried to get this info by URL "http://<jenkins_host>:<jenkins_port>/job/<job_name>/ws", however it only displays workspace content of slave node which runs the latest build. (If 2 jobs are running in parallel on different slave, we are unable to get the first one's workspace content by that URL.)


Jesse Glick

unread,
Oct 8, 2018, 10:21:06 AM10/8/18
to Jenkins Dev
On Mon, Oct 8, 2018 at 7:55 AM 'Xiaocheng Wang' via Jenkins Developers
<jenkin...@googlegroups.com> wrote:
> We wonder info there's a way (or API) to get the workspace folder content of EACH running build in realtime?

Using the Java APIs, easily. Using HTTP APIs…depends. It would be
helpful if you clarified why you are posting to the dev list. Are you
writing a plugin, or something else?

Xiaocheng Wang

unread,
Oct 9, 2018, 12:53:51 AM10/9/18
to Jenkins Developers
Many thanks. The background is we have an Java application that calls Jenkins REST API to trigger builds. Due to project needs, we want that application to get the slave workspace folder content when build is running. 

So I think either calling a REST/HTTP API or developing a plugin ourselves may be the solution. But using REST/HTTP API (if there is) will be easy.

I originally posted in jenkinsci-users but haven't got an answer.

Jesse Glick

unread,
Oct 9, 2018, 9:18:55 AM10/9/18
to Jenkins Dev
On Tue, Oct 9, 2018 at 12:53 AM 'Xiaocheng Wang' via Jenkins
Developers <jenkin...@googlegroups.com> wrote:
> we have an Java application that calls Jenkins REST API to trigger builds. Due to project needs, we want that application to get the slave workspace folder content when build is running.

This sounds inherently unreliable. Treat the workspace as private. If
you want some files from a build, archive them.

Xiaocheng Wang

unread,
Oct 9, 2018, 10:00:31 PM10/9/18
to Jenkins Developers
Not sure what does "treat the workspace as private" exactly mean. If it's private, why can URL "http://<jenkins_host>:<jenkins_port>/job/<job_name>/ws" display those info?

And Yes, we archived the files after the build completes. However this is not enough -- users want to get those files when build is running so that he can know the test progress and responses in real time. Any suggestions to implement this?

Jesse Glick

unread,
Oct 10, 2018, 10:10:12 AM10/10/18
to Jenkins Dev
On Tue, Oct 9, 2018 at 10:00 PM 'Xiaocheng Wang' via Jenkins
Developers <jenkin...@googlegroups.com> wrote:
> Not sure what does "treat the workspace as private" exactly mean. If it's private, why can URL "http://<jenkins_host>:<jenkins_port>/job/<job_name>/ws" display those info?

The workspace browser is intended only for interactive
troubleshooting. By design, the workspace is only guaranteed
accessible during the build (in the case of Pipeline, during a `node`
block), as subsequent builds may overwrite these files, and “cloudy”
agents will typically throw away the whole filesystem as soon as the
build is done.

> users want to get those files when build is running so that he can know the test progress and responses in real time.

In the case of JUnit-formatted test results, this is handled via

https://plugins.jenkins.io/junit-realtime-test-reporter

This is done as a plugin, so it uses Java APIs to access these files.

Xiaocheng Wang

unread,
Oct 10, 2018, 11:11:59 PM10/10/18
to Jenkins Developers
Yes, I fully understand the workspace is only guaranteed accessible when the build is running. That's why we archived the files after the build completes.

However the plugin you sent does not meet our requirement... First, our test is not junit test, but jmeter test. And, during the build, we do not want the test results, but want to get the artifacts generated by jmeter (e.g. csv file, typically stored in the workspace folder of slave node). Anyway suggestions to handle this?

Slide

unread,
Oct 11, 2018, 12:19:48 AM10/11/18
to jenkin...@googlegroups.com
This is really a question for the users list, not the developers list.

--
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-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/ec469ce3-5d3e-4bee-b63c-f67da8e93b82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jesse Glick

unread,
Oct 11, 2018, 9:16:35 AM10/11/18
to Jenkins Dev
On Wed, Oct 10, 2018 at 11:11 PM 'Xiaocheng Wang' via Jenkins
Developers <jenkin...@googlegroups.com> wrote:
> our test is not junit test, but jmeter test. And, during the build, we do not want the test results, but want to get the artifacts generated by jmeter (e.g. csv file, typically stored in the workspace folder of slave node). Anyway suggestions to handle this?

Either modify your project to periodically upload those CSV files
somewhere, and have a standalone dashboard to display them; or write a
plugin to collect them automatically and publish them on the build
page using an `Action`.
Reply all
Reply to author
Forward
0 new messages