How to get a Build directory ?

Article ID:360041549631
2 minute readKnowledge base

Issue

  • How do I get a build directory of a build number of a specific Job ?

  • Diagnosing build issues

Resolution

A build directory contains most of the information needed to diagnose build issues. There are different ways to collect it.

From the UI

If using Support Core 2.67 or later, you can download directly from the UI. Navigate to the build page and click on the Support link. Then click on Generate Bundle:

support build bundle
you may adjust the options to collect specific data. For more details about the different options, have a look at the help ? tooltips.

With cbsupport

With the cbsupport CLI, you can download a build directory by using the command cbsupport required-data build. See 2.5.2. Generating information for a Jenkins Build issue for more details.

From the File System

In any case, you can find the build directory of a specific build number in the file system under the Build Record Root Directory.

  • By default, it is $JENKINS_HOME/jobs/$PATH_TO_JOB/builds/$BUILD_NUMBER

If the Build Record Root Directory is customized, its location can be found:

  • Before Jenkins 2.119, it is managed via GUI: Manage Jenkins > Configure System > Advanced

  • Since Jenkins 2.119, it is managed by jenkins.model.Jenkins.buildsDir via Features controlled by system properties.

you may exclude the underlying stashes/ and artifacts/ directories or cherry pick what you are looking for to avoid collecting too much data

On a Linux machine, you can use the tar command to create an archive of the directory. An example command might look like this:

tar -cvzf $BUILD_FOLDER.tar.gz $JENKINS_HOME/jobs/$PATH_TO_JOB/builds/$BUILD_NUMBER

This command will create an archive file called "$BUILD_FOLDER.tar.gz" which you can then provide to CloudBees support.