I am trying to push our jenkins build logs to S3. I used Groovy plugin and the following script in Build phase
// This script should be run in a system groovy script build step. // The FilePath class understands what node a path is on, not just the path. import hudson.FilePath // Get path to console log file on master. logFile = build.getLogFile() // Turn this into a FilePath object. logFilePathOnMaster = new FilePath(logFile) logFileName = build.envVars["JOB_BASE_NAME"] + build.envVars["RT_RELEASE_STAGING_VERSION"] + '.txt' // Create remote file path obj to build agent. remoteLogFile = new FilePath(build.workspace, logFileName) // Copy contents of master's console log to file on build agent. remoteLogFile.copyFrom(logFilePathOnMaster)
And then I am using S3 plugin to push .txt files to S3.
But this script fetches the build log file from the master node. How are the build logs transferred from slave to master node ? Can I access the build log file on my slave node without master's involvement at all ?
The slave node must be preserving the build logs while building somewhere ? I cant seem to find it.