I know that the sort answer would be : Use an Operating System which support long paths and programs which support non alphanumeric path, but it's not always possible.
There is a similarly issue on JIRA here : https://issues.jenkins-ci.org/browse/JENKINS-30744
The proposed fix did not work for me, as it didn't solve the problem. I've tried it with a UUID instead and had the following error :
FATAL:
Failed to recompute children of MYPROJECT
java.lang.IllegalStateException:
Name of created project
org.jenkinsci.plugins.workflow.job.WorkflowJob@7eedefa0[p/1cbae353-d136-4d59-8406-7298d575da3a]
did not match expected features%2Fmy-branch
Just to mention that it's not the right place to do the modification. Instead, the branch-api-plugin is an excellent candidate ! I just need to change the getEncodedName() function from Branch.java
In fact, I wanted to change the folder name for something which is not too long, has a fixed size, and only alphanumeric characters.
My solution was to create a md5 hash of the function and keep only the 8 first characters. (I'm using the function in the Util class from the Jenkins main project)
public String getEncodedName() {
return Util.getDigestOf(getName()).substring(0,8);
}
https://github.com/superboum/branch-api-plugin/commit/1944cf052eff18bb7005660535081cab6b8f15f3
I've tested it on my jenkins and it works. But I'm conscious that I can't make a Pull Request of this change, as it breaks existing installations and Jenkins convention of naming folders.
However, applying this patch and compiling it for each version is really time consuming.
TL;DR
So my questions are :