Post-build Actions on Jobs executed on slaves

64 views
Skip to first unread message

Paul Wellner Bou

unread,
Oct 1, 2015, 2:25:28 AM10/1/15
to Jenkins Developers
Good morning,

I have a build job checking out a git repository running on a jenkins slave, which works fine. But I am trying to access the workspace in an Post-build Action plugin, which does not seem to be possible: The Post-build Action is run on the master (at least thats what the System.getenv("HOSTNAME") is telling me.

Is there any way to run the Post-build Actions on the slave?

Thank you and regards
Paul.

Ullrich Hafner

unread,
Oct 1, 2015, 4:38:46 AM10/1/15
to jenkin...@googlegroups.com
Are you referring to an action that implements the Action interface? Or to a post build publisher that derives from Recorder or Publisher? 

The latter one can execute Runnables on a slave, e.g. to read information from the workspace. See FilePath#act for details...

--
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/fe2bda4d-a374-4b04-b720-5702c4586e2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc

Paul Wellner Bou

unread,
Oct 1, 2015, 6:01:48 AM10/1/15
to jenkin...@googlegroups.com
Thank you for the reply.

I am using a Publisher extending Publisher.

This looks promising. I discovered a stackoverflow thread with a bit of code doing  a smiliar thing (http://stackoverflow.com/questions/9279898/can-hudson-slaves-run-plugins).

Whats the difference between launcher.getChannel().call(task); and build.getWorkspace().act(task)? The JavaDoc of the latter looks promising.

What I am wondering now, is which Caller to use. There is a FilePath.FileCallable, where the JavaDoc says "Subtypes would likely want to extend from either {@link MasterToSlaveCallable}* or {@link SlaveToMasterFileCallable}."

I would use MasterToSlaveCallable now, does this work on the master then as well? Or do I have to detect somehow if I am running on a master or a slave?

Thank you very much,
Paul.


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/NwNN-HnnI8Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/9A91F3C4-F8DA-4D10-9693-77AF5ADF7B35%40gmail.com.

Paul Wellner Bou

unread,
Oct 1, 2015, 8:02:42 AM10/1/15
to jenkin...@googlegroups.com
Hi,

thanks, seems to work now, with MasterToSlaveCallable, on master and slave as well. I just have to take care that all objects I need are serializable.

Regards
Paul.
Reply all
Reply to author
Forward
0 new messages