0

Does anyone know how to display a hyperlink (weblink) in a jenkins job build console?

I have a link, for example, www.google.com

And what I would like to do, is define this in my groovy script so that it appears as a hyperlink on the Jenkins job description.

My groovy looks like this.

    String jobName = "test"
    String displayString = "test_job"
    String web = "www.google.com"
    String webPage = "<a href=${web}>webPage</a>" 

    pipelineJob(jobName) {
        displayName(displayString)
        parameters {
        stringParam('XXX', '', 'address: webPage') 

www.google.com gets printed out but it's not clickable.

Any suggestions, please?

I've looked this this but can't seem to work it out.

Hammed
  • 1,457
  • 1
  • 24
  • 37

1 Answers1

1

Please looks the methods in the url https://javadoc.jenkins-ci.org/hudson/console/ModelHyperlinkNote.html

import hudson.console.ModelHyperlinkNote
def web="www.google.com"
pipeline
{
  stages
 {
   stage('sample')
   {
   steps
   {
     script
     {
          println hudson.console.ModelHyperlinkNote.encodeTo(web, web)
     }
   }
 }
 }
}
  • Hi @balu541, thanks a lot. But I feel like I'm still doing something wrong I've just updated the question to hopefully give a bit more clarity – Hammed Jun 17 '20 at 14:46