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

multibranch issues if branch contains /

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            varun7447 Varun Reddy added a comment -

            The bug JENKINS-34564 also does not work for MSBuild. It fixes the longpath but not the issues with /

            Show
            varun7447 Varun Reddy added a comment - The bug JENKINS-34564 also does not work for MSBuild. It fixes the longpath but not the issues with /
            Hide
            nemligtim Timothy Harris added a comment - - edited

            I got around this by giving it a specific workspace.

            agent {
                node {
                    label 'windows'
                    // Todo: This s really bad but Jenkins Multibranch is being very bad with very long paths being generated!
                    customWorkspace "${JOB_NAME}"
                }
            }

            I got around the conversion of "/" by changing the branching strategy in Bitbucket to feature-, hotfix-, release- instead of feature/, hotfix/, release/.

            Both of these are pretty frustrating. Especially the "/". 

            Show
            nemligtim Timothy Harris added a comment - - edited I got around this by giving it a specific workspace. agent {     node {         label 'windows'         // Todo: This s really bad but Jenkins Multibranch is being very bad with very long paths being generated!         customWorkspace "${JOB_NAME}"     } } I got around the conversion of "/" by changing the branching strategy in Bitbucket to feature-, hotfix-, release- instead of feature/, hotfix/, release/. Both of these are pretty frustrating. Especially the "/". 
            Hide
            varun7447 Varun Reddy added a comment -

            I am currently using the Branching strategy to include - instead of / . But the default behavior in setting up git flow branches are / .

            Show
            varun7447 Varun Reddy added a comment - I am currently using the Branching strategy to include - instead of / . But the default behavior in setting up git flow branches are / .
            Hide
            sanchitr Sanchit Jain added a comment - - edited

            Jan Arend Jansen, where did you add below code?

            public String getEncodedName()
            { return Util.rawEncode(getName()).replace("%2F","_"); }
            

             

            Show
            sanchitr Sanchit Jain added a comment - - edited Jan Arend Jansen , where did you add below code? public String getEncodedName() { return Util.rawEncode(getName()).replace( "%2F" , "_" ); }  
            Hide
            sanchitr Sanchit Jain added a comment - - edited

            Joost van der Griendt, where did you add below code? -

            def getWorkspace()
            { pwd().replace("%2F", "_") }
            

             

            Show
            sanchitr Sanchit Jain added a comment - - edited Joost van der Griendt , where did you add below code? - def getWorkspace() { pwd().replace( "%2F" , "_" ) }  

              People

              Assignee:
              jglick Jesse Glick
              Reporter:
              magnayn magnayn
              Votes:
              14 Vote for this issue
              Watchers:
              48 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: