Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-25330

Folders should offer to use a hash for workspace path (like matrix does)

      When jobs are organized with lots of nested folders, the resulting workspace path can be long and will hit the windows 255 character max length (yes, we are in XXIth century and still suffer such issues)

      Matrix job offer an option to use a hash for workspace path as a workaround, folder could offer a comparable solution.

          [JENKINS-25330] Folders should offer to use a hash for workspace path (like matrix does)

          Félix Belzunce Arcos created issue -

          Daniel Beck added a comment -

          Seems unrelated to folders and should be a core feature (maybe via extension point) instead. While folders often lead to long fullNames, it's not the only way to have that problem.

          Daniel Beck added a comment - Seems unrelated to folders and should be a core feature (maybe via extension point) instead. While folders often lead to long fullNames, it's not the only way to have that problem.

          Ali Raza added a comment -

          Ali Raza added a comment - This issue is now sponsored to be fixed https://freedomsponsors.org/issue/580/folders-should-offer-to-use-a-hash-for-workspace-path-like-matrix-does

          Daniel Beck added a comment - - edited

          (obsolete comment; found the acceptance criteria)

          Daniel Beck added a comment - - edited (obsolete comment; found the acceptance criteria)
          Daniel Beck made changes -
          Assignee Original: Nicolas De Loof [ ndeloof ] New: Daniel Beck [ danielbeck ]

          Daniel Beck added a comment -

          Nicolas: Please let me know if you were planning to work on this.

          Daniel Beck added a comment - Nicolas: Please let me know if you were planning to work on this.

          Daniel Beck added a comment - - edited

          arazasplunk:

          Here's a build of a plugin that adds this feature to the configuration of folders (needs Folders 4.6.1, Jenkins 1.565.3; but that can be changed):
          https://dl.dropboxusercontent.com/u/29853/short-workspace-20141031.hpi

          • Allows enabling option per folder on the folder's config screen ("Use short workspace paths")
            • has additional option "Place short workspace inside the workspace of this folder" to place workspace directory with short name inside folder's workspace, to still have some organization
          • Works for freestyle projects, matrix projects, and build flows (and everything else with regular workspace implementation)
          • Uses JENKINS_HOME/workspace/... on master, configured slave workspace directory (hudson.model.Slave.workspaceRoot) on slaves
          • Tested with Windows slaves, works like a charm (except Subversion checkout in Build Flow didn't work for some reason – build.workspace.child("foo").write("bar", "UTF-8") in the DSL however did).

          Diagnostic information is logged to org.jenkinsci.plugins.shortworkspace.ShortWorkspaceLocator.

          Configure the name of the top-level workspace folder on the Jenkins master node (default: "workspace") by setting the system property org.jenkinsci.plugins.shortworkspace.ShortWorkspaceLocator.defaultWorkspaceFolder. Example: java -Dorg.jenkinsci.plugins.shortworkspace.ShortWorkspaceLocator.defaultWorkspaceFolder=ws -jar jenkins.war


          The following requirements were possibly not followed to the letter; clarification would be appreciated:

          • "No forking, release required" – I opted for a new plugin (that will be published to github.com/jenkinsci and released to Update Center).
          • "As long as it can be applied globally" – It's configurable per folder; let me know if you need a fully global option
          • "must apply to both freestyle job type and buildflow job type" – This plugin applied to all regular job types

          Let me know what you think.

          Daniel Beck added a comment - - edited arazasplunk : Here's a build of a plugin that adds this feature to the configuration of folders (needs Folders 4.6.1, Jenkins 1.565.3; but that can be changed): https://dl.dropboxusercontent.com/u/29853/short-workspace-20141031.hpi Allows enabling option per folder on the folder's config screen ("Use short workspace paths") has additional option "Place short workspace inside the workspace of this folder" to place workspace directory with short name inside folder's workspace, to still have some organization Works for freestyle projects, matrix projects, and build flows (and everything else with regular workspace implementation) Uses JENKINS_HOME/workspace/... on master, configured slave workspace directory ( hudson.model.Slave.workspaceRoot ) on slaves Tested with Windows slaves, works like a charm (except Subversion checkout in Build Flow didn't work for some reason – build.workspace.child("foo").write("bar", "UTF-8") in the DSL however did). Diagnostic information is logged to org.jenkinsci.plugins.shortworkspace.ShortWorkspaceLocator . Configure the name of the top-level workspace folder on the Jenkins master node (default: "workspace") by setting the system property org.jenkinsci.plugins.shortworkspace.ShortWorkspaceLocator.defaultWorkspaceFolder . Example: java -Dorg.jenkinsci.plugins.shortworkspace.ShortWorkspaceLocator.defaultWorkspaceFolder=ws -jar jenkins.war The following requirements were possibly not followed to the letter; clarification would be appreciated: "No forking, release required" – I opted for a new plugin (that will be published to github.com/jenkinsci and released to Update Center). "As long as it can be applied globally" – It's configurable per folder; let me know if you need a fully global option "must apply to both freestyle job type and buildflow job type" – This plugin applied to all regular job types Let me know what you think.

          Ali Raza added a comment -

          Hi Daniel,
          Thanks for the quick turn around. Let me test this out and get back to you.

          Ali Raza added a comment - Hi Daniel, Thanks for the quick turn around. Let me test this out and get back to you.

          Ali Raza added a comment -

          Daniel,
          Can this be part of the folder plugin rather than a separate plugin?

          Ali Raza added a comment - Daniel, Can this be part of the folder plugin rather than a separate plugin?

          Daniel Beck added a comment -

          arazasplunk:
          From a technical POV, yes. The package names for logging and the option name would change, that's it. Note that there is no functional or other advantage for you other than this feature being included without installing another plugin; for example the addition to the folder config form uses the same API as e.g. the similar Credentials-related options. In fact, functionally it'd be better left separate, as it'd allow users on older Jenkins + Folders versions to use it as well once I reduce the version requirements.

          Whether the addition would be accepted by the Folders maintainers is another question. Since this proposal was filed by CloudBees employees I'm hopeful, but whether the specific implementation is acceptable, I don't know. If changes are requested by them, you'd have to evaluate which you prefer.

          Do you have any other comments/requests regarding this plugin? Is the functionality as expected? Are the parts in which I differed from the acceptance criteria acceptable? (What's still missing is the inline help for the two options, that's still on the todo list.)

          Daniel Beck added a comment - arazasplunk : From a technical POV, yes. The package names for logging and the option name would change, that's it. Note that there is no functional or other advantage for you other than this feature being included without installing another plugin; for example the addition to the folder config form uses the same API as e.g. the similar Credentials-related options. In fact, functionally it'd be better left separate, as it'd allow users on older Jenkins + Folders versions to use it as well once I reduce the version requirements. Whether the addition would be accepted by the Folders maintainers is another question. Since this proposal was filed by CloudBees employees I'm hopeful, but whether the specific implementation is acceptable, I don't know. If changes are requested by them, you'd have to evaluate which you prefer. Do you have any other comments/requests regarding this plugin? Is the functionality as expected? Are the parts in which I differed from the acceptance criteria acceptable? (What's still missing is the inline help for the two options, that's still on the todo list.)

            danielbeck Daniel Beck
            fbelzunc Félix Belzunce Arcos
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: