Can I send cppcheck results through slack in a jenkins pipeline?

56 views
Skip to first unread message

jesus fernandez

unread,
Apr 9, 2021, 2:39:18 AM4/9/21
to Jenkins Users
I just started using cppcheck, and I was wondering if there is any way to access to the report values (for instance number of total errors) and send it to slack. I have been searching in the documentation and here in SO but I have found nothing, as I just have been using Jenkins for a couple of months ( I am a junior dev) I was wondering if somebody know if this is possible and could drive me in the right direction.

Ullrich Hafner

unread,
Apr 9, 2021, 7:46:48 AM4/9/21
to Jenkins Users
Exporting results from one plugin into another plugin is definitely possible. You typically have two steps:
1) Export the data from a producer plugin
a) using Tokens
b) using API methods of the plugin
2) Import the data (or reformat and aggregate it) into a consumer plugin

For step 1 I can say this works for the warnings plugin, it can export the results of CppCheck either into tokens or into objects (that you can process using your pipeline). 

I have no idea if the slack plugin is capable of doing step 2 though, but I would assume that it works in that way...

Am 09.04.2021 um 08:39 schrieb jesus fernandez <jesusfern...@gmail.com>:

I just started using cppcheck, and I was wondering if there is any way to access to the report values (for instance number of total errors) and send it to slack. I have been searching in the documentation and here in SO but I have found nothing, as I just have been using Jenkins for a couple of months ( I am a junior dev) I was wondering if somebody know if this is possible and could drive me in the right direction.

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d3aee90e-5331-480f-84d7-4df7c3ebcf6fn%40googlegroups.com.

jesus fernandez

unread,
Apr 9, 2021, 7:59:20 AM4/9/21
to Jenkins Users
Thanks for replying, any documentation or link to guide me in the right direction on how to do it? I am quite Junior and have been learning Jenkins on my own

Ullrich Hafner

unread,
Apr 9, 2021, 8:03:39 AM4/9/21
to Jenkins Users

jesus fernandez

unread,
Apr 13, 2021, 10:17:55 AM4/13/21
to Jenkins Users
How can I access those token macros? (sorry if this is a silly question) I have never used them before, I tried to print the value with ```println ${ANALYSIS_ISSUES_COUNT, tool="cppcheck", type="NEW"}``` but I get an unexpected token error

Ullrich Hafner

unread,
Apr 14, 2021, 2:57:21 PM4/14/21
to Jenkins Users

jesus fernandez

unread,
Apr 15, 2021, 9:21:04 AM4/15/21
to Jenkins Users
Thanks it is working now, I am also wondering what is the tool-id when trying to access the details of the analysis result, explained here https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md#summary-of-the-analysis-result I cannot find other reference to what tool id is. I guess each tool (in my case cppcheck) has an id for the plugin what I cannot finde which ID correspond to each tool
Reply all
Reply to author
Forward
0 new messages