publishing link using makrup in jenkinsfile

Viewed 210

I want to publish an html table in build summary page. As part of that summary I want to add clickable link, here what I got so far:

import org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
import io.jenkins.blueocean.rest.impl.pipeline.PipelineNodeGraphVisitor
import io.jenkins.blueocean.rest.impl.pipeline.FlowNodeWrapper

def List getBranchResults() {
    
   def writer = new StringWriter()  // html is written here by markup builder
    def markup = new groovy.xml.MarkupBuilder(writer)  // the builder
    
    markup.html{
        markup.table(class:"table table-bordered table-hover table-condensed") {
        markup.thead{
            markup.tr {
                    markup.th(title:"Field #1", "task name")
                    markup.th(title:"Field #2", "status")
                    markup.th(title:"Field #3", "link")
            } // tr
        } // thead
        markup.tbody{
            markup.tr{
                    markup.td(align:"right","Name")
                    markup.td(align:"right","RESULT")
                    markup.td(align:"right","https://www.google.com/")
            } // tr
        } //tbody
    } // table
   }
 
   manager.createSummary("accept.png").appendText(writer.toString(), false, false, false, "green")
}


getBranchResults( )

enter image description here

Tried also

markup.td(align:"right","<a href=https://www.google.com />")

With no success enter image description here

1 Answers

Using markup.td(class: "center",) { delegate.a(href: "www.google,com","link") } made the job

Related