[JIRA] (JENKINS-57312) Provide tokens for new and fixed warnings

52 views
Skip to first unread message

ullrich.hafner@gmail.com (JIRA)

unread,
May 13, 2019, 6:37:02 AM5/13/19
to jenkinsc...@googlegroups.com
Ulli Hafner updated an issue
 
Jenkins / New Feature JENKINS-57312
Provide tokens for new and fixed warnings
Change By: Ulli Hafner
Summary: Get Delta-Report in Pipeline Provide tokens for new and fixed warnings
The token {{ANALYSIS_ISSUES_COUNT}} reports the total number of warnings per tool. It makes sense to add additional tokens (or a configuration of the current token) that allows to report the number of new and fixed warnings (and the delta).

From the following requirements:

In my environment Jenkins currently sends automatically eMails to the Build-Requester with the status of the build incl. the link to the Job.

It would be great if it's possible to send directly the delta-report information of Warnings-NG, how many new warnings were introduced, how many solved, but I couldn't find out how to get this information within the pipeline.

In the web-interface I already can see this:

!image-2019-05-02-17-37-28-868.png!

I don't think that all developers are clicking on the link in the mail, but they would if the notification mail would already say: "10 new warnings introduced, please check and correct!"

 

Thanks!
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

christian.treczoks@continental-corporation.com (JIRA)

unread,
May 13, 2019, 7:10:01 AM5/13/19
to jenkinsc...@googlegroups.com
Christian Treczoks commented on New Feature JENKINS-57312
 
Re: Provide tokens for new and fixed warnings

I use in my scripted Pipeline "recordIssues", but it doesn't seem to return any object.

def issues = recordIssues sourceCodeEncoding: 'UTF-8', blameDisabled: true,
 tool: groovyScript(parserId: ParserName[i], pattern: "/${ParserPattern[i]}", reportEncoding:'UTF-8'),
 healthy: 1, minimumSeverity: 'NORMAL', unhealthy: 5

Delivers:

Cannot invoke method getNewIssues() on null object

How can I get to the ResultAction-object?

 

ullrich.hafner@gmail.com (JIRA)

unread,
May 13, 2019, 7:21:02 AM5/13/19
to jenkinsc...@googlegroups.com

recordIssues does not have a result (yet). Maybe I should change that together with [PR58](https://github.com/jenkinsci/warnings-ng-plugin/pull/58).

ullrich.hafner@gmail.com (JIRA)

unread,
May 13, 2019, 7:22:02 AM5/13/19
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on New Feature JENKINS-57312
{{recordIssues}} does not have a result (yet). Maybe I should change that together with [PR58|https://github.com/jenkinsci/warnings-ng-plugin/pull/58].

You need to replace the single line call with a call of the two steps in order to work on the objects.

ullrich.hafner@gmail.com (JIRA)

unread,
May 13, 2019, 7:22:03 AM5/13/19
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on New Feature JENKINS-57312
{{recordIssues}} does not have a result (yet). Maybe I should change that together with [PR58 ]( | https://github.com/jenkinsci/warnings-ng-plugin/pull/58 ) ] .

christian.treczoks@continental-corporation.com (JIRA)

unread,
May 13, 2019, 10:26:02 AM5/13/19
to jenkinsc...@googlegroups.com
Christian Treczoks updated an issue
 
Change By: Christian Treczoks
Attachment: image-2019-05-13-16-25-18-720.png

christian.treczoks@continental-corporation.com (JIRA)

unread,
May 13, 2019, 10:26:03 AM5/13/19
to jenkinsc...@googlegroups.com
Christian Treczoks commented on New Feature JENKINS-57312
 
Re: Provide tokens for new and fixed warnings

works really good! I get all the information I need and even a lot more compared to the simple number of warnings 

One final question: how can I get the name of the parser? I transfer the ID to "scanForIssues", but for reporting it in an eMail I would like to translate the ID to the parser-name. How can this be done?

jenkins.io@matthew-dews.com (JIRA)

unread,
May 13, 2019, 11:09:01 AM5/13/19
to jenkinsc...@googlegroups.com

Is there a way to get this information in a declarative pipeline? It looks like the right answer is to add a script block, but I prefer to stick to the declarative pipeline as much as possible.

Even the ANALYSIS_ISSUES_COUNT token doesn't work in a declarative pipeline, but that may be from my lack of understanding how it is supposed to be used

ullrich.hafner@gmail.com (JIRA)

unread,
May 13, 2019, 4:44:02 PM5/13/19
to jenkinsc...@googlegroups.com

Christian Treczoks The `action` from above has a `getDisplayName()` method that show the link name in the side panel. Or you can call `getLabelProvider()` to obtain an instance of the `LabelProvider` that handles all of the labels.

ullrich.hafner@gmail.com (JIRA)

unread,
May 13, 2019, 4:46:02 PM5/13/19
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on New Feature JENKINS-57312
[~christiantreczoks] The ` {{ action ` }} from above has a ` {{ getDisplayName() ` }} method that show shows the link name in the side panel. Or you can call ` {{ getLabelProvider() ` }} to obtain an instance of the `LabelProvider` that handles all of the labels.

ullrich.hafner@gmail.com (JIRA)

unread,
May 13, 2019, 4:46:02 PM5/13/19
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on New Feature JENKINS-57312
[~christiantreczoks] The {{action}} from above has a {{getDisplayName()}} method that shows the link name in the side panel. Or you can call {{ getLabelProvider()}} to obtain an instance of the `LabelProvider` that handles all of the labels.

ullrich.hafner@gmail.com (JIRA)

unread,
May 13, 2019, 4:48:02 PM5/13/19
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on New Feature JENKINS-57312
[~christiantreczoks] The {{action}} from above has a {{getDisplayName()}} method that shows the link name in the side panel. Or you can call {{getLabelProvider()}} to obtain an instance of the `LabelProvider` that handles all of the labels.

If you have a working example it would be quite helpful for others if we can put it into the [Documentation.md|https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md] file.

ullrich.hafner@gmail.com (JIRA)

unread,
May 13, 2019, 4:48:02 PM5/13/19
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on New Feature JENKINS-57312
[~christiantreczoks] The {{action}} from above has a {{getDisplayName()}} method that shows the link name in the side panel. Or you can call {{getLabelProvider()}} to obtain an instance of the `LabelProvider` that handles all of the labels.


If you have a working example it would be quite helpful for others if we can put it into [Documentation.md|https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md] file.

ullrich.hafner@gmail.com (JIRA)

unread,
May 13, 2019, 4:51:01 PM5/13/19
to jenkinsc...@googlegroups.com

Matthew Dews I have no idea on how to consume tokens in a declarative pipeline. Maybe here you should better ask on the mailing list or Gitter channel (or IRC).

ullrich.hafner@gmail.com (JIRA)

unread,
Jun 17, 2019, 5:00:03 PM6/17/19
to jenkinsc...@googlegroups.com
Ulli Hafner updated an issue
 
Change By: Ulli Hafner
Labels: newbie-friendly

ullrich.hafner@gmail.com (JIRA)

unread,
Jul 14, 2019, 2:46:04 PM7/14/19
to jenkinsc...@googlegroups.com
Ulli Hafner assigned an issue to Sladyn Nunes
Change By: Ulli Hafner
Assignee: Ulli Hafner Sladyn Nunes

ullrich.hafner@gmail.com (JIRA)

unread,
Jul 14, 2019, 3:00:02 PM7/14/19
to jenkinsc...@googlegroups.com
 
Re: Provide tokens for new and fixed warnings

I think, the best way would be to add a parameter to the existing token. This is simpler to implement and would reuse an already existing concept.

We basically need a new parameter of type String that will be converted to an enum similar to QualityGateType. In this enum we should have a function object that handles the correct property to report. Then we can provide all different values just with one enum.

So rather then using the hard coded getter action.getResult().getTotalSize(); we need to use enumInstance.getActualSizeMethodReference().apply(deltaReport);. The only problem is the delta report that is currently not persisted. I need to check what would be the best way to implement it.

ullrich.hafner@gmail.com (JIRA)

unread,
Jul 14, 2019, 4:28:03 PM7/14/19
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on New Feature JENKINS-57312
I think, the best way would be to add a parameter to the existing token. This is simpler to implement and would reuse an already existing concept.

We basically need a new parameter of type {{String}} that will be converted to an enum similar to {{QualityGateType}}. In this enum we should have a function object that handles the correct property to report. Then we can provide all different values just with one enum.

So rather then using the hard coded getter {{action.getResult().getTotalSize();}} we need to use {{enumInstance.getActualSizeMethodReference().apply(
deltaReport analysisResult );}}. The only problem is available properties are available in the delta report that is currently not persisted interface {{AnalysisBuildResult}} . I need to check what would be So the best way to implement it enum would probably look like:
{code}
    public enum IssueTokenType {
        /** Total number of issues
. */
        TOTAL(AnalysisBuildResult::getTotalSize),
        /** Total number of issues (severity Error). */
        TOTAL_ERROR(r  -> r.getTotalSizeOf(Severity.ERROR)),
        ....
        /** Number of new issues. */
        NEW(AnalysisBuildResult::getTotalSize),
        /** Number of new issues (severity Error). */
        NEW_ERROR(r  -> r.getNewSizeOf(Severity.ERROR)),
        ....
        /** Number of fixed issues. */
        FIXED(AnalysisBuildResult::getFixedSize),
       }

{code}

sladynnunes98@gmail.com (JIRA)

unread,
Jul 15, 2019, 1:52:02 PM7/15/19
to jenkinsc...@googlegroups.com

Makes sense to have them as it would, be like a swiss knife providing all the information we need right out of the box. I reckon we could add tests in the IssuesSizeTokenMacroTest and then add the relevant information to the Class.

ullrich.hafner@gmail.com (JIRA)

unread,
Jul 16, 2019, 4:53:02 PM7/16/19
to jenkinsc...@googlegroups.com

Yes, exactly. The stub needs to be extended with the other properties. But the approach should be straightforward.

ullrich.hafner@gmail.com (JIRA)

unread,
Sep 22, 2019, 5:09:02 PM9/22/19
to jenkinsc...@googlegroups.com
Ulli Hafner assigned an issue to Unassigned
 
Change By: Ulli Hafner
Assignee: Sladyn Nunes
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

ullrich.hafner@gmail.com (JIRA)

unread,
Sep 22, 2019, 5:09:03 PM9/22/19
to jenkinsc...@googlegroups.com
Ulli Hafner updated an issue
Change By: Ulli Hafner
Labels: help-wanted newbie-friendly

ullrich.hafner@gmail.com (JIRA)

unread,
Sep 24, 2019, 7:30:04 AM9/24/19
to jenkinsc...@googlegroups.com
Ulli Hafner assigned an issue to Ulli Hafner
Change By: Ulli Hafner
Assignee: Ulli Hafner

ullrich.hafner@gmail.com (JIRA)

unread,
Sep 24, 2019, 7:31:02 AM9/24/19
to jenkinsc...@googlegroups.com
Ulli Hafner started work on New Feature JENKINS-57312
 
Change By: Ulli Hafner
Status: Open In Progress

ullrich.hafner@gmail.com (JIRA)

unread,
Sep 24, 2019, 7:31:02 AM9/24/19
to jenkinsc...@googlegroups.com

ullrich.hafner@gmail.com (JIRA)

unread,
Sep 25, 2019, 8:57:02 AM9/25/19
to jenkinsc...@googlegroups.com
Change By: Ulli Hafner
Status: In Progress Fixed but Unreleased
Resolution: Fixed

ullrich.hafner@gmail.com (JIRA)

unread,
Sep 28, 2019, 5:14:03 PM9/28/19
to jenkinsc...@googlegroups.com
Change By: Ulli Hafner
Status: Fixed but Unreleased Resolved
Released As: 6.1.0

ullrich.hafner@gmail.com (JIRA)

unread,
Sep 28, 2019, 5:14:04 PM9/28/19
to jenkinsc...@googlegroups.com
Ulli Hafner updated an issue
Change By: Ulli Hafner
Labels: help-wanted newbie-friendly
Reply all
Reply to author
Forward
0 new messages