Where are Jenkins artifacts located?
Asked Answered
T

3

62

I added the Archive Artifacts post-build option to my project. I can see the artifacts from the web browser interface, but I cannot find them in the filesystem.

Where are they located?

Tradition answered 9/3, 2016 at 11:56 Comment(0)
F
71

It is being archived on the master server (even if the build were on a slave) in the following folder:

$JENKINS_HOME/jobs/<job>/builds/<build>/archive

But you can configure a different location using the 'Advanced' setting of the job (where you can set a different workspace folder) or using plugins that are made for this purpose such as Copy Artifact Plugin

Felic answered 9/3, 2016 at 12:14 Comment(8)
I know about Copy Artifact but I want to write my own script. I am currently using Copy Artifact and I couldn't find the artifacts archive there. Is it possible that the plugin removes the archive after copying it?Tradition
What's the point of deleting the archive after copying to it? Did you set to save only few builds for the job? Maybe it deletes it when it deletes the build folderFelic
This is wrong answer actual path is : $JENKINS_HOME/jobs/JOB_NAME/jobs/<Repository Name>/branches/<Branch Name>/builds/$BUILD_NUMBER/archive/Resection
Unfortunately, the advanced configuration appears to be missing from the pipeline command archiveArtifacts.Cornflakes
The advanced configuration is of the job and has nothing to do with rhe archiveArtifacts commandFelic
Is it normal to find my $JENKINS_HOME in /var/lib/jenkins?Krupp
Copy Artifact is horribly inefficient. I am looking into how to deterministically generate the artifact locations on disk so that I can just scp them between controller and agent. Anyone know how to do this for multibranch pipelines? It seems I'm going to have to look at the jenkins branch api source code. BTW, that's pretty normal @Sandburg. I use the default ~/.jenkins though.Victorvictoria
On linux, if the workspace and the build archive are on the same file system, using mv is almost instantaneous while cp depends on the size of the file.Preraphaelite
D
14

Just another couple of tips...

You can find jenkins home by going to the environment variables page in the job build jenkins page.

Where to find Environment Variables

In my case JENKINS_HOME turned out to be /var/lib/jenkins

Found artifacts in:

/var/lib/jenkins/jobs/<my-job-name>-build/lastStable/archive/target

/var/lib/jenkins/jobs/<my-job-name>-build/lastSsuccessful/archive/target

as well as

/var/lib/jenkins/jobs/<my-job-name>-build/builds/8/archive/target
Dierolf answered 27/9, 2017 at 12:45 Comment(0)
R
-1

Path is : $JENKINS_HOME/jobs//jobs//branches//builds/$BUILD_NUMBER/archive/

You have to extract branch name, job name and repository name from JOB_NAME environment variable.

Resection answered 28/9, 2017 at 12:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.