Disk Space Issue after upgrading Branch API plugin

Issue

  • After upgrading Pipeline Multibranch and/or Branch API plugin, Jenkins is reporting disk space issues
  • After upgrading Pipeline Multibranch and/or Branch API plugin, the $JENKINS_HOME/workspace grows abnormally in size

Environment

Related Issue

Explanation

The release of JENKINS-34564 introduced a new naming convention and a new directory structure for workspaces of branch jobs. The following schema illustrates the change of structure:

branch-api-workspaces

The outcome of this is that after the upgrade to Branch API 1.11+ Jenkins progressively creates workspaces with the new naming scheme but does not cleanup the old ones. The $JENKINS_HOME/workspace directory grows and ultimately doubles in size.

Resolution

The solution is to cleanup the $JENKINS_HOME/workspace directory from the old workspaces. The recommended approach is the following:

  1. Exit Jenkins safely with $JENKINS_URL/safeExit
  2. Once Jenkins is stopped, remove the content of $JENKINS_HOME/workspace/
  3. Start Jenkins

Note: Jenkins design presumes the workspace can be deleted at any moment and therefore this operation is generally safe.

Improvements

There are 2 issues documented to improve this behavior:

  • JENKINS-33273 to improve the checkout of Pipeline jobs (and maybe reduce the number of checkouts).
  • JENKINS-2111 to improve cleanup of obsolete workspaces.
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.