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

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

XMLWordPrintable

    • 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---" 
          ...
      }    

        1. 2024-03-25_Mon_018.png
          106 kB
          Mike Butterfield
        2. build-view-not-truncated-with-markdown-formatter.png
          104 kB
          Mark Waite
        3. build-view-not-truncated-with-markdown-formatter-1.png
          104 kB
          Mark Waite
        4. build-view-not-truncated-with-safe-html.png
          105 kB
          Mark Waite
        5. job-vew-truncated-with-safe-html.png
          122 kB
          Mark Waite
        6. job-view-truncated-with-markdown-formatter.png
          122 kB
          Mark Waite

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

              Created:
              Updated: