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

Long hyperlinks in build description not displayed correctly in history widget when using Markdown syntax

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: core
    • Environment:
      Firefox 24
      Jenkins 1.509.3
      PegDown Formatter plugin 1.3
    • Similar Issues:
    • Released As:
      2.198

      Description

      Use case:
      I want build description to contain two links separated by a space: "link1 link2". Link texts, "link1" and "link2", are at most ten characters each.

      What works:
      HTML links, i.e. "<a href="url">link text</a>", seem to work in all cases. Markdown links, i.e. "[link text](url)", seem to work on build page. Markdown links work also on project page (build history table) if they are short enough.

      What does not work:
      Markdown links do not display correctly on project page if the url is too long. I have seen two invalid representations 1) "link1..." where the link1 was ok, but the second link was missing. 2) "[link1](part-of-the-url..." where url was partially visible (consuming three lines), and the second link was missing.

      I have used Description Setter plugin and Jenkins CLI with same results.

      Configuration:
      PegDown is selected as Markup Formatter in Global Security and all extensions have been enabled. (With this fix, I could also check SUPPRESS_ALL_HTML.)

        Attachments

          Issue Links

            Activity

            Hide
            danielbeck Daniel Beck added a comment -

            Could you provide a sample description that can be set as a project description and that demonstrates the problem?

            Show
            danielbeck Daniel Beck added a comment - Could you provide a sample description that can be set as a project description and that demonstrates the problem?
            Hide
            salsa Sami Salonen added a comment -

            This issue is about build descriptions only. I have not tested setting project descriptions. Build descriptions are visible on project page (Build History table) and naturally on the build page itself. Displaying build descriptions in Build History table (project page) seems to be the problem here.

            Here is a sample shell script that sets the build description during the build.

            jcli="ssh -p <port> <jenkins host>"
            
            function get_first_link()
            {
              local text="first"
              local url="http://xxxxx.xxxxx.xxxxx.xxxxx/xxxxx/xxxxx/xxxxx/xxxxx?zzz=yyy&aaa=bbb&ccc=ddd&eee=123"
              # this does not work:
              echo "[$text]($url)"
              # this works:
              # echo "<a\ href=\"$url\">$text</a>"
            }
            
            function get_second_link()
            {
              <this is similar to get_first_link>
            }
            
            first=$( get_first_link )
            second=$( get_second_link )
            desc="$first\ $second"
            $jcli set-build-description "$JOB_NAME" "$BUILD_NUMBER" "$desc"
            
            Show
            salsa Sami Salonen added a comment - This issue is about build descriptions only. I have not tested setting project descriptions. Build descriptions are visible on project page (Build History table) and naturally on the build page itself. Displaying build descriptions in Build History table (project page) seems to be the problem here. Here is a sample shell script that sets the build description during the build. jcli= "ssh -p <port> <jenkins host>" function get_first_link() { local text= "first" local url= "http: //xxxxx.xxxxx.xxxxx.xxxxx/xxxxx/xxxxx/xxxxx/xxxxx?zzz=yyy&aaa=bbb&ccc=ddd&eee=123" # this does not work: echo "[$text]($url)" # this works: # echo "<a\ href=\" $url\ ">$text</a>" } function get_second_link() { < this is similar to get_first_link> } first=$( get_first_link ) second=$( get_second_link ) desc= "$first\ $second" $jcli set-build-description "$JOB_NAME" "$BUILD_NUMBER" "$desc"
            Hide
            danielbeck Daniel Beck added a comment -

            Thanks, now it's clear that it's about the automatic truncating of build descriptions in the history widget.

            hudson/widgets/HistoryWidget/entry.jelly calls app.markupFormatter.translate(build.truncatedDescription) and Run.getTruncatedDescription operates on the raw text when determining where to truncate, so the markup formatter receives an incomplete format string.

            Should probably add MarkupFormatter.translateAndTruncate(String markup, Writer output, int maxLength) for this case.

            Show
            danielbeck Daniel Beck added a comment - Thanks, now it's clear that it's about the automatic truncating of build descriptions in the history widget. hudson/widgets/HistoryWidget/entry.jelly calls app.markupFormatter.translate(build.truncatedDescription) and Run.getTruncatedDescription operates on the raw text when determining where to truncate, so the markup formatter receives an incomplete format string. Should probably add MarkupFormatter.translateAndTruncate(String markup, Writer output, int maxLength) for this case.
            Hide
            leedega Kevin Phillips added a comment -

            We are experiencing a similar problem in our production environment, with a slightly different variation. It appears as though the truncation logic in the history widget is taking into account the build ID and time stamp strings in it's calculations for truncation. As a result when our build numbers went from being 5 digits to 6 digits in certain jobs, information that used to be present in the history widget (ie: from the build description) is now being truncated.

            What's even stranger is that even though presumably the summary content only grows by 1 or 2 characters (ie: 1 extra digit in the build number, and perhap 1 extra carriage return character to put to the timestamp on the following line) the build description seems to have an entire line of output being truncated which had previously been present.

            First off, I wouldn't have expected the timestamp to be wrapped in this case at all since there is plenty of white space surrounding the text currently. So that was odd. Secondly, it seemed odd that the build description would get truncated differently dependent upon how the summary / header information is displayed in the history. I would have expected the descriptive text to be truncated consistently regardless of the header info.

            Show
            leedega Kevin Phillips added a comment - We are experiencing a similar problem in our production environment, with a slightly different variation. It appears as though the truncation logic in the history widget is taking into account the build ID and time stamp strings in it's calculations for truncation. As a result when our build numbers went from being 5 digits to 6 digits in certain jobs, information that used to be present in the history widget (ie: from the build description) is now being truncated. What's even stranger is that even though presumably the summary content only grows by 1 or 2 characters (ie: 1 extra digit in the build number, and perhap 1 extra carriage return character to put to the timestamp on the following line) the build description seems to have an entire line of output being truncated which had previously been present. First off, I wouldn't have expected the timestamp to be wrapped in this case at all since there is plenty of white space surrounding the text currently. So that was odd. Secondly, it seemed odd that the build description would get truncated differently dependent upon how the summary / header information is displayed in the history. I would have expected the descriptive text to be truncated consistently regardless of the header info.
            Hide
            leedega Kevin Phillips added a comment -

            On a related note, is there any way to customize the truncation length for the history widget?

            Show
            leedega Kevin Phillips added a comment - On a related note, is there any way to customize the truncation length for the history widget?
            Hide
            slonopotamusorama Marat Radchenko added a comment - - edited

            Fixed by https://github.com/jenkinsci/jenkins/pull/4209 and should be released in 2.198 next week. History widget no longer truncates build description.

            Show
            slonopotamusorama Marat Radchenko added a comment - - edited Fixed by https://github.com/jenkinsci/jenkins/pull/4209 and should be released in 2.198 next week. History widget no longer truncates build description.

              People

              • Assignee:
                danielbeck Daniel Beck
                Reporter:
                salsa Sami Salonen
              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: