Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38399

Number of new warnings not calculated correctly when using pipeline

      When using Pipeline and the Warnings plug-in, the delta is not calculated correctly.
      We use the Warnings plug-in to:

      • Fail a build when there are any compiler warnings (GCC), in a Build stage.
      • Fail a build when more PC-Lint warnings are introduced. in a Analysis stage.

      Previously we had separate jobs for Build and Analysis, but we are trying to move to using actual pipelines (instead of "chaining jobs").

      The first build will run fine. It reports zero GCC warnings and, let's say, 124 PC-Lint warnings from old legacy code.
      When I re-run the build on the same sources, I expect it to be successful again, because no new warnings have been introduced.
      However, it states that the threshold of zero is exceeded by 124, when recording the PC-Lint warnings.

      I reckon this is due to the fact that the PC-Lint warning count is compared against the GCC warning count, because they are effectively in the same job even though they are not in the same stage.
      Personally I would expect the difference to be calculated based on what was previously seen in the same stage, or perhaps even for the same parser.

      If there is another plug-in that allows me to do this in a similar matter and when using pipelines, I'd also love to know.

          [JENKINS-38399] Number of new warnings not calculated correctly when using pipeline

          Arno Moonen added a comment -

          Retested this with newer versions (latest version available at this point in time) and the issue is still present:

          • Jenkins 2.19.4
          • Warnings plug-in 4.58
          • Pipeline 2.4
          • Pipeline Buildstep 2.4

          I reckon more plug-ins must have similar issues.

          Arno Moonen added a comment - Retested this with newer versions (latest version available at this point in time) and the issue is still present: Jenkins 2.19.4 Warnings plug-in 4.58 Pipeline 2.4 Pipeline Buildstep 2.4 I reckon more plug-ins must have similar issues.

          Ulli Hafner added a comment -

          Of course, nothing has been changed in the latest release with regard to this issue

          Can you please add a small example pipeline script (a snippet that shows the different stages with the warnings calls is sufficient) to see how you would like to interact with the warnings plug-in? Maybe I can create a new test case in our ATH that makes it clear what needs to be implemented.

          Ulli Hafner added a comment - Of course, nothing has been changed in the latest release with regard to this issue Can you please add a small example pipeline script (a snippet that shows the different stages with the warnings calls is sufficient) to see how you would like to interact with the warnings plug-in? Maybe I can create a new test case in our ATH that makes it clear what needs to be implemented.

          Arno Moonen added a comment -

          Basically what I do is:

          • Build (stage, with parallel 'children')
            • Visual Studio
            • GCCcompiler
          • Static Code Analysis (stage, with parallel 'children')
            • PC-Lint
            • SomeOtherTool

          In each of these children I use the Warnings plug-in, similar to:

          step(	[$class: 'WarningsPublisher',
          		canRunOnFailed: true,
          		consoleParsers: [
          			[parserName: 'GNU Make + GNU C Compiler (gcc)']
          		],
          		defaultEncoding: '',
          		excludePattern: '',
          		failedNewAll: '0',
          		failedTotalAll: '0',
          		healthy: '',
          		includePattern: '',
          		messagesPattern: '',
          		unHealthy: '',
          		useDeltaValues: true,
          		useStableBuildAsReference: true
          	])
          

          However, i tried to simplify my pipeline script in order to share it with you, and during the process I came upon a configuration that does work somehow.
          Hopefully I have sometime to investigate the difference between my previous script and the simplified version, so I can perhaps get some more insight on what might be causing this behavior.

          Arno Moonen added a comment - Basically what I do is: Build (stage, with parallel 'children') Visual Studio GCCcompiler Static Code Analysis (stage, with parallel 'children') PC-Lint SomeOtherTool In each of these children I use the Warnings plug-in, similar to: step( [$class: 'WarningsPublisher' , canRunOnFailed: true , consoleParsers: [ [parserName: 'GNU Make + GNU C Compiler (gcc)' ] ], defaultEncoding: '', excludePattern: '', failedNewAll: '0' , failedTotalAll: '0' , healthy: '', includePattern: '', messagesPattern: '', unHealthy: '', useDeltaValues: true , useStableBuildAsReference: true ]) However, i tried to simplify my pipeline script in order to share it with you, and during the process I came upon a configuration that does work somehow. Hopefully I have sometime to investigate the difference between my previous script and the simplified version, so I can perhaps get some more insight on what might be causing this behavior.

          Ulli Hafner added a comment -

          If this happens again reopen. (Or check if it is the same as one of the referenced issues).

          Ulli Hafner added a comment - If this happens again reopen. (Or check if it is the same as one of the referenced issues).

            drulli Ulli Hafner
            arnom Arno Moonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: