How to display a hyperlink in hudson/jenkins build output console

前端 未结 2 1182
忘了有多久
忘了有多久 2020-12-11 02:51

How do I display a hyperlink (weblink) in hudson/jenkins build output console?

What I\'m trying to achieve is, during a hudson/jenkins build based on certain conditi

相关标签:
2条回答
  • 2020-12-11 03:35

    If you enter, for example:

    echo 'http://example.com'
    

    in a Build step Execute shell → Command the address will be hyperlinked in the Console Output, though not with target="_blank". But middle-clicking on it opens it in a new tab or window – depending on your browser preferences.

    0 讨论(0)
  • 2020-12-11 03:52

    When using a (system) groovy script or Jenkins job pipeline (without sandbox) you may want to try e.g.:

    import hudson.console.ModelHyperlinkNote
    println hudson.console.ModelHyperlinkNote.encodeTo('http://example.com', 'example')
    

    Please find the full API of hudson.console.ModelHyperlinkNote here: http://javadoc.jenkins-ci.org/hudson/console/ModelHyperlinkNote.html

    0 讨论(0)
提交回复
热议问题