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

workflow plugin does not provide console to warnings plugin, sleep required

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • warnings-ng-plugin
    • workflow-plugin 1.12
      warnings plugin 4.51
      jenkins 1.641

      I came up with the following workflow script brooken.groovy, which
      compiles a file with clang, and then invokes the warnings plugin.

      In the console log, there are warnings, but the warnings plugin detects zero warnings.

      I modified the script slightly (fixed.groovy) by inserting a sleep statement before calling the warnings plugin. I re-ran the script and the warnings plugin detected the warnings.

      It looks like the workflow-plugin is not providing the console to the warnings plugin when it needs it? Maybe a flush is missing?

          [JENKINS-32191] workflow plugin does not provide console to warnings plugin, sleep required

          Ulli Hafner added a comment -

          I added a 5sec sleep before I am scanning the console log quite some time ago. Since nobody mentioned that bug again, I think it is save to close this issue even though only a workaround has been applied.

          Ulli Hafner added a comment - I added a 5sec sleep before I am scanning the console log quite some time ago. Since nobody mentioned that bug again, I think it is save to close this issue even though only a workaround has been applied.

          Jesse Glick added a comment -

          FTR the workaround for the workaround is to not rely on console scanning, but rather to use the report file syntax and be explicit about what it is you wish to scan:

          tee('log.txt') {
              sh 'mvn -B -ntp -Dmaven.test.failure.ignore verify'
          }
          recordIssues(tools: [javaDoc(pattern: 'log.txt')])
          

          or

          sh 'bash -c "set -o pipefail; mvn -B -ntp -Dmaven.test.failure.ignore verify | tee log.txt"'
          recordIssues(tools: [javaDoc(pattern: 'log.txt')])
          

          This is more robust and modular anyway. A complex parallelized build might have a bunch of steps doing things only some of which make sense to scan for warnings in a given context.

          Jesse Glick added a comment - FTR the workaround for the workaround is to not rely on console scanning, but rather to use the report file syntax and be explicit about what it is you wish to scan: tee( 'log.txt' ) { sh 'mvn -B -ntp -Dmaven.test.failure.ignore verify' } recordIssues(tools: [javaDoc(pattern: 'log.txt' )]) or sh 'bash -c "set -o pipefail; mvn -B -ntp -Dmaven.test.failure.ignore verify | tee log.txt" ' recordIssues(tools: [javaDoc(pattern: 'log.txt' )]) This is more robust and modular anyway. A complex parallelized build might have a bunch of steps doing things only some of which make sense to scan for warnings in a given context.

          Jesse Glick added a comment -

          I would still suggest a block-scoped step, though:

          recordingIssues(tools: [javaDoc()]) {
              sh 'mvn -B -ntp -Dmaven.test.failure.ignore verify'
          }
          

          Jesse Glick added a comment - I would still suggest a block-scoped step, though: recordingIssues(tools: [javaDoc()]) { sh 'mvn -B -ntp -Dmaven.test.failure.ignore verify' }

          Ulli Hafner added a comment -

          Yes, of course. I started an implementation in the last year Hacktoberfest but never managed to finish it. Too many other open issues.

          Ulli Hafner added a comment - Yes, of course. I started an implementation in the last year Hacktoberfest but never managed to finish it. Too many other open issues.

          Tim Jacomb added a comment -

          drulli the work around may not be needed anymore after workflow-job 2.41? see https://github.com/jenkinsci/workflow-job-plugin/pull/184

          Tim Jacomb added a comment - drulli the work around may not be needed anymore after workflow-job 2.41? see https://github.com/jenkinsci/workflow-job-plugin/pull/184

          Ulli Hafner added a comment -

          Ah thanks! Yes, that means I can remove my 5 sec sleep

          Ulli Hafner added a comment - Ah thanks! Yes, that means I can remove my 5 sec sleep

          Ulli Hafner added a comment -

          I'm reopening so that I do not forget to remove the workaround in the warnings plugin.

          Ulli Hafner added a comment - I'm reopening so that I do not forget to remove the workaround in the warnings plugin.

          Alexander added a comment - - edited

          I do have a build that reports this as a notice before instantly aborting
          (the last line might lack a bunch of line breaks already from the start... stars were consumed by inserting it here):

           

          [GNU C Compiler (gcc)] Sleeping for 5 seconds due to JENKINS-32191...
          [GNU C Compiler (gcc)] Parsing console log (workspace: '/home/jenkins/agent/workspace/workspace/<project_name>/build')
          Unable to change directory using: .Entering directory (?<dir>.) to match Entering directory: D0750 0 deploy

           

          I now have to guess if its related in some way to the ticket right here
          (like some subdirs not yet present due to insufficient other process completion)
          or if it is something totally different (that i was unable to clearly track down for now).

          Setup:

          • Jenkins 2.346.3
          • workflow-job / Pipeline Job plugin 1207.ve6191ff089f8

          side note: if you had released your change already, then it would be less of a question, at least underneath this ticket.

          Alexander added a comment - - edited I do have a build that reports this as a notice before instantly aborting (the last line might lack a bunch of line breaks already from the start... stars were consumed by inserting it here):   [GNU C Compiler (gcc)] Sleeping for 5 seconds due to JENKINS-32191 ... [GNU C Compiler (gcc)] Parsing console log (workspace: '/home/jenkins/agent/workspace/workspace/<project_name>/build') Unable to change directory using: . Entering directory (?<dir>. ) to match Entering directory: D0750 0 deploy   I now have to guess if its related in some way to the ticket right here (like some subdirs not yet present due to insufficient other process completion) or if it is something totally different (that i was unable to clearly track down for now). Setup: Jenkins 2.346.3 workflow-job / Pipeline Job plugin 1207.ve6191ff089f8 side note: if you had released your change already, then it would be less of a question, at least underneath this ticket.

          Alexander added a comment -

          Found the reported line and breakage to be unrelated to this ticket.

          When doing some "scp" command with a "-v" flag for verbosity, then you might see messages like:

          Entering directory: D0750 0 deploy

          This will later on result in an error when doing some parsing with maybe e.g. warnings-ng (or similar).
          The final line where the codes then will exit is of that format:

          throw new ParsingException("Unable to change directory using: %s to match %s", makePath.toString(), line);

          For now i will drop the "-v" switch - but i probably also will do some report to the respective tooling that fails to hard for such a line.

          References:
          https://github.com/jenkinsci/analysis-model/blob/master/src/main/java/edu/hm/hafner/analysis/LookaheadParser.java
          https://unix.stackexchange.com/questions/655319/how-to-scp-from-remote-root-directory

          Alexander added a comment - Found the reported line and breakage to be unrelated to this ticket. When doing some "scp" command with a "-v" flag for verbosity, then you might see messages like: Entering directory: D0750 0 deploy This will later on result in an error when doing some parsing with maybe e.g. warnings-ng (or similar). The final line where the codes then will exit is of that format: throw new ParsingException("Unable to change directory using: %s to match %s", makePath.toString(), line); For now i will drop the "-v" switch - but i probably also will do some report to the respective tooling that fails to hard for such a line. References: https://github.com/jenkinsci/analysis-model/blob/master/src/main/java/edu/hm/hafner/analysis/LookaheadParser.java https://unix.stackexchange.com/questions/655319/how-to-scp-from-remote-root-directory

          Ulli Hafner added a comment -

          Please create an issue in the warnings plugin (or directly provide a PR that will improve the regular expression that scans for directory changes).

          Ulli Hafner added a comment - Please create an issue in the warnings plugin (or directly provide a PR that will improve the regular expression that scans for directory changes).

            drulli Ulli Hafner
            rodrigc Craig Rodrigues
            Votes:
            5 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: