user2705120
user2705120

Reputation: 249

Jenkins - Copy build log from master to a shared drive

Can someone direct me here? I have a simple job configured in Jenkins on a WINDOWS environment (master and all slaves running on windows) and the job is supposed to run on a particular slave. When you build the job, the build log ( log.log) gets stored in ” %JENKINS_HOME%\jobs\\builds\%BUILD_NUMBER%\” on the master.

I do have a Jenkins workspace (which is required when you add a slave node) set on the slave for this job–where nothing gets stored when the job runs.

With this scenario, I would like to copy the build log (log.log file that’s available on the master) to a share drive. Please advise me the way to get this done. I have tried few plugins “Copy to slave”, “Copy Artifact Plugin” and ArtifactDeployer Plugin…I could not get them working to meet what I need.

Upvotes: 5

Views: 1749

Answers (2)

Tihamer
Tihamer

Reputation: 971

The following command kind-of works:

curl ${BUILD_URL}consoleFull -o ${TargetDir}/Log.txt

where

TargetDir="${WORKSPACE}/Directory/target"

BUILD_URL and WORKSPACE are set by Jenkins. Unfortunately Jenkins doesn't copy the whole log. I've tried consoleText and gotten the same result: partial logs files. :-(

Upvotes: 0

Matthew MacFarland
Matthew MacFarland

Reputation: 2729

Use a second build action with the execute batch option. Put the copy command there to copy the log to another location.

Upvotes: 0

Related Questions