I'm not sure I have terminology quite correct here, so I will try to explain as best as possible. I use Jenkins to run our Java automation. There are lots of long-running (2-10 hours) jobs executing constantly against different versions of the product under test. I need a way to look quickly at the Build History box of a job, and see which job is testing which product version.
I've used the Groovy Postbuild plugin successfully to add a badge (I think that is what it is) to the right of the build in the Build History Box. The actual groovy command is:
manager.addShortText(version, "grey", "white", "0px", "white")
The problem with this, is that it does not run until the build is complete. I need to do something like this before the build starts. (I will have access to the version pre-build, as it is passed in as a parameter)
You could use the Groovy Plugin (not groovy post-build) and execute a script as first action of your build (you need to use a system script in order to access Jenkins' classes.
Note however, that the mananger
in groovy post build plugin is a shortcut, so you would need something like:
build.getActions().add(GroovyPostbuildAction.createShortText(text));
Since the above construct does not quite work, try:
def action = new org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildAction(null, text);
action.color = "grey";
build.getActions().add(action);
Alternativly, you could just set the description:
build.description = text
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