timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-64069] Unable to select a branch source when creating new multi-branch item. #1273

Closed timja closed 3 years ago

timja commented 3 years ago

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.


Originally reported by wgillaspy, imported from: Unable to select a branch source when creating new multi-branch item.
  • assignee: timja
  • status: Resolved
  • priority: Major
  • resolution: Fixed
  • resolved: 2020-11-10T21:09:30+00:00
  • imported: 2022/01/10
timja commented 3 years ago

timja:

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 commented 3 years ago

fqueiruga:

This may be related to https://issues.jenkins-ci.org/browse/JENKINS-62825

timja commented 3 years ago

oleg_nenashev:

Looks so fqueiruga

timja commented 3 years ago

reinholdfuereder:

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

 

 

timja commented 3 years ago

timja:

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 commented 3 years ago

timja:

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 commented 3 years ago

timja:

reinholdfuereder I created https://issues.jenkins-ci.org/browse/JENKINS-64136

timja commented 3 years ago

timja:

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 commented 3 years ago

fqueiruga:

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 commented 3 years ago

timja:

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 commented 3 years ago

timja:

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 @@
  -->
 default='true'?>
 "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">
-  "source">
+  
"tr" name="source" data-hack="true"> "hidden" name="stapler-class" value="${sourceDescriptor.clazz.name}"/> @@ -34,7 +34,7 @@ - +

<j:set var="descriptors" value="${descriptor.propertyStrategyDescriptors(it,sourceDescriptor)}"/> <j:if test="${!descriptors.isEmpty()}">

timja commented 3 years ago

fqueiruga:

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

timja commented 3 years ago

timja:

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

timja commented 3 years ago

fqueiruga:

Ok,makes sense

timja commented 3 years ago

dnusbaum:

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

timja commented 2 years ago

[Originally related to: JENKINS-62825]