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

Include failed step's error to it's log

    XMLWordPrintable

Details

    • frank, tethys, christmas

    Description

      A pipeline step's failure does not get reported in it's log. For example archiver step failure gets reported in overall run's log.

      As discussed with svanoort, a possible hack around it would be to use failed step's flowNode's ErrorAction, FlowNode.getError().getError().getMessage() and append it to the step's log.

      In blueocean API, step's log is AnnotatedLargeText, and it can be served in streaming fashion, it should be done in such a way to correctly append it to the end of step's log.

      Attachments

        Issue Links

          Activity

            jamesdumay James Dumay added a comment - vivek here's the example svanoort gave https://github.com/jenkinsci/pipeline-stage-view-plugin/blob/master/rest-api/src/main/java/com/cloudbees/workflow/rest/external/ErrorExt.java#L62
            jamesdumay James Dumay added a comment -

            Need to understand scope

            jamesdumay James Dumay added a comment - Need to understand scope
            michaelneale Michael Neale added a comment - - edited

            vivek would this include cases like https://issues.jenkins-ci.org/browse/JENKINS-39440 (eg a syntax error which only happens dynamically) or a failure to provision an agent before the pipeline starts (which is captured in the overall log only) as well?

            For example, this script will cause a failure that shows up nothing in node logs (stack trace in main log):

            def foo = null
            
            node {
                stage('blah') {
                    sh "echo 42"
                    foo.bar = 42
                    
                }
            }
            

            And this case shows it failing to start, but not showing up anything in step logs:

            stage('boo') {
                node('nfdslfdsklfjlkdsjlk') {
                    sh "echo 42"
                }
                
            }
            

            In both cases above, the full log shows what is needed but the step logs do not. Will the scope include these?

            michaelneale Michael Neale added a comment - - edited vivek would this include cases like https://issues.jenkins-ci.org/browse/JENKINS-39440 (eg a syntax error which only happens dynamically) or a failure to provision an agent before the pipeline starts (which is captured in the overall log only) as well? For example, this script will cause a failure that shows up nothing in node logs (stack trace in main log): def foo = null node { stage('blah') { sh "echo 42" foo.bar = 42 } } And this case shows it failing to start, but not showing up anything in step logs: stage('boo') { node('nfdslfdsklfjlkdsjlk') { sh "echo 42" } } In both cases above, the full log shows what is needed but the step logs do not. Will the scope include these?
            michaelneale Michael Neale added a comment -

            Had a discussion with svanoort and vivek and agreed this is doable

            michaelneale Michael Neale added a comment - Had a discussion with svanoort and vivek and agreed this is doable
            jamesdumay James Dumay added a comment -

            vivek this is another one to look at over the next week if you find time.

            jamesdumay James Dumay added a comment - vivek this is another one to look at over the next week if you find time.

            People

              vivek Vivek Pandey
              vivek Vivek Pandey
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: