Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: add some text to the build summary

Tags:

jenkins

For each build in jenkins there's a page with a short summary of what happened in that build.
In my setup this page contains the list of commit messages that were added in this build, the name of the user who started that build and a note from the git plugin about the commit SHA1 and the branch name.

Is there a way for a normal script that I run as a build step to add something to this page? Is there a plugin which allows this?
I want to add a line with an HTML link to where the user can download this build.

like image 562
shoosh Avatar asked Nov 22 '15 16:11

shoosh


People also ask

How do I publish a text file in Jenkins?

Use ${FILE_SL:path/to/file. txt} to put file contents as single line (all CR and LF symbols are skipped). Specify rich text to be published on build and job summary pages for stable and (if corresponding checkboxes are selected) for unstable and failed builds. Build parameters may be put in ${PARAM_NAME} format.

What is post build task in Jenkins?

This feature allows user to associate shell or a batch scripts that perform some tasks on Jenkins depending on the build log output. If the log text has a match some where in the build log file, the script will execute and the post build log will append to the project build log. Java regular expression are allowed.


2 Answers

You can use the Description Setter plugin to add a custom HTML description.

A quick example :)

enter image description here

enter image description here

enter image description here

Does it help?

UPDATE: here is the syntax for a Jenkins pipeline script

  currentBuild.description = "<a href='http://stackoverflow.com'>Stackoverbuild build" + env.BUILD_ID + "</a>"
like image 174
Bruno Lavit Avatar answered Sep 30 '22 20:09

Bruno Lavit


I used Badge Plugin for something like this.
Example:

def summary1 = createSummary(icon:"notepad.png", text:"started Builds:<br>")
summary1.appendText("myBuild1: SUCCESS<br>", false)
summary1.appendText("myBuild2: UNSTABLE<br>", false)
like image 28
Roman Avatar answered Sep 30 '22 20:09

Roman