I've managed to do this without plugins ;)
https://x.com/eccenux/status/1858550202107346986
Would be nice to have and ability to add classes to elements probably.
Mark Waite (2024-11-18 15:56):
The badge plugin includes a createSummary Pipeline step
<https://github.com/jenkinsci/badge-plugin?tab=readme-ov-file#addsummary>
that will add an icon and text to the build page without adding
anything to the list of builds that is displayed on the left in the
build history.
The Groovy postbuild plugin also provides a createSummary step.
Mark Waite
On Monday, November 18, 2024 at 7:32:39 AM UTC-7 maciej wrote:
Hi,
Is there a way to add something to the description or to a build
page in general, but not to the build history?
So far, I came up with adding some spacers, but they make the
build history taller (add blank vertical space).
I specifically want to use Groovy because I already have a script
in Groovy that builds the log.
I'm using this in Groovy:
``` import hudson.FilePath def appendFileToBuildPage(build,
filePath, title) { // FilePath = compatible with running on remote
nodes def logFile = new FilePath(build.workspace, filePath) def
newContent = "" // Check file and add its content on the build
page if (logFile.exists()) { // spacers (should *not* show h2 in
build history) newContent += "\n<p>(${title.toLowerCase()}
available on the build page)</p>" newContent += "<p> </p>"
newContent += "<p> </p>" newContent += "<p> </p>" //
actual content newContent +=
"\n<h2>${title}</h2>\n<pre>${logFile.readToString()}</pre>"
newContent += "\n<hr>" } else { newContent += "<p>(the
${title.toLowerCase()} file is missing: ${filePath})</p>" } //
Append content to the description def existingDescription =
build.getDescription() ?: ""
build.setDescription(existingDescription + newContent) } // append
short info appendFileToBuildPage(build, "logs/short.log.wiki",
"Short log")
```
Cheers / Regards,
Maciej
--
You received this message because you are subscribed to the Google
Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/jenkinsci-users/0fcda178-abe2-46df-95b9-0eab8488cae3n%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/0fcda178-abe2-46df-95b9-0eab8488cae3n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google Groups "Jenkins
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/jenkinsci-users/b49297c8-a457-7729-4cb8-a951b28b005c%40mol.com.pl.