I have a build job which uploads results to a certain URL.
How can I have a link to that URL shown on the build page?
I've tried to create an html page with redirect and add it to the artifacts but it seems a bit weird.
For a locally hosted Jenkins server, the URL would be: http://localhost:8080/env-vars.html.
Download the latest stable Jenkins WAR file to an appropriate directory on your machine. Open up a terminal/command prompt window to the download directory. Run the command java -jar jenkins. war .
Per job run? Or global for the whole job?
If your link is always static (example: latest artifacts only), you can use a Sidebar link plugin. https://wiki.jenkins-ci.org/display/JENKINS/Sidebar-Link+Plugin that will place a static link per job (for all runs).
If your link changes per run, here is what I do in my environment. I update the run's description with an <a href>
tag. The link won't show on the run page, however it works rather nicely in the build history.
Note above, the [Debug]
and [Release]
are unique links for each particular build.
For this, you would need Description Setter Plugin. https://wiki.jenkins-ci.org/display/JENKINS/Description+Setter+Plugin. And in the plugin (it is post-build action), just write pure HTML. You can use usual environment variables in there
<a href="http://whatever/${BUILD_NUMBER}">Link here</a>
Edit: note that nowadays it isn't that easy (if at all possible) to put html in the build history description. It does work on the individual build page.
If you want markup to be treated as such, you must enable it: Manage Jenkins > Global Security > Markup Formatter = Safe HTML
Then, for Jenkins scripted pipelines, you can simply set the currentBuild.description
property with some HTML. Example:
currentBuild.description = "Click <a href='http://yourlink'>here</a>"
The rendered HTML will show in the build history and on the build page.
If you don't see "Safe HTML" in the Markup Formatter drop-down, you probably need to install the OWASP Markup Formatter plugin.
At the time of this post, the Blue Ocean GUI will not display HTML for build descriptions. See issue here: https://issues.jenkins.io/browse/JENKINS-45719
This Chrome extension can serve as a workaround: https://chrome.google.com/webstore/detail/blue-ocean-description-ht/maahpenodjcdhodbonmdkfgnceddigae
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With