1

In most recent version of Jenkins on centos 7.9, what is the difference between /var/lib/jenkins/jobs/ and /var/lib/jenkins/workspace/?

They both look like they house the same thing (artifact of a build), but is the former more for archival, while the latter is the workspace that's currently being worked on? I appreciate any help to understand this.

synth45
  • 11
  • 1
  • 2

1 Answers1

2

The jobs directory is the place where Jenkins stores the job definitions, build artefacts and build logs.

Workspace is the directory that is used to create the build. One can choose which files to store as build artefacts in the job configuration.

Workspace can be considered as a temporary location for doing build stuff. It can be automatically cleaned before / after build if so desired. However, when a git repository is used as basis for build, cleaning up workspace causes full download of repository whenever build is created. Therefore full cleanup of workspace is not always a good thing.

Hope this clarifies the concepts.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • 1
    Just to add, workspace will also exist on nodes (aka slaves) where agents are running, but the logs (and artifacts if archiveArtifats enabled) are copied back to the sever into the jobs/.../builds directory, post-build. Best practice is not to build on controller (master).The workspace should be considered emphemeral. – Ian W Jul 23 '21 at 01:44