How to add a hyperlink in jenkins build description using scripted pipeline

Viewed 2511

Using jenkins build description plug in I want to print a path of my network drive.

Below code is working fine.


        stage('print') {
            env.SMBuildDescription="Build path:"+"${buildpath}"
            currentBuild.description=SMBuildDescription
        }

But I want to add build path as a hyperlink.

1 Answers

Try this:

stage('print') {
            currentBuild.description = """Build path: <a href="${buildpath}">Link</a> """
        }

This will only work if Markup Formatter is set to Safe HTML (rather than Plain text) under /configureSecurity/ on your Jenkins instance.

Related