How to add a new line to a description in Jenkins

How to add a new line to the description in Jenkins when I change it programmatically?

I tried something like this:

job.builds[0].description = "hello" << '\n' << "world"

and console scripts print well:

hello

world

but in Jenkins’s description this work has a “hello world” without a new line helloandworld

Is there any way to do this?

+4
source share
1 answer

Ok, I found the answer.

Description is Raw Html.

To create a new line, we must write:

job.builds[0].description = "hello<br> world"

The console will print it as hello<br> world, but there will be a new line in the description.

+8
source

All Articles