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

provide a built-in "tool" for checking the Jenkins console

      I've been using warnings-ng with multiple external tools since a long time. Recently a colleague wanted to scan his Jenkins console for custom error lines, and I was going to recommend the warnings-ng plugin until I realized there is no built-in tool/parser for the Jenkins console.

      Would it be possible to have something like 

      recordIssues ...
      tools: [jenkinsConsole( patterns: ['myregex1', Severity.ERROR], ['regex2', Severity.WARNING])])
      

      which would just convert console lines matching the regex into errors/warnings without linking to a specific source file.

      I'm aware that I can do some of the parsing also by getting the log stream from the current build and that this somewhat overlaps with the functionality of the build failure analyzer plugin, but it would be nice to have something built-in that can be used by Jenkins users without digging into registering a new groovy parser for the plugin.

      Or did I just miss some existing functionality?

          [JENKINS-71235] provide a built-in "tool" for checking the Jenkins console

          Ulli Hafner added a comment -

          This looks similar to another feature request: JENKINS-53014

          Ulli Hafner added a comment - This looks similar to another feature request: JENKINS-53014

          Thanks for the pointer drulli . That looks quite useful since it would already fulfill the regex part completely. The only thing I don't yet understand is how I would specify to read the Jenkins console log instead of a certain external log file. Is there any "magic" file name or an actual file containing the log contents? Or some tricks with piping, redirection or similar? I was originally thinking of something similar to the mavenConsole() tool when I raised this issue, since I believe it already consumes (parts of) the Jenkins log, but you surely know that better I envision it.

          Michael Keppler added a comment - Thanks for the pointer drulli . That looks quite useful since it would already fulfill the regex part completely. The only thing I don't yet understand is how I would specify to read the Jenkins console log instead of a certain external log file. Is there any "magic" file name or an actual file containing the log contents? Or some tricks with piping, redirection or similar? I was originally thinking of something similar to the mavenConsole() tool when I raised this issue, since I believe it already consumes (parts of) the Jenkins log, but you surely know that better I envision it.

          Ulli Hafner added a comment -

          If you don't set a pattern, then the console log will be scanned.

          Ulli Hafner added a comment - If you don't set a pattern, then the console log will be scanned.

          I cannot get the console to be parsed. Rather 0 matching files are reported. Example pipeline:

          node ('master') {
              sh('echo FIXME simulate a warning')
              recordIssues(tools: [taskScanner(name: 'Open Issues', normalTags: 'FIXME')])
          } 

          output:

          [Open Issues] Searching for files in workspace '/opt/etas/jenkins_home/workspace/playground-michael' that match the include pattern '' and exclude pattern ''
          [Open Issues] -> found 0 files that will be scanned
          [Open Issues] Using the following tasks patterns:
          -> Normal: ^.*(\bFIXME\b)(.*)$
          
          [Open Issues] Scanning all 0 files for open tasks
          [Open Issues] Found a total of 0 open tasks
          [Open Issues] Skipping post processing
          [Open Issues] No filter has been set, publishing all 0 issues
          [Open Issues] Repository miner is not configured, skipping repository mining
          [Open Issues] Searching for files in workspace '/opt/etas/jenkins_home/workspace/playground-michael' that match the include pattern '' and exclude pattern ''
          [Open Issues] -> found 0 files that will be scanned
          [Open Issues] Using the following tasks patterns:
          -> Normal: ^.*(\bFIXME\b)(.*)$
          
          [Open Issues] Scanning all 0 files for open tasks
          [Open Issues] Found a total of 0 open tasks
          [Open Issues] Skipping post processing
          [Open Issues] No filter has been set, publishing all 0 issues
          [Open Issues] Searching for files in workspace '/opt/etas/jenkins_home/workspace/playground-michael' that match the include pattern '' and exclude pattern ''
          [Open Issues] -> found 0 files that will be scanned
          [Open Issues] Using the following tasks patterns:
          -> Normal: ^.*(\bFIXME\b)(.*)$
          
          [Open Issues] Scanning all 0 files for open tasks
          [Open Issues] Found a total of 0 open tasks
          [Open Issues] Skipping post processing
          [Open Issues] No filter has been set, publishing all 0 issues
          [Open Issues] Repository miner is not configured, skipping repository mining
          [Open Issues] Reference build recorder is not configured
          [Open Issues] Obtaining reference build from same job (playground-michael)
          [Open Issues] Using reference build 'playground-michael #64' to compute new, fixed, and outstanding issues
          [Open Issues] Issues delta (vs. reference build): outstanding: 0, new: 0, fixed: 0
          [Open Issues] No quality gates have been set - skipping
          [Open Issues] Health report is disabled - skipping
          [Open Issues] Created analysis result for 0 issues (found 0 new issues, fixed 0 issues)
          [Open Issues] Attaching ResultAction with ID 'open-tasks' to build 'playground-michael #66'.
          [Checks API] No suitable checks publisher found.
          Finished: SUCCESS

          Michael Keppler added a comment - I cannot get the console to be parsed. Rather 0 matching files are reported. Example pipeline: node ( 'master' ) {     sh( 'echo FIXME simulate a warning' )     recordIssues(tools: [taskScanner(name: 'Open Issues' , normalTags: 'FIXME' )]) } output: [Open Issues] Searching for files in workspace '/opt/etas/jenkins_home/workspace/playground-michael' that match the include pattern '' and exclude pattern '' [Open Issues] -> found 0 files that will be scanned [Open Issues] Using the following tasks patterns: -> Normal: ^.*(\bFIXME\b)(.*)$ [Open Issues] Scanning all 0 files for open tasks [Open Issues] Found a total of 0 open tasks [Open Issues] Skipping post processing [Open Issues] No filter has been set, publishing all 0 issues [Open Issues] Repository miner is not configured, skipping repository mining [Open Issues] Searching for files in workspace '/opt/etas/jenkins_home/workspace/playground-michael' that match the include pattern '' and exclude pattern '' [Open Issues] -> found 0 files that will be scanned [Open Issues] Using the following tasks patterns: -> Normal: ^.*(\bFIXME\b)(.*)$ [Open Issues] Scanning all 0 files for open tasks [Open Issues] Found a total of 0 open tasks [Open Issues] Skipping post processing [Open Issues] No filter has been set, publishing all 0 issues [Open Issues] Searching for files in workspace '/opt/etas/jenkins_home/workspace/playground-michael' that match the include pattern '' and exclude pattern '' [Open Issues] -> found 0 files that will be scanned [Open Issues] Using the following tasks patterns: -> Normal: ^.*(\bFIXME\b)(.*)$ [Open Issues] Scanning all 0 files for open tasks [Open Issues] Found a total of 0 open tasks [Open Issues] Skipping post processing [Open Issues] No filter has been set, publishing all 0 issues [Open Issues] Repository miner is not configured, skipping repository mining [Open Issues] Reference build recorder is not configured [Open Issues] Obtaining reference build from same job (playground-michael) [Open Issues] Using reference build 'playground-michael #64' to compute new, fixed, and outstanding issues [Open Issues] Issues delta (vs. reference build): outstanding: 0, new: 0, fixed: 0 [Open Issues] No quality gates have been set - skipping [Open Issues] Health report is disabled - skipping [Open Issues] Created analysis result for 0 issues (found 0 new issues, fixed 0 issues) [Open Issues] Attaching ResultAction with ID 'open-tasks' to build 'playground-michael #66'. [Checks API] No suitable checks publisher found. Finished: SUCCESS

          Ulli Hafner added a comment -

          The task scanner is the only parser that does not support the console log
          The idea for the task scanner is to parse a given set of files for patterns that contain the tasks. All other parsers work on a single report file (or multiple files) of the same format.

          Ulli Hafner added a comment - The task scanner is the only parser that does not support the console log The idea for the task scanner is to parse a given set of files for patterns that contain the tasks. All other parsers work on a single report file (or multiple files) of the same format.

            Unassigned Unassigned
            bananeweizen Michael Keppler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: