• 5.0.0-beta2

      I currently use the warnings plugin in a pipeline build by simply calling the build step. Doing this sets the build result to unstable, so I was checking that during the pipeline to determine whether some extra steps to run.

      Specifically, I have a parallel build, which builds on multiple different configurations in parallel, and I want to rename the log file for each build to "unstable" only if that configuration got warnings. However, the build result is global for the whole pipeline. How can I obtain the number of warnings or the "result" of the warnings step in such a way that each parallel invocation can get its own results? This allows me to rename my logged files so that users who look at the final results can quickly determine which configurations were faulty?

          [JENKINS-40164] Obtain parallel warnings results in pipeline

          Jacob Keller created issue -

          Ulli Hafner added a comment -

          Can you please describe in more detail what should work? Maybe you can write a small sketch of the scripts you would expect to work. I do not use pipelines on my own so it is hard to understand the actual requirement.

          Ulli Hafner added a comment - Can you please describe in more detail what should work? Maybe you can write a small sketch of the scripts you would expect to work. I do not use pipelines on my own so it is hard to understand the actual requirement.
          Ulli Hafner made changes -
          Link New: This issue is related to JENKINS-38399 [ JENKINS-38399 ]
          Ulli Hafner made changes -
          Link New: This issue is related to JENKINS-30551 [ JENKINS-30551 ]

          Ulli Hafner added a comment -

          Please also check if this is a duplicate of the referenced issues.

          Ulli Hafner added a comment - Please also check if this is a duplicate of the referenced issues.

          Jacob Keller added a comment -

          JENKINS-30551 is related but not identical to this issue.

          Basically, what I want to be able to do is to run the warnings plugin inside a parallel branch, so that I can scan warnings for a particular log file generated differently for each parallel branch. In this case, each branch is running on a separate node, and each node is a different version of the Linux Kernel, I am compiling a driver.

          I need to be able to determine the outcome of the warnings step inside the parallel branch. Unfortunately, the warnings plugin sets the entire job status, so if I just check the buildStatus variable directly, I am unable to determine whether the failure was this node or some other node, as the process is being run in parallel.

          Ideally, a separate pipeline specific step would be introduced which can run the warnings plugin and throws an exception when it fails. I could then catch the exception in the pipeline script, and handle it in various ways. My current job wants to rename a file to indicate whether the log has warnings or not.

          Finally, JENKINS-30551 is about making the display of multiple parallel branches work correctly which is a good thing but is not exactly related to my problem.

          Jacob Keller added a comment - JENKINS-30551 is related but not identical to this issue. Basically, what I want to be able to do is to run the warnings plugin inside a parallel branch, so that I can scan warnings for a particular log file generated differently for each parallel branch. In this case, each branch is running on a separate node, and each node is a different version of the Linux Kernel, I am compiling a driver. I need to be able to determine the outcome of the warnings step inside the parallel branch. Unfortunately, the warnings plugin sets the entire job status, so if I just check the buildStatus variable directly, I am unable to determine whether the failure was this node or some other node, as the process is being run in parallel. Ideally, a separate pipeline specific step would be introduced which can run the warnings plugin and throws an exception when it fails. I could then catch the exception in the pipeline script, and handle it in various ways. My current job wants to rename a file to indicate whether the log has warnings or not. Finally, JENKINS-30551 is about making the display of multiple parallel branches work correctly which is a good thing but is not exactly related to my problem.

          Ulli Hafner added a comment -

          I see. This is not supported yet. (Is there another plug-in that works this way?)

          Ulli Hafner added a comment - I see. This is not supported yet. (Is there another plug-in that works this way?)
          Ulli Hafner made changes -
          Link New: This issue is related to JENKINS-37325 [ JENKINS-37325 ]
          Ulli Hafner made changes -
          Summary Original: warnings pipeline parallel obtian "results" New: Obtain parallel warnings results in pipeline

          Jacob Keller added a comment -

          For example, in a pipeline, you can do something like:

          try {
          sh "some-command"
          catch (err) {
          "do stuff"
          }

          In a regular build, you would run shell script as part of the main build steps, and when the shell returns with a negative error code, the build result would become failure.

          However, the warnings plugin is run via the generic "step()" pipeline, and instead of returning an error or throwing an exception, the step literally sets the build status. This doesn't work in parallel since the whole build has a single status, and each parallel branch might result in different build status, and thus conflict.

          What I want is a new "scanWarnings" step which is a pipeline specific step we could call, and it would throw an exception, which we could catch in the pipeline code.

          It might be worth getting some input from someone who uses pipelines more?

          Jacob Keller added a comment - For example, in a pipeline, you can do something like: try { sh "some-command" catch (err) { "do stuff" } In a regular build, you would run shell script as part of the main build steps, and when the shell returns with a negative error code, the build result would become failure. However, the warnings plugin is run via the generic "step()" pipeline, and instead of returning an error or throwing an exception, the step literally sets the build status. This doesn't work in parallel since the whole build has a single status, and each parallel branch might result in different build status, and thus conflict. What I want is a new "scanWarnings" step which is a pipeline specific step we could call, and it would throw an exception, which we could catch in the pipeline code. It might be worth getting some input from someone who uses pipelines more?

            drulli Ulli Hafner
            jekeller Jacob Keller
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: