在 jenkinsfile 中使用 makrup 发布 link
publishing link using makrup in jenkinsfile
我想在构建摘要页面中发布 html table。
作为该摘要的一部分,我想添加可点击的 link,这是我目前得到的:
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( )
也试过
markup.td(align:"right","<a href=https://www.google.com />")
没有成功
使用 markup.td(class: "center",) { delegate.a(href: "www.google,com","link") } 成功了
我想在构建摘要页面中发布 html table。 作为该摘要的一部分,我想添加可点击的 link,这是我目前得到的:
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( )
也试过
markup.td(align:"right","<a href=https://www.google.com />")
没有成功
使用 markup.td(class: "center",) { delegate.a(href: "www.google,com","link") } 成功了