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

A link in a build description gets truncated in the Job view with ellipses.

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • Jenkins 2.426.1
      Markdown Formatter 95.v17a_965e696ee

      When using the markdown plugin, a markdown link is properly rendered in the build view. However, while viewing the same build in the Job view, the markdown link gets truncated with ellipses.

      This is not an issue while using Safe HTML.

      Controller using Safe HTML

      • Select a build (e.g. #5)
      • Edit Build Information link (left)
        Description:
        <b>Commit</b>: [<a href="https://MY_BB_HOST/bitbucket/projects/MY_PROJECT/repos/MY_REPO/commits/0123456789abcdef0123456789abcdef01234567">abc123d</a>] 
      • Save button
      • OBSERVE: build #5 shows clickable link:
        Commit: [abc123d]   // this IS a clickable link
      • Navigate back to job
      • OBSERVE: list of jobs, build #5 shows clickable link:
        Commit: [abc123d]   // this IS a clickable link

      Controller using markdown

      • Select a build (e.g. #5)
      • Edit Build Information link (left) or Add Description button
      • Description:
        __Commit__: [abc123d}(https://MY_BB_HOST/bitbucket/projects/MY_PROJECT/repos/MY_REPO/commits/0123456789abcdef0123456789abcdef01234567)] 
      • Save button
      • OBSERVE: build # 5 shows clickable link:
        Commit: [abc123d]   // this IS a clickable link 
      • Navigate back to job 
      • OBSERVE: list of jobs, build #5 shows:
        Commit:... //NOT a clickable or readable link 
      • Hypothesis: It appears that the plugin truncates the Commit string based on actual length rather than rendered length.
      • Workaround: Just use the commit prefix string WITHOUT the link. (But... I like the link.)
      • Other markdown (e.g. bold) for short strings appears to work as expected in both build and job views.

      FWIW, I find adding a Commit link to the build from the pipeline EXTREMELY useful if I am quickly iterating. I find myself being impatient and smashing build button shortly after pushing a change. This quick look allows me to see the commit version without having to click into the job. Only caveat is my sample only shows last commit version, but good enough for my use.

      Pipeline snippet: somewhere in an early stage... before things start to break

      script{
          ...
          env.REPO_URL_COMMITS = "https://MY_BB.com/bitbucket/projects/MY_PROJECT/repos/MY_REPO/commits" // only shown here for example, I will usually set in environment{} block 
      
          env.COMMIT_URL_MD = "[Commit ${GIT_COMMIT[0..6]}](${REPO_URL_COMMITS}/${GIT_COMMIT})"   // truncates commit version to 7 characters for display text
          currentBuild.description = "${COMMIT_URL_MD}" // add commit URL to build description
          //OPTIONAL: add useful debug/iterate comments to description (note the double trailing spaces for linefeeds) 
          //currentBuild.description = "${COMMIT_URL_MD}  \n${MY_CUSTOM_MESSAGE}  \n  \n---" 
          ...
      }    

          [JENKINS-72916] A link in a build description gets truncated in the Job view with ellipses.

          Mark Waite added a comment - - edited

          I'm seeing truncation of build description by both the safe HTML formatter and the markdown formatter when displaying in the job view. I believe that is an intentional choice by Jenkins core to not overrun the table in the job view.

          Safe HTML job view truncated

          Markdown job view truncated

          Safe HTML build view not truncated

          Markfown build view not truncated

          Mark Waite added a comment - - edited I'm seeing truncation of build description by both the safe HTML formatter and the markdown formatter when displaying in the job view. I believe that is an intentional choice by Jenkins core to not overrun the table in the job view. Safe HTML job view truncated Markdown job view truncated Safe HTML build view not truncated Markfown build view not truncated

          Mike Butterfield added a comment - - edited

          While in the job view, the build description gets truncated with ellipses after 98 or 99 characters of the string itself, and not the 'rendered/display' length for the following examples. 

          [JENKINS-72916](https://issues.jenkins.io/browse/JENKINS-72916) display: JENKINS-72916 (clickable link)
          
          __Commit__: [[1234567(https://BB_HOST/bitbucket/projects/PROJECT/repos/REPO/commits/123456789012)], length: 99, display: Commit: [1234567] (clickable link)
          
          __Commit__: [[1234567](https://BB_HOST/bitbucket/projects/PROJECT/repos/REPO/commits/1234567890123)], length: 100, display: Commit:...  (NOT clickable)
          
          012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678, length: 98, NOT truncated 
          
          0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789, length: 99, truncated with ellipses 

          The Commit URL that initiated this ticket will routinely exceed this length.

          (Apologies for edits due to failed cut-and-paste attempts)

          Mike Butterfield added a comment - - edited While in the job view, the build description gets truncated with ellipses after 98 or 99 characters of the string itself, and not the 'rendered/display' length for the following examples.  [JENKINS-72916](https: //issues.jenkins.io/browse/JENKINS-72916) display: JENKINS-72916 (clickable link) __Commit__: [[1234567(https: //BB_HOST/bitbucket/projects/PROJECT/repos/REPO/commits/123456789012)], length: 99, display: Commit: [1234567] (clickable link) __Commit__: [[1234567](https: //BB_HOST/bitbucket/projects/PROJECT/repos/REPO/commits/1234567890123)], length: 100, display: Commit:...  (NOT clickable) 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678, length: 98, NOT truncated  0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789, length: 99, truncated with ellipses The Commit URL that initiated this ticket will routinely exceed this length. (Apologies for edits due to failed cut-and-paste attempts)

          A temporary (or perhaps permanent solution) is to shorten the URL and use that in the markdown: 

          curl -sL https://tinyurl.com/api-create.php?url=MY_VERY_LONG_URL 

           

          Mike Butterfield added a comment - A temporary (or perhaps permanent solution) is to shorten the URL and use that in the markdown:  curl -sL https: //tinyurl.com/api-create.php?url=MY_VERY_LONG_URL  

          The reported symptom appears to be related to markdown only. Safe HTML get properly rendered for a string exceeding 500 characters. I did not perform further testing for longer strings. The rendered ink was successfully copied with right-click, Copy Link address and compared to original. 

          • Plain text of length 400 gets truncated to 100 characters (including ellipses): 
            0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 
          • HTML of length 503 gets properly rendered with clickable link (display length of 'Commit: [barfly]' is 16):
            <b>Commit</b>: [<a href="https://foo.bar.baz/bitbucket/projects/PROJECT/repos/REPO/commits/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789">barfly</a>] 

          Mike Butterfield added a comment - The reported symptom appears to be related to markdown only. Safe HTML get properly rendered for a string exceeding 500 characters. I did not perform further testing for longer strings. The rendered ink was successfully copied with right-click, Copy Link address and compared to original.  Plain text of length 400 gets truncated to 100 characters (including ellipses):  0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 HTML of length 503 gets properly rendered with clickable link (display length of 'Commit: [barfly] ' is 16): <b>Commit</b>: [<a href= "https: //foo.bar.baz/bitbucket/projects/PROJECT/repos/REPO/commits/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" >barfly</a>]

          Mark Waite added a comment -

          Thanks for the additional clarity on the truncation conditions. I think that indicates there are one or more methods related to the visible length of a string on the safe HTML plugin implementation that are not on the markdown formatter plugin.

          Are you interested in comparing the two implementations and proposing a pull request to improve the markdown formatter plugin?

          Mark Waite added a comment - Thanks for the additional clarity on the truncation conditions. I think that indicates there are one or more methods related to the visible length of a string on the safe HTML plugin implementation that are not on the markdown formatter plugin . Are you interested in comparing the two implementations and proposing a pull request to improve the markdown formatter plugin?

          I have never contributed to a Jenkins plugin, but am willing to give it a try. I have to start somewhere, so yes.

          Mike Butterfield added a comment - I have never contributed to a Jenkins plugin, but am willing to give it a try. I have to start somewhere, so yes.

            Unassigned Unassigned
            mb_austex Mike Butterfield
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: