I am using Jenkins to setup automated builds in my company. Each build is tagged centrally with an 'id'. Basically, that id encapsulates everything associated with that id, and all information can be looked up in a portal and tracked. The problem is that, this build is tagged via Gradle (since Jenkins isn't the only way one can build a package), and the Gradle log outputs this in the following format:
CENTRALBUILD.TAGGING.TAG.ID:+33295/4fr4de34
CENTRALBUILD.TAGGING.TAG.ID:+33295/2214de34
Now, what I want to do is, be able to get these tags (there are mutliple tags for certain projects in case they are configured to build subprojects under a different tag) and then send it as an email like:
Hello User,
...
Build tags from your build:
+33295/4fr4de34
+33295/2214de34
I am using the Email-ext plugin, but the documentation is so poor, that I have no idea where to even begin. Any startings steps or examples I can look for will be great.
Well first, don't know if you read it or not, but there is a pretty detailed help with example within the plugin itself. Just click the Content Token Reference ? link.
Next, if these are output in the console log, you can simple RegEx them from the log and add to email as is. Multiple lines will be picked up in order.
Something like:
${BUILD_LOG_REGEX, regex="(?i)\\bCENTRALBUILD\\b", showTruncatedLines=false}
Note: the documentation shows \b but I had to use \\b to get it to work, probably the documentation snippet is being escaped incorrectly.
Play around with the RegEx to get what you need.
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