-
Story
-
Resolution: Unresolved
-
Minor
-
None
Jenkins stores certain data about multi-branch jobs in "$JENKINS_HOME/jobs/PIPELINE_NAME/branches/MANGLED_BRANCHNAME". I have found that certain (short, simple) branches do not get mangled - e.g. branch "develop" is called "develop". However, many branch names get altered presumably to remove illegal characters and keep the branch name short. I'm trying to figure out what Jenkins will call my branch.
For example: (branch name left, mangled name right) "develop" - "develop" "release-3.9" - "release-3-9.t0j1ui" "patch-3.14-cumulative" - "patch-3-14-cumulative.4l8tb2" "patch-3.5-state_of_michigan" - "patch-3-5-st.cp75rj.-of-michigan"
Empirically, it replaces "." with "-" and is adding a hash. For longer branch names, it looks like it is also forcing a fixed length, by dropping characters from the middle - first 12 characters + hash (8 chars) + last 12 characters.
I've tried various hashing patterns (MD5, SHA1, etc), but none of them seem to produce the given hash. Can anyone point me at (or describe) the logic that Jenkins is using?
-------------
For integration purposes, I am composing some scripts that want to inspect the jenkins disk to determine the presence (or absence) of archives under a build. When Jenkins decides to eliminate an archive, I'd like to be able to react to that and initiate integration activity. While I have the branch name (in git), and the build-number, and can see the 'archive' subdirectory on disk, that directory often exists beneath a 'mangled' directory making it difficult to locate in a deterministic way. I'd like to have a way that I could provide information that I have and yield the branch name as it exists on disk.
I've looked through Jenkins documentation, but could not locate anything that describes the mangling that occurs.
- duplicates
-
JENKINS-62574 What is the Jenkins branch name-mangler algorithm?
- Closed