Reputation: 1591
I want to be able to copy the console log from our build jobs into a SMB dropzone we use for all our builds and started looking at implementing it in Groovy. The problem is that the Groovy Postbuild plugin runs on the slave, but our master is a Unix machine so it's unable to find $(JENKINS_HOME)
Is there a plugin for doing this or any sneaky way of making the Groovy postbuild run on master?
Upvotes: 0
Views: 667
Reputation: 68
The groovy-postbuild plugin provides access to the build and run objects and those can be used to do what you are asking.
def smbShare = new File('/your/smbshare/location/something.log')
smbshare.write( manager.build.getLogFile().text )
manager.build is a wrapper around the following api: http://javadoc.jenkins-ci.org/hudson/model/AbstractBuild.html and there are a couple getLog methods that might be suitable for you.
You'll want to make sure your job user has write access to the SMB share.
Upvotes: 1