43

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?

Victor
  • 11,135
  • 16
  • 65
  • 128

3 Answers3

52

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

yorammi
  • 5,012
  • 25
  • 32
  • 1
    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? – Victor Mar 09 '16 at 12:16
  • 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 folder – yorammi Mar 09 '16 at 12:19
  • This is wrong answer actual path is : $JENKINS_HOME/jobs/JOB_NAME/jobs//branches//builds/$BUILD_NUMBER/archive/ – Nitul Sep 28 '17 at 12:18
  • Unfortunately, the advanced configuration appears to be missing from the pipeline command [archiveArtifacts](https://jenkins.io/doc/pipeline/steps/core/#-archiveartifacts-%20archive%20the%20artifacts). – sebkraemer Sep 19 '18 at 09:33
  • The advanced configuration is of the job and has nothing to do with rhe archiveArtifacts command – yorammi Sep 19 '18 at 15:27
  • Is it normal to find my `$JENKINS_HOME` in `/var/lib/jenkins`? – Sandburg Nov 21 '19 at 11:26
  • 1
    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. – timblaktu Mar 01 '21 at 22:52
13

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
chim
  • 7,655
  • 3
  • 44
  • 58
0

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.

Nitul
  • 917
  • 9
  • 31