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

Error Signal Description not expandible in Blue Ocean when using Declarative Pipeline and Environment Variables

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • blueocean-plugin
    • None

      When defining a Declarative Pipeline which declares an environment directive error signal descriptions are not expandible in Blue Ocean view.

      declarative-pipeline-error-signal-example-with-env-var:

      pipeline {
      agent none
      environment {
      EXAMPLE_VARIABLE = 'This is an example variable'
      }
      stages {
      stage('Error Example') {
      steps {
      error "This is an error example using declarative pipeline"
      }
      }
      }
      }
      

      Note that when looking at Blue Ocean output that the error description is not expandible:

      The issue is not reproduced when using Scripted Pipeline.

      scripted-pipeline-with-env-var:

      node {
          withEnv(['EXAMPLE_VARIABLE="this is an example variable"']) {
              stage('Error Example') {
                  error "This is an example error message using scripted pipeline"
              }
          }
      }
      

      Error is expandible in Blue Ocean:

       

      Looking at the console logs in the Declarative Pipeline example.

      declarative-pipeline-error-signal-example-with-env-var.log:

      blueocean.js:18586 Browser configuration of @jenkins-cd/logging is explained at https://tfennelly.github.io/jenkins-js-logging/index.html#browser-config
      jenkins-js-extension.js:47602 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive.
      blueocean.js:2752 Uncaught TypeError: Cannot read property 'indexOf' of undefined
      at trimRestUrl (blueocean.js:2752)
      at getPrefetchedDataFuture (blueocean.js:2762)
      at request (blueocean.js:2629)
      at DeDupeCallTracker.dedupe (blueocean.js:7920)
      at dedupe (blueocean.js:7943)
      at Object.rawFetch (blueocean.js:2659)
      at Object.fetch (blueocean.js:2737)
      at jenkins-js-extension.js:50210
      at invokeFunc (jenkins-js-extension.js:7887)
      at trailingEdge (jenkins-js-extension.js:7934)
      trimRestUrl @ blueocean.js:2752
      getPrefetchedDataFuture @ blueocean.js:2762
      request @ blueocean.js:2629
      dedupe @ blueocean.js:7920
      dedupe @ blueocean.js:7943
      rawFetch @ blueocean.js:2659
      fetch @ blueocean.js:2737
      (anonymous) @ jenkins-js-extension.js:50210
      invokeFunc @ jenkins-js-extension.js:7887
      trailingEdge @ jenkins-js-extension.js:7934
      timerExpired @ jenkins-js-extension.js:7922
      blueocean.js:18807 [ERROR - io.jenkins.blueocean.dashboard.karaoke.Pager.Step] Error fetching page - fetch log TypeError: Cannot read property 'newStart' of undefined
      at jenkins-js-extension.js:51074
      at <anonymous>
      error @ blueocean.js:18807
      (anonymous) @ jenkins-js-extension.js:51100

          [JENKINS-46112] Error Signal Description not expandible in Blue Ocean when using Declarative Pipeline and Environment Variables

          Andrew Bayer added a comment -

          So the difference is that the scripted example has a LogActionImpl on the ErrorStep FlowNode, while the Declarative example does not. I'm trying to figure out why that is now.

          Andrew Bayer added a comment - So the difference is that the scripted example has a LogActionImpl on the ErrorStep FlowNode , while the Declarative example does not. I'm trying to figure out why that is now.

          Andrew Bayer added a comment -

          So...I cannot for the life of me tell you what changed that makes this work Declarative 1.2 (i.e., the master branch) but...something did. I've got a PR up demonstrating this - https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/180 - the test fails with 1.1.9, passes with master.

          Andrew Bayer added a comment - So...I cannot for the life of me tell you what changed that makes this work Declarative 1.2 (i.e., the master branch) but...something did. I've got a PR up demonstrating this - https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/180 - the test fails with 1.1.9, passes with master.

          Andrew Bayer added a comment -

          also, fwiw, it doesn't seem to be different dependency versions that cause this change in behavior - I've got a local install running core 2.60.2 and latest of everything for that, and the LogAction is missing in my test run there. The only difference between that and running the test in the unit tests here is Declarative stuff. shrug

          Andrew Bayer added a comment - also, fwiw, it doesn't seem to be different dependency versions that cause this change in behavior - I've got a local install running core 2.60.2 and latest of everything for that, and the LogAction is missing in my test run there. The only difference between that and running the test in the unit tests here is Declarative stuff. shrug

          James Dumay added a comment -

          Setting as blocker for Blue Ocean 1.2 release

          James Dumay added a comment - Setting as blocker for Blue Ocean 1.2 release

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
          http://jenkins-ci.org/commit/pipeline-model-definition-plugin/0ca46234cefaeeda2791835b2fc9201e2997f70e
          Log:
          JENKINS-46112 Test demonstrating that error steps get log actions now

          They didn't in 1.1.9 (and probably earlier) for no reason I can figure
          out, but they do now. Again, for no reason I can figure out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java http://jenkins-ci.org/commit/pipeline-model-definition-plugin/0ca46234cefaeeda2791835b2fc9201e2997f70e Log: JENKINS-46112 Test demonstrating that error steps get log actions now They didn't in 1.1.9 (and probably earlier) for no reason I can figure out, but they do now. Again, for no reason I can figure out.

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
          pipeline-model-definition/src/test/resources/logActionPresentForError.groovy
          http://jenkins-ci.org/commit/pipeline-model-definition-plugin/83d002b6f28490591489173259acd4578a01161a
          Log:
          Merge pull request #180 from abayer/jenkins-46112

          JENKINS-46112 Test demonstrating that error steps get log actions now

          Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/e2f89933976a...83d002b6f284

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java pipeline-model-definition/src/test/resources/logActionPresentForError.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/83d002b6f28490591489173259acd4578a01161a Log: Merge pull request #180 from abayer/jenkins-46112 JENKINS-46112 Test demonstrating that error steps get log actions now Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/e2f89933976a...83d002b6f284

          Andrew Bayer added a comment -

          This will be fixed in Declarative 1.2, as a side effect of the JENKINS-42753 parser rewrite. That thing is magic, I tell you.

          Andrew Bayer added a comment - This will be fixed in Declarative 1.2, as a side effect of the JENKINS-42753 parser rewrite. That thing is magic , I tell you.

            abayer Andrew Bayer
            owood Owen Wood
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: