Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:16
    codecov[bot] commented #750
  • 12:47
    codecov[bot] commented #750
  • 12:47
    uhafner synchronize #750
  • 12:47

    uhafner on scm-for-miner

    Add recordIssues stepin tests. (compare)

  • Jan 23 21:26
    codecov[bot] commented #750
  • Jan 23 20:58
    uhafner edited #750
  • Jan 23 20:58
    uhafner labeled #750
  • Jan 23 20:58
    uhafner opened #750
  • Jan 23 20:57

    uhafner on scm-for-miner

    Bump version of forensics. (compare)

  • Jan 22 19:18

    uhafner on master

    [maven-release-plugin] prepare … (compare)

  • Jan 22 19:18

    uhafner on v8.7.0

    (compare)

  • Jan 22 19:18

    uhafner on master

    [maven-release-plugin] prepare … (compare)

  • Jan 22 18:53

    uhafner on master

    Select blamer for a specific SC… Bump version of echarts to 4.9.… Fix warning. and 6 more (compare)

  • Jan 22 18:53

    uhafner on multiple-repositories

    (compare)

  • Jan 22 18:53
    uhafner closed #747
  • Jan 22 18:30
    codecov[bot] commented #747
  • Jan 22 18:03
    codecov[bot] commented #747
  • Jan 22 18:02
    uhafner synchronize #747
  • Jan 22 18:02

    uhafner on multiple-repositories

    Bump version of forensics to 0.… (compare)

  • Jan 22 16:30
    codecov[bot] commented #747
DavidA2014
@DavidA2014
@uhafner Forgive my ignorance, how would I identify and ping the author from the link you provided (it looks like you did the commit) ?
7 replies
Lübbe Onken
@luebbe

Hi folks,
I seem to have come across a RegEx evaluation problem in the taskScanner in warnings-ng 8.5.0.
The idea is to parse the following code, which reflects samples of annotations in our source code.

// ###DUPLICATE_CODE:Comment 1
Line of code
// ##COMPLAINT Comment 2
Line of code
// ##WARNING
Line of code
// ###ERROR - Comment 4
Line of code
// ##ERROR - Comment 5
Line of code

and extract the tags (anything prefixed by two or more '#') and description (anything following the tag until the end of the line, apart from a few separators)

So the expected result would be:

Tag:           Description:
DUPLICATE_CODE Comment 1
COMPLAINT      Comment 2
WARNING        <empty string>
ERROR          Comment 4
ERROR          Comment 5

Both regex below were tested on regex101.com

  1. \/\/.*##+(\w+)(?:\s|:|-)+(.*) This regex doesn't return the expected result on regex101 ('Line of code' instead of empty sting for 'WARNING'), but the taskScanner terminates and returns results on our source code-

  2. \/\/.*##+(\w+)(?:[:\- ]+(.+))? This regex returns the expected result on regex101 (no second group for 'WARNING'), but taskScanner crashes with a NPE on our code.

This probably means that our code contains some ##tags without a description part. The call stack for the NPE is the following:

java.lang.NullPointerException
    at io.jenkins.plugins.analysis.warnings.tasks.TaskScanner.scanTasks(TaskScanner.java:249)
    at io.jenkins.plugins.analysis.warnings.tasks.TaskScanner.scan(TaskScanner.java:201)
    at io.jenkins.plugins.analysis.warnings.tasks.AgentScanner.invoke(AgentScanner.java:89)
    at io.jenkins.plugins.analysis.warnings.tasks.AgentScanner.invoke(AgentScanner.java:27)
    at hudson.FilePath.act(FilePath.java:1077)
    at hudson.FilePath.act(FilePath.java:1060)
    at io.jenkins.plugins.analysis.warnings.tasks.OpenTasks.scan(OpenTasks.java:162)
    at io.jenkins.plugins.analysis.core.steps.IssuesScanner.scan(IssuesScanner.java:93)
    at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.scanWithTool(IssuesRecorder.java:736)
    at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.record(IssuesRecorder.java:702)
    at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.perform(IssuesRecorder.java:673)
    at io.jenkins.plugins.analysis.core.steps.RecordIssuesStep$Execution.run(RecordIssuesStep.java:1090)
    at io.jenkins.plugins.analysis.core.steps.RecordIssuesStep$Execution.run(RecordIssuesStep.java:1050)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Ullrich Hafner
@uhafner
I’m not sure if I understand the problem: are you saying that solution 1 works in Jenkins (but not somewhere else?).
For the NPE please create a bug report in Jira.
Lübbe Onken
@luebbe

I always test my regexes on regex101.com in order to find out where the problem comes from.

The two above can be accessed via:

  1. https://regex101.com/r/RErFrY/1
  2. https://regex101.com/r/RErFrY/2

There you can see the results which I tried to describe. I'll create a ticket in Jira tomorrow.

  1. doesn't cause a NPE in Jenkins, but probably misses a task which has no description.
  2. probably catches this task, but causes an NPE because of the missing description.
Lübbe Onken
@luebbe
https://issues.jenkins.io/browse/JENKINS-64622. Struggling with the Jira markup I have removed all formatting after all.
Lübbe Onken
@luebbe
@uhafner Amazing, I just saw this: https://github.com/jenkinsci/warnings-ng-plugin/releases/tag/v8.6.1. Thank you!
Ullrich Hafner
@uhafner
NPEs are the best bug reports :wink: Everything is part of the stacktrace, normally easy to fix
mti-mevis
@mti-mevis
We use Quality Gates to fail a build every time a new finding pops up. We use Open Task Scanner, CppCheck and CPD. There is a reset link for the each failed quality gates, which will disappears, when I click it, but the Quality Gate will not be reset. What do I do wrong?
Ullrich Hafner
@uhafner
The quality gate is reset for the next build. Did you try that?
mti-mevis
@mti-mevis

The quality gate is reset for the next build. Did you try that?

japp

Ullrich Hafner
@uhafner
Hmm, is there a message in the console log in the next build: "Resetting reference build, ignoring quality gate result for one build“?
How are the three tools configured? Pipeline/Freestyle? Single result, three results?
mti-mevis
@mti-mevis
How are the three tools configured? Pipeline/Freestyle? Single result, three results?
We use Freestyle Jobs, the results are aggregated to a single result. The mentioned logging appears. See:
00:01:17.734 [Open Tasks Scanner] Resetting reference build, ignoring quality gate result for one build
00:01:17.734 [Open Tasks Scanner] Using reference build 'MeVisAP/MAP19545/StaticAnalysis #12' to compute new, fixed, and outstanding issues
00:01:17.734 [Open Tasks Scanner] Issues delta (vs. reference build): outstanding: 927, new: 5, fixed: 0
00:01:17.734 [Open Tasks Scanner] Evaluating quality gates
00:01:17.734 [Open Tasks Scanner] -> FAILED - New (any severity): 5 - Quality QualityGate: 1
00:01:17.734 [Open Tasks Scanner] -> Some quality gates have been missed: overall result is FAILED
00:01:17.734 [Open Tasks Scanner] Health report is disabled - skipping
Ullrich Hafner
@uhafner
From which build is this result? From 13?
mti-mevis
@mti-mevis

From which build is this result? From 13?

12 was the last success. 13 was the first to fail. I clicked the reset button for the gate. This logging is from 14.

Ullrich Hafner
@uhafner
I see. The problem is that you are failing the build and it seems that you have not activated the option enabledForFailure. Can you try that?
Maksym Bordun
@maksym-bordun-ynd
Hi! Sometimes it is needed to analyze multiple services and/or multiple reports in one project, so in Stage View you get very long column with Warnings NG's trend charts on the right hand side, and huge empty area in the center, with pipeline stages somewhere on the bottom. Of course only when pipelines have larger amount of stages, or users have smaller screens, or users have some scaling in OS or browser.
Are there any workarounds to this? I mean trend charts are actually useful and I would like to keep them, but at least on the bottom (after the Stage View)
Ullrich Hafner
@uhafner

The Jenkins job page usability is a mess (well it is from another decade and unchanged since 2010 :angry:), it should be a configurable dashboard…

But anyway, you can try to aggregate several reports into a single report. Then you will get a single trend chart but all reports are still available in a subpage

Maksym Bordun
@maksym-bordun-ynd
Thanks for the idea!
Bill Collins
@mrginglymus
The workflow-api-plugin fix is released, so I'm no longer getting the double-fault causing a hard fail on my jobs; however, the deprecation warning appears to be setting the build to be a failure. Is there anything I can do to remediate that?
Ullrich Hafner
@uhafner
Which plugin sets a build to a failure if you are using deprecated step elements? I was not aware of that „feature"…
The new way to specify reference builds is by using the forensics-api plugin (and git-forensics plugin).
Bill Collins
@mrginglymus
image.png
This sets the stage result to failed, the build then continues to perform the rest of the pipeline, but hten the overall build fails
I'm updating our code to use the new way of doing reference builds, but that will be tricky for maintenance branches
There's nothing on the tail of the build log to suggest another cause for build failure
Ullrich Hafner
@uhafner

Ah, did you activate the option failOnError?

Our CI builds are all ok: https://ci.jenkins.io/job/Plugins/job/forensics-api-plugin/view/change-requests/job/PR-246/18/console

Bill Collins
@mrginglymus
Hmm, apparently yes I did
Our setup is currently mandating 0 warnings, and setting the stage+build to unstable if any are encountered. I set failOnError to true in the expectation that it would catch any malformed tool output and hard-stop.
Bill Collins
@mrginglymus
Presumably this will hit anyone with failOnError set. Is there a way we can soften the deprecation notice?
Ullrich Hafner
@uhafner
Not without code changes.
Is there a reason that you do not want to use the new step discoverReferenceBuild?
Bill Collins
@mrginglymus
Oh I will use it - but I have to rush the change out now to all my active branches, and also be prepared to backport it to maintenance branches in order to keep my builds green.
*backport it with urgency
Which is not ideal for a deprecation notice, where presumably there is some time before it will actually stop working.
Ullrich Hafner
@uhafner

I do not plan to remove the deprecated properties in the near future. I just wanted to make sure that everybody sees that now a new plugin is responsible for reference builds.

But if that hurts too much we can change from logError to logInfo

(At least if the option failOnError is set).
Bill Collins
@mrginglymus
Is it possible to defer logging the error until after the stageResultHandler has set the result? Perhaps by storing state in the IssuesPublisher (e.g. deprecatedReferenceFinderCalled set true in findConfiguredReference)?
Or would that still end up too hidden
Also, if it's non-trivial then I'll be fine with just updating the code; but I'd be surprised if others didn't also hit it.
Ullrich Hafner
@uhafner

Is it possible to defer logging the error until after the stageResultHandler has set the result? Perhaps by storing state in the IssuesPublisher (e.g. deprecatedReferenceFinderCalled set true in findConfiguredReference)?

That would make things too complicated.

I think changing logError to logInfo in case of failOnErroris the way (https://github.com/jenkinsci/warnings-ng-plugin/blob/master/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesPublisher.java#L202)

Bill Collins
@mrginglymus
OK, I will try to get a PR up tonight
thanks
Ullrich Hafner
@uhafner
:clap:
Ullrich Hafner
@uhafner
@mrginglymus ^^
Bill Collins
@mrginglymus
Thanks <3 no more explosions :)