Hammed
Hammed

Reputation: 1557

Display hyperlink in Jenkins job

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.

Upvotes: 0

Views: 1973

Answers (1)

user13548070
user13548070

Reputation:

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)
     }
   }
 }
 }
}

Upvotes: 1

Related Questions