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

Missing root URL in the generated link to build while using groovy-html.template

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • email-ext-plugin
    • None
    • Jenkins ver. 2.73.3
      Email-ext vers. 2.62

      I am using the groovy-html.template which generates a link to the build and it is coming up as something like: nulljob/test/2 where test is the name of the job and 2 is the build number. The nulljob part is coming from the concatenation of null root URL and the job URL as can be seen from here:

            <td><A href="${rooturl}${build.url}">${rooturl}${build.url}</A></td> 

      The rooturl property is coming from ExtendedEmailPublisherDescriptor.java.getHudsonUrl() as seen here

              binding.put("rooturl", descriptor.getHudsonUrl()); 

      This method internally just calls Jenkins.getActiveInstance().getRootUrl() as seen here:

          public String getHudsonUrl() {
              return Jenkins.getActiveInstance().getRootUrl();
          } 

       When I run the above API in Jenkins Script Console, I am getting the correct output:

      print(Jenkins.getActiveInstance().getRootUrl()) 

      This means, it is not a global configuration issue and from the code it is not obvious how a null value could creep in.

          [JENKINS-52983] Missing root URL in the generated link to build while using groovy-html.template

          Hari Dara created issue -
          David van Laatum made changes -
          Component/s New: pipeline [ 21692 ]
          Component/s Original: email-ext-plugin [ 15538 ]
          David van Laatum made changes -
          Assignee Original: David van Laatum [ davidvanlaatum ]
          Andrew Bayer made changes -
          Component/s New: email-ext-plugin [ 15538 ]
          Component/s Original: pipeline [ 21692 ]
          Alex Earl made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

            Unassigned Unassigned
            haridsv Hari Dara
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: