#22906·jenkins

[JENKINS-21942] Unreliable defaulting of Jenkins.workspaceDir

Author: jenkins-infra-botCreated Feb 24, 2014Updated Sep 16, 2026
Labelsimported-jira-issuecomponent:coreresolution:unresolvedpriority:major

Jenkins.workspaceDir is supposed to default to $JENKINS_HOME/workspace/ on new installations: the "modern" location, consistent with that of slaves. But if you do not save the Jenkins global configuration during the first startup, on the next startup $JENKINS_HOME/jobs/ exists yet $JENKINS_HOME/config.xml does not, so the "compatibility" code kicks in and the old location is used!

Just setting this field to the new value in the instance initializer probably does not suffice, since installations upgraded from before the introduction of this field would be incorrectly switched to the new value.

Probably suffices to adjust the check to also check for the existence of $JENKINS_HOME/config.xml, since most old installations would have saved this file at least once.

--- Originally reported by jglick, imported from: Unreliable defaulting of Jenkins.workspaceDir
  • status: Open
  • priority: Major
  • component(s): core
  • label(s): upgrade, workspace
  • resolution: Unresolved
  • votes: 5
  • watchers: 20
  • imported: 2025-11-24
Raw content of original issue

Jenkins.workspaceDir is supposed to default to $JENKINS_HOME/workspace/ on new installations: the "modern" location, consistent with that of slaves. But if you do not save the Jenkins global configuration during the first startup, on the next startup $JENKINS_HOME/jobs/ exists yet $JENKINS_HOME/config.xml does not, so the "compatibility" code kicks in and the old location is used!

Just setting this field to the new value in the instance initializer probably does not suffice, since installations upgraded from before the introduction of this field would be incorrectly switched to the new value.

Probably suffices to adjust the check to also check for the existence of $JENKINS_HOME/config.xml, since most old installations would have saved this file at least once.