-
Bug
-
Resolution: Fixed
-
Major
Our repository contains a variant of the git-flow branch naming convention, where you will see
branches such as dev/main or release/3.2
Using multibranch, strange things happen:
- dev/main gets displayed as dev%2Fmain, then on restart dev%252Fmain, then dev%25252Fmain and all history seems to be lost.
This is likely down to / being a dodgy delimiter for a project name. I tried to fix this by adjusting WorkflowBranchProjectFactory thusly:
- WorkflowJob job = new WorkflowJob((WorkflowMultiBranchProject) getOwner(), branch.getName()); + String branchName = branch.getName().replace("/", "-"); + WorkflowJob job = new WorkflowJob((WorkflowMultiBranchProject) getOwner(), branchName);
but it didn't seem to help.
Happy to try to fix if I can get a pointer as to what to look at.
- depends on
-
JENKINS-30252 Provide easy access to git branch name in multibranch workflow scripts
-
- Resolved
-
-
JENKINS-30595 Obtain SCMHead from Item
-
- Resolved
-
- is blocking
-
JENKINS-32902 Multibranch pipeline has issues with / in jobName
-
- Resolved
-
- is duplicated by
-
JENKINS-34564 Give the ability to choose how the multibranch subprojects will be named.
-
- Resolved
-
- is related to
-
JENKINS-30798 Workflow multibranch failed after rebase: IllegalStateException: could not find branch tip
-
- Resolved
-
-
JENKINS-32701 Slashes in branch names cause 'bat' workflow task to hang
-
- Resolved
-
-
JENKINS-56956 Open Blue Ocean link with / character in branch name redirects to 404
-
- Closed
-
- links to
[JENKINS-30744] multibranch issues if branch contains /
Labels | Original: workflow | New: multibranch |
Description |
Original:
Our repository contains a variant of the git-flow branch naming convention, where you will see branches such as dev/main or release/3.2 Using multibranch, strange things happen: - dev/main gets displayed as dev%2Fmain, then on restart dev%252Fmain, then dev%25252Fmain and all history seems to be lost. This is likely down to / being a dodgy delimiter for a project name. I tried to fix this by adjusting WorkflowBranchProjectFactory thusly: - WorkflowJob job = new WorkflowJob((WorkflowMultiBranchProject) getOwner(), branch.getName()); + + String branchName = branch.getName().replace("/", "-"); + + WorkflowJob job = new WorkflowJob((WorkflowMultiBranchProject) getOwner(), branchName); but it didn't seem to help. Happy to try to fix if I can get a pointer as to what to look at. |
New:
Our repository contains a variant of the git-flow branch naming convention, where you will see branches such as {{dev/main}} or {{release/3.2}} Using multibranch, strange things happen: - {{dev/main}} gets displayed as {{dev%2Fmain}}, then on restart {{dev%252Fmain}}, then {{dev%25252Fmain}} and all history seems to be lost. This is likely down to {{/}} being a dodgy delimiter for a project name. I tried to fix this by adjusting {{WorkflowBranchProjectFactory}} thusly: {code} - WorkflowJob job = new WorkflowJob((WorkflowMultiBranchProject) getOwner(), branch.getName()); + String branchName = branch.getName().replace("/", "-"); + WorkflowJob job = new WorkflowJob((WorkflowMultiBranchProject) getOwner(), branchName); {code} but it didn't seem to help. Happy to try to fix if I can get a pointer as to what to look at. |
Link |
New:
This issue depends on |
Link |
New:
This issue depends on |
Seems like your proposed patch should have addressed it, though at the expense of potential clashes with branches actually named dev-main or release-3.2. Solving that would require a reversible encoding such as the URL-encoding you observed, but working of course.
Not sure if this has to be handled in workflow-multibranch, branch-api, or both. Need to think about it, write tests, and perhaps consult with stephenconnolly to see if this ever came up for Literate and how it was handled. I suspect the encoding in MultiBranchProject.getRootDirFor is relevant, but using a / inside an Item.getName is invalid generally (regardless of disk storage location), as that breaks the semantics of Item.getFullName and much else besides.