-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor
-
Component/s: branch-api-plugin
-
Environment:jenkins-war:2.176.1
branch-api-plugin: 2.5.2
-
branch-api-2.5.3
Apparently, some of our workspaces for specific branch names are mangled in a way that the directories start with a "-" (or multiple!). This would require some special handling in scripts and we would like to avoid that.
Â
There also have been some discussions about this special case in the now obsolete implementation in JENKINS-38706:
I had a look and it seems to happen here:
Â
It can be tested with this small java program:
Â
import org.apache.commons.lang3.StringUtils; public class Test { public static void main(String args[]) { int MAX_LENGTH=32; String fullName= "JIRA-1054_rename_1234_to_abcdef_try2"; String mnemonic = mnemonicOf(fullName); String path = StringUtils.right(mnemonic, MAX_LENGTH); System.out.println(path); } private static String mnemonicOf(String name) { // Do not need the complexity of NameMangler here, since we uniquify as needed. return name.replaceAll("(%[0-9A-F]{2}|[^a-zA-Z0-9-_.])+", "_"); } }
For the moment i have increased MAX_LENGTH on our jenkins, but I would really love to see this fixed in Jenkins.