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

Unable to select a branch source when creating new multi-branch item.

    XMLWordPrintable

Details

    • branch-api 2.6.3, cloudbees-folder 6.15

    Description

      Clicking on a source type on a new item doesn't display the SCM form.

      After clicking the GitHub (or other source types) the dropdown menu closes and the form is not displayed.

      Expected: Click on GitHub in the Branch Sources dropdown menu and the GitHub form pops up.

       

      See attachment.

      Attachments

        1. image-2020-10-30-07-02-43-834.png
          image-2020-10-30-07-02-43-834.png
          48 kB
        2. Jenkins-Ticket.gif
          Jenkins-Ticket.gif
          309 kB
        3. screenshot-1.png
          screenshot-1.png
          58 kB
        4. screenshot-2.png
          screenshot-2.png
          4 kB
        5. selectSource.png
          selectSource.png
          14 kB

        Issue Links

          Activity

            timja Tim Jacomb added a comment -

            this (https://github.com/jenkinsci/branch-api-plugin/blob/master/src/main/resources/lib/branch-api/branchSourceSelector.jelly) seems to be a customised version of hetero-list, and some change probably needs to be ported from core. Here's my branch with where I got to but it didn't seem to help: https://github.com/jenkinsci/branch-api-plugin/compare/master...timja:JENKINS-64069-tables-to-divs?expand=1

            help wanted , I'll try look again tomorrow or later on.

            timja Tim Jacomb added a comment - this ( https://github.com/jenkinsci/branch-api-plugin/blob/master/src/main/resources/lib/branch-api/branchSourceSelector.jelly ) seems to be a customised version of hetero-list, and some change probably needs to be ported from core. Here's my branch with where I got to but it didn't seem to help:  https://github.com/jenkinsci/branch-api-plugin/compare/master...timja:JENKINS-64069-tables-to-divs?expand=1 help wanted , I'll try look again tomorrow or later on.
            fqueiruga Félix Queiruga Balado added a comment - This may be related to  https://issues.jenkins-ci.org/browse/JENKINS-62825
            oleg_nenashev Oleg Nenashev added a comment -

            Looks so fqueiruga

            oleg_nenashev Oleg Nenashev added a comment - Looks so fqueiruga

            timja Sorry, is this by accident another failure symptom of this issue, or should I file a dedicated new one?

            • configuration > global pipeline libraries: configured is one from SVN, but some GitHub related elements are overlay-ing it
              • (Much further down are also buttons "Add repository" and "Add branch")

             

             

            reinholdfuereder Reinhold Füreder added a comment - timja Sorry, is this by accident another failure symptom of this issue, or should I file a dedicated new one? configuration > global pipeline libraries: configured is one from SVN, but some GitHub related elements are overlay-ing it (Much further down are also buttons "Add repository" and "Add branch")    
            timja Tim Jacomb added a comment -

            reinholdfuereder that should be a different issue, this issue is about it being completely broken and doing nothing when you click Add source.

            I've reproduced your issue and can take a look at it later on, note it's not fixed by the changes I've done to fix this issue.

            timja Tim Jacomb added a comment - reinholdfuereder that should be a different issue, this issue is about it being completely broken and doing nothing when you click Add source. I've reproduced your issue and can take a look at it later on, note it's not fixed by the changes I've done to fix this issue.
            timja Tim Jacomb added a comment -

            Partially resolved this issue in branch-api 2.6.1, https://github.com/jenkinsci/branch-api-plugin/releases/tag/branch-api-2.6.1.

            More fixes needed in other plugins. Needs at least https://github.com/jenkinsci/cloudbees-folder-plugin/pull/165 and probably more

            timja Tim Jacomb added a comment - Partially resolved this issue in branch-api 2.6.1, https://github.com/jenkinsci/branch-api-plugin/releases/tag/branch-api-2.6.1 . More fixes needed in other plugins. Needs at least https://github.com/jenkinsci/cloudbees-folder-plugin/pull/165 and probably more
            timja Tim Jacomb added a comment - reinholdfuereder I created https://issues.jenkins-ci.org/browse/JENKINS-64136
            timja Tim Jacomb added a comment - - edited

            The next issue occurring when saving:

            Seems to occur because of different json being submitted. note the missing source wrapper

            working:

            {
              "displayNameOrNull": "",
              "description": "",
              "disable": false,
              "sources": {
                "source": {
                  "stapler-class": "jenkins.scm.impl.SingleSCMSource",
                  "id": "9cca4d61-4e24-475e-bb31-7278e355e6f5",
                  "name": "multibranch",
                  "": "0",
                  "scm": {
                    "userRemoteConfigs": {
                      "url": "https://github.com/timja-org/junit-attachments-test/",
                      "includeUser": "false",
                      "credentialsId": "",
                      "name": "",
                      "refspec": ""
                    },
                    "branches": {
                      "name": "*/master"
                    },
                    "": "auto",
                    "stapler-class": "hudson.plugins.git.GitSCM",
                    "$class": "hudson.plugins.git.GitSCM"
                  }
                },
                "": "0",
                "strategy": {
                  "stapler-class": "jenkins.branch.DefaultBranchPropertyStrategy",
                  "$class": "jenkins.branch.DefaultBranchPropertyStrategy"
                },
                "stapler-class": "jenkins.branch.BranchSource",
                "kind": "jenkins.branch.BranchSource"
              },
              "": [
                "0",
                "1"
              ],
              "projectFactory": {
                "scriptPath": "Jenkinsfile",
                "stapler-class": "org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory",
                "$class": "org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory"
              },
              "orphanedItemStrategy": {
                "stapler-class": "com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy",
                "$class": "com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy",
                "pruneDeadBranches": true,
                "daysToKeepStr": "",
                "numToKeepStr": ""
              },
              "icon": {
                "stapler-class": "jenkins.branch.MetadataActionFolderIcon",
                "$class": "jenkins.branch.MetadataActionFolderIcon"
              },
              "core:apply": "",
              "Jenkins-Crumb": "52ae8303c473373a97598b65ba5b7b453cf6b0e2f5601c362001de51dbcd4d95"
            }
            

            broken:

            {
              "displayNameOrNull": "",
              "description": "",
              "disable": false,
              "sources": {
                "stapler-class": [
                  "jenkins.scm.impl.SingleSCMSource",
                  "jenkins.branch.BranchSource"
                ],
                "id": "d25aeca3-e276-486c-b9b4-463642963444",
                "name": "something-cool",
                "": [
                  "0",
                  "0"
                ],
                "scm": {
                  "userRemoteConfigs": {
                    "url": "https://github.com/timja-org/junit-attachments-test",
                    "includeUser": "false",
                    "credentialsId": "",
                    "name": "",
                    "refspec": ""
                  },
                  "branches": {
                    "name": "*/master"
                  },
                  "": "auto",
                  "stapler-class": "hudson.plugins.git.GitSCM",
                  "$class": "hudson.plugins.git.GitSCM"
                },
                "strategy": {
                  "stapler-class": "jenkins.branch.DefaultBranchPropertyStrategy",
                  "$class": "jenkins.branch.DefaultBranchPropertyStrategy"
                },
                "kind": "jenkins.branch.BranchSource"
              },
              "": [
                "0",
                "1"
              ],
              "projectFactory": {
                "scriptPath": "Jenkinsfile",
                "stapler-class": "org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory",
                "$class": "org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory"
              },
              "orphanedItemStrategy": {
                "stapler-class": "com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy",
                "$class": "com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy",
                "pruneDeadBranches": true,
                "daysToKeepStr": "",
                "numToKeepStr": ""
              },
              "icon": {
                "stapler-class": "jenkins.branch.MetadataActionFolderIcon",
                "$class": "jenkins.branch.MetadataActionFolderIcon"
              },
              "healthMetrics": {
                "recursive": true,
                "stapler-class": "com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric",
                "$class": "com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric"
              },
              "core:apply": "",
              "Jenkins-Crumb": "7f9c1ca3889be930ae668727e6e8ba1ad7b74e4d83edc9604ff038312799b5cc"
            }
            
            timja Tim Jacomb added a comment - - edited The next issue occurring when saving: Seems to occur because of different json being submitted. note the missing source wrapper working: { "displayNameOrNull" : "", "description" : "", "disable" : false , "sources" : { "source" : { "stapler-class" : "jenkins.scm.impl.SingleSCMSource" , "id" : "9cca4d61-4e24-475e-bb31-7278e355e6f5" , "name" : "multibranch" , "": " 0", "scm" : { "userRemoteConfigs" : { "url" : "https: //github.com/timja-org/junit-attachments-test/" , "includeUser" : " false " , "credentialsId" : "", "name" : "", "refspec" : "" }, "branches" : { "name" : "*/master" }, "": " auto", "stapler-class" : "hudson.plugins.git.GitSCM" , "$class" : "hudson.plugins.git.GitSCM" } }, "": " 0", "strategy" : { "stapler-class" : "jenkins.branch.DefaultBranchPropertyStrategy" , "$class" : "jenkins.branch.DefaultBranchPropertyStrategy" }, "stapler-class" : "jenkins.branch.BranchSource" , "kind" : "jenkins.branch.BranchSource" }, "": [ "0" , "1" ], "projectFactory" : { "scriptPath" : "Jenkinsfile" , "stapler-class" : "org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory" , "$class" : "org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory" }, "orphanedItemStrategy" : { "stapler-class" : "com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" , "$class" : "com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" , "pruneDeadBranches" : true , "daysToKeepStr" : "", "numToKeepStr" : "" }, "icon" : { "stapler-class" : "jenkins.branch.MetadataActionFolderIcon" , "$class" : "jenkins.branch.MetadataActionFolderIcon" }, "core:apply" : "", "Jenkins-Crumb" : "52ae8303c473373a97598b65ba5b7b453cf6b0e2f5601c362001de51dbcd4d95" } broken: { "displayNameOrNull" : "", "description" : "", "disable" : false , "sources" : { "stapler-class" : [ "jenkins.scm.impl.SingleSCMSource" , "jenkins.branch.BranchSource" ], "id" : "d25aeca3-e276-486c-b9b4-463642963444" , "name" : "something-cool" , "": [ "0" , "0" ], "scm" : { "userRemoteConfigs" : { "url" : "https: //github.com/timja-org/junit-attachments-test" , "includeUser" : " false " , "credentialsId" : "", "name" : "", "refspec" : "" }, "branches" : { "name" : "*/master" }, "": " auto", "stapler-class" : "hudson.plugins.git.GitSCM" , "$class" : "hudson.plugins.git.GitSCM" }, "strategy" : { "stapler-class" : "jenkins.branch.DefaultBranchPropertyStrategy" , "$class" : "jenkins.branch.DefaultBranchPropertyStrategy" }, "kind" : "jenkins.branch.BranchSource" }, "": [ "0" , "1" ], "projectFactory" : { "scriptPath" : "Jenkinsfile" , "stapler-class" : "org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory" , "$class" : "org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory" }, "orphanedItemStrategy" : { "stapler-class" : "com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" , "$class" : "com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" , "pruneDeadBranches" : true , "daysToKeepStr" : "", "numToKeepStr" : "" }, "icon" : { "stapler-class" : "jenkins.branch.MetadataActionFolderIcon" , "$class" : "jenkins.branch.MetadataActionFolderIcon" }, "healthMetrics" : { "recursive" : true , "stapler-class" : "com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric" , "$class" : "com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric" }, "core:apply" : "", "Jenkins-Crumb" : "7f9c1ca3889be930ae668727e6e8ba1ad7b74e4d83edc9604ff038312799b5cc" }
            fqueiruga Félix Queiruga Balado added a comment - - edited

            I have seen these sort of problem before in this tables-to-divs work. It was related to the ability of hudson-behaviour to build a proper tree. Maybe we need to look into it.

            fqueiruga Félix Queiruga Balado added a comment - - edited I have seen these sort of problem before in this tables-to-divs work. It was related to the ability of hudson-behaviour to build a proper tree. Maybe we need to look into it.
            timja Tim Jacomb added a comment -

            seems to be because the div name="source is missing.

            it's here:
            https://github.com/jenkinsci/branch-api-plugin/blob/e69c48a1a01c210a4703fed975ca234d85743cdb/src/main/resources/jenkins/branch/BranchSource/config.jelly#L26

            and when run from hpi:run in branch-api it works but not elsewhere

            timja Tim Jacomb added a comment - seems to be because the div name="source is missing. it's here: https://github.com/jenkinsci/branch-api-plugin/blob/e69c48a1a01c210a4703fed975ca234d85743cdb/src/main/resources/jenkins/branch/BranchSource/config.jelly#L26 and when run from hpi:run in branch-api it works but not elsewhere
            timja Tim Jacomb added a comment -

            this fixes it but breaks compat with old core. Will experiment a bit more but maybe we just raise the baseline.

            $ git diff
            diff --git a/src/main/resources/jenkins/branch/BranchSource/config.jelly b/src/main/resources/jenkins/branch/BranchSource/config.jelly
            index c736737..c8f2850 100644
            --- a/src/main/resources/jenkins/branch/BranchSource/config.jelly
            +++ b/src/main/resources/jenkins/branch/BranchSource/config.jelly
            @@ -23,7 +23,7 @@
              -->
             <?jelly escape-by-default='true'?>
             <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:branch="/lib/branch-api">
            -  <branch:rowWrapper name="source">
            +  <div class="tr" name="source" data-hack="true">
                 <branch:entryWrapper>
                   <input type="hidden" name="stapler-class" value="${sourceDescriptor.clazz.name}"/>
                   <branch:blockWrapper>
            @@ -34,7 +34,7 @@
                     </j:scope>
                   </branch:blockWrapper>
                 </branch:entryWrapper>
            -  </branch:rowWrapper>
            +  </div>
               <j:set var="descriptors" value="${descriptor.propertyStrategyDescriptors(it,sourceDescriptor)}"/>
               <j:if test="${!descriptors.isEmpty()}">
                 <f:block>
            
            timja Tim Jacomb added a comment - this fixes it but breaks compat with old core. Will experiment a bit more but maybe we just raise the baseline. $ git diff diff --git a/src/main/resources/jenkins/branch/BranchSource/config.jelly b/src/main/resources/jenkins/branch/BranchSource/config.jelly index c736737..c8f2850 100644 --- a/src/main/resources/jenkins/branch/BranchSource/config.jelly +++ b/src/main/resources/jenkins/branch/BranchSource/config.jelly @@ -23,7 +23,7 @@ --> <?jelly escape-by- default = ' true ' ?> <j:jelly xmlns:j= "jelly:core" xmlns:st= "jelly:stapler" xmlns:d= "jelly:define" xmlns:l= "/lib/layout" xmlns:t= "/lib/hudson" xmlns:f= "/lib/form" xmlns:branch= "/lib/branch-api" > - <branch:rowWrapper name= "source" > + <div class= "tr" name= "source" data-hack= " true " > <branch:entryWrapper> <input type= "hidden" name= "stapler-class" value= "${sourceDescriptor.clazz.name}" /> <branch:blockWrapper> @@ -34,7 +34,7 @@ </j:scope> </branch:blockWrapper> </branch:entryWrapper> - </branch:rowWrapper> + </div> <j:set var = "descriptors" value= "${descriptor.propertyStrategyDescriptors(it,sourceDescriptor)}" /> <j: if test= "${!descriptors.isEmpty()}" > <f:block>

            If raising the baseline is acceptable I'd say go for it. What's the data-hack for, btw?

            fqueiruga Félix Queiruga Balado added a comment - If raising the baseline is acceptable I'd say go for it. What's the data-hack for, btw?
            timja Tim Jacomb added a comment -

            Just adding an attribute, making sure the jelly was getting reloaded

            timja Tim Jacomb added a comment - Just adding an attribute, making sure the jelly was getting reloaded

            Ok,makes sense

            fqueiruga Félix Queiruga Balado added a comment - Ok,makes sense
            dnusbaum Devin Nusbaum added a comment -

            Fixes for this issue have been released in Branch API plugin 2.6.3 and CloudBees Folder plugin 6.15.

            dnusbaum Devin Nusbaum added a comment - Fixes for this issue have been released in Branch API plugin 2.6.3 and CloudBees Folder plugin 6.15.
            barel_elbaz Barel Elbaz added a comment - - edited

            A workaround that's worth a mention here, If you face with it and you need to set Branch Source urgently you can:

            1. Login to Jenkins via ssh
            2. Modify ```JENKINS_HOME/jobs/<job_name>/config.xml``` - Just copy & modify from different job with working & configured branch source

            Sample config:

            ```

                <sources class="jenkins.branch.MultiBranchProject$BranchSourceList">
                    <data>
                        <jenkins.branch.BranchSource>
                            <source class="jenkins.plugins.git.GitSCMSource">
                                <id>1100</id>
                                <remote><---YOUR REPO GOES HERE Ex:https://github.com/---></remote>
                                <credentialsId>YOUR_CREDENTIALS</credentialsId>
                                <includes>*</includes>
                                <excludes/>
                                <ignoreOnPushNotifications>false</ignoreOnPushNotifications>
                            </source>
                            <strategy class="jenkins.branch.DefaultBranchPropertyStrategy">
                                <properties class="empty-list"/>
                            </strategy>
                        </jenkins.branch.BranchSource>
                    </data>
                    <owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
                </sources>

            ```

            barel_elbaz Barel Elbaz added a comment - - edited A workaround that's worth a mention here, If you face with it and you need to set Branch Source urgently you can: Login to Jenkins via ssh Modify ```JENKINS_HOME/jobs/<job_name>/config.xml``` - Just copy & modify from different job with working & configured branch source Sample config: ```     <sources class="jenkins.branch.MultiBranchProject$BranchSourceList">         <data>             <jenkins.branch.BranchSource>                 <source class="jenkins.plugins.git.GitSCMSource">                     <id>1100</id>                     <remote> <---YOUR REPO GOES HERE Ex: https://github.com/--- > </remote>                     <credentialsId> YOUR_CREDENTIALS </credentialsId>                     <includes>*</includes>                     <excludes/>                     <ignoreOnPushNotifications>false</ignoreOnPushNotifications>                 </source>                 <strategy class="jenkins.branch.DefaultBranchPropertyStrategy">                     <properties class="empty-list"/>                 </strategy>             </jenkins.branch.BranchSource>         </data>         <owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>     </sources> ```

            People

              timja Tim Jacomb
              wgillaspy William Gillaspy
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: