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

GitLab multibranch pipeline not rendered correctly (regression in 2.341)

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • 2.344

      The GitLab multibranch pipeline on my Jenkins instance do not render correctly with Jenkins 2.342 (see attachment)

       

          [JENKINS-68270] GitLab multibranch pipeline not rendered correctly (regression in 2.341)

          Han Geerligs added a comment -

          thanks for the prompt response!

          I checked that Gitlab Branch source plugin has not been updated since 8 months. And this issue occurred after upgrading to 2.342.

          Han Geerligs added a comment - thanks for the prompt response! I checked that Gitlab Branch source plugin has not been updated since 8 months. And this issue occurred after upgrading to 2.342.

          Alexander Brandes added a comment - - edited

          Yeah, I can confirm that 2.341 is the last working Jenkins version where the icon was rendered properly.
          Thanks for raising a new issue, because that in fact is a different issue (even if the root cause is similar) that should be tracked separately.

          cc basil janfaracik for reference.

          Alexander Brandes added a comment - - edited Yeah, I can confirm that 2.341 is the last working Jenkins version where the icon was rendered properly. Thanks for raising a new issue, because that in fact is a different issue (even if the root cause is similar) that should be tracked separately. cc basil janfaracik for reference.

          Basil Crow added a comment -

          Can you please provide steps to reproduce the problem from scratch?

          Basil Crow added a comment - Can you please provide steps to reproduce the problem from scratch?

          Alexander Brandes added a comment - - edited
          1. Create a new multibranch pipeline (workflow-multibranch-plugin)
          2. Branch Sources -> Add Source -> GitLab Project (make sure you have the gitlab branch source plugin installed)
          3.  In the "Owner" field add your GitLab username and the project you want to add in the "Projects" dropdown. Preferably you have a repository with a dummy Jenkinsfile, e.g. https://gitlab.com/NotMyFault/jenkinsfile to utilize the option "Jenkinsfile" on Build Configuration -> Script Path
          4. Save the configuration, wait until the scanning is done and you can see the broken image on the table view.

          Alexander Brandes added a comment - - edited Create a new multibranch pipeline (workflow-multibranch-plugin) Branch Sources -> Add Source -> GitLab Project (make sure you have the gitlab branch source plugin installed)  In the "Owner" field add your GitLab username and the project you want to add in the "Projects" dropdown. Preferably you have a repository with a dummy Jenkinsfile, e.g. https://gitlab.com/NotMyFault/jenkinsfile  to utilize the option "Jenkinsfile" on Build Configuration -> Script Path Save the configuration, wait until the scanning is done and you can see the broken image on the table view.

          Basil Crow added a comment -

          Basil Crow added a comment - Thanks Alex, bisected to https://github.com/jenkinsci/jenkins/pull/6395

          Basil Crow added a comment -

          Reverting this hunk of #6395 fixes the problem for me:

          diff --git a/core/src/main/resources/lib/hudson/ballColorTd.jelly b/core/src/main/resources/lib/hudson/ballColorTd.jelly
          index 5c53f790fb..74beb1e506 100644
          --- a/core/src/main/resources/lib/hudson/ballColorTd.jelly
          +++ b/core/src/main/resources/lib/hudson/ballColorTd.jelly
          @@ -58,7 +58,7 @@ THE SOFTWARE.
           
                   <j:choose>
                     <j:when test="${iconClassName != null}">
          -            <l:icon src="${iconClassName}" class="${iconClassName}" alt="${it.description}" tooltip="${it.description}" />
          +            <l:icon class="${iconClassName} icon-lg" alt="${it.description}" tooltip="${it.description}" />
                     </j:when>
                     <j:otherwise>
                       <!-- "it" is not a hudson.model.BallColor.  Let's try figure out the icon from its URL.  -->
          

          Basil Crow added a comment - Reverting this hunk of #6395 fixes the problem for me: diff --git a/core/src/main/resources/lib/hudson/ballColorTd.jelly b/core/src/main/resources/lib/hudson/ballColorTd.jelly index 5c53f790fb..74beb1e506 100644 --- a/core/src/main/resources/lib/hudson/ballColorTd.jelly +++ b/core/src/main/resources/lib/hudson/ballColorTd.jelly @@ -58,7 +58,7 @@ THE SOFTWARE. <j:choose> <j:when test="${iconClassName != null}"> - <l:icon src="${iconClassName}" class="${iconClassName}" alt="${it.description}" tooltip="${it.description}" /> + <l:icon class="${iconClassName} icon-lg" alt="${it.description}" tooltip="${it.description}" /> </j:when> <j:otherwise> <!-- "it" is not a hudson.model.BallColor. Let's try figure out the icon from its URL. -->

          Basil Crow added a comment -

          I can confirm that the old icon class spec of "gitlab-logo icon-lg" works, while the new icon class spec of "gitlab-logo" (as of the above change) cannot be found in "iconsByCSSSelector".

          Basil Crow added a comment - I can confirm that the old icon class spec of "gitlab-logo icon-lg" works, while the new icon class spec of "gitlab-logo" (as of the above change) cannot be found in "iconsByCSSSelector".

          Basil Crow added a comment -

          This also "works"

          diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java
          index 5bc8a57f71..e65e7f1a2c 100644
          --- a/core/src/main/java/hudson/Functions.java
          +++ b/core/src/main/java/hudson/Functions.java
          @@ -2293,6 +2293,11 @@ public class Functions {
                   currentRequest.getWebApp().getDispatchValidator().allowDispatch(currentRequest, Stapler.getCurrentResponse());
                   Icon iconMetadata = IconSet.icons.getIconByClassSpec(iconGuess);
           
          +        if (iconMetadata == null) {
          +            // Basil asks: why is this necessary?
          +            iconMetadata = IconSet.icons.getIconByClassSpec(iconGuess + " icon-lg");
          +        }
          +
                   if (iconMetadata == null) {
                       // Icon could be provided as a simple iconFileName e.g. "settings.png"
                       iconMetadata = IconSet.icons.getIconByClassSpec(IconSet.toNormalizedIconNameClass(iconGuess) + " icon-md");
          

          I honestly don't know what I am doing so I am going to stop here. Hopefully janfaracik or notmyfault can understand what is going on here.

          Basil Crow added a comment - This also "works" diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 5bc8a57f71..e65e7f1a2c 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -2293,6 +2293,11 @@ public class Functions { currentRequest.getWebApp().getDispatchValidator().allowDispatch(currentRequest, Stapler.getCurrentResponse()); Icon iconMetadata = IconSet.icons.getIconByClassSpec(iconGuess); + if (iconMetadata == null ) { + // Basil asks: why is this necessary? + iconMetadata = IconSet.icons.getIconByClassSpec(iconGuess + " icon-lg" ); + } + if (iconMetadata == null ) { // Icon could be provided as a simple iconFileName e.g. "settings.png" iconMetadata = IconSet.icons.getIconByClassSpec(IconSet.toNormalizedIconNameClass(iconGuess) + " icon-md" ); I honestly don't know what I am doing so I am going to stop here. Hopefully janfaracik or notmyfault can understand what is going on here.

          Basil Crow added a comment -

          Released in 2.344. han_geerligs Could you please verify that the issue is resolved? Thanks!

          Basil Crow added a comment - Released in 2.344. han_geerligs Could you please verify that the issue is resolved? Thanks!

          Han Geerligs added a comment -

          Hello Basil,

           

          I can confirm that the issue is resolved! Thanks for fixing.

          Han

          Han Geerligs added a comment - Hello Basil,   I can confirm that the issue is resolved! Thanks for fixing. Han

            notmyfault Alexander Brandes
            han_geerligs Han Geerligs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: