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

Strings from the "echo" step are suppressed in BlueOcean UI if they contain values found in an environment variable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: blueocean-plugin
    • Labels:
    • Environment:
      Jenkins: 2.138.1
      BlueOcean plugin: 1.8.2
      A clean install on Windows 7 with just a standard set of plugins
      Reproed with Chrome on Windows and Firefox on a Linux desktop
    • Similar Issues:

      Description

      When a string is displayed in the BlueOcean UI from an "echo" step, the string "Print Message" is displayed IF the string being echoed contains a substring that matches the contents of any environment variable. 

      Repro steps:

      Create a pipeline with this code:

      pipeline {
          agent any
          stages {
              stage('test') {
                  environment {
                      THING = 'foobarbuzz'
                  }
                  steps {
                      echo "blah"
                      echo "foobarbuzz"
                      echo "foobarZZZbuzz"
                      echo "This is a $THING here"
                  }
              }
          }
      }

      Run the pipeline via Blue Ocean

      Observe that there are four step labels displayed in the Blue Ocean UI. (see attached screenshot)  The first and third steps display the strings from "echo" as expected.  But, the second and fourth steps display only "Print Message" and don't show the expected string.  The user needs to click the step to expand it to see the string.  I would expect that all strings from all echo statements should show up in the main Blue Ocean UI and would not require some to be manually expended.

       

        Attachments

          Issue Links

            Activity

            Hide
            mcw Matt C. Wilson added a comment -

            A workaround that we're having success with is removing informational echo calls and instead using the `label` property on `sh`.  This was recently introduced in the Pipeline: Nodes and Processes plugin - required us to upgrade.  

            So 

            echo Doing the thing...

            sh ./the_thing.sh

            becomes

            sh(script: "./the_thing.sh", label: "Doing the thing...")

            and has the nice side effect of reducing the number of rows overall in Blue Ocean.

            https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#sh-shell-script
            https://plugins.jenkins.io/workflow-durable-task-step

            Show
            mcw Matt C. Wilson added a comment - A workaround that we're having success with is removing informational echo calls and instead using the ` label ` property on ` sh `.  This was recently introduced in the Pipeline: Nodes and Processes plugin - required us to upgrade.   So  echo Doing the thing... sh ./the_thing.sh becomes sh(script: "./the_thing.sh", label: "Doing the thing...") and has the nice side effect of reducing the number of rows overall in Blue Ocean. https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#sh-shell-script https://plugins.jenkins.io/workflow-durable-task-step
            Hide
            marcellodesales Marcello de Sales added a comment -

            Matt C. Wilson Can you specify the versions you tested those? I guess we can just write a script instruction to not echo anything and place the actual String in the label... have you tried that?

            Show
            marcellodesales Marcello de Sales added a comment - Matt C. Wilson Can you specify the versions you tested those? I guess we can just write a script instruction to not echo anything and place the actual String in the label... have you tried that?
            Hide
            brianjmurrell Brian J Murrell added a comment - - edited

            Matt C. Wilson Even using {{label:}}s produces inconsistent results:

            Those two steps in the red box are both of the form:

            sh label: <label_name>,
               script: '''...'''
            

            The first one is in the steps portion of the stage and looks like:

            sh label: env.STAGE_NAME,
               script: '''...'''
            

            and the second one is in the post->success portion of the stage and looks like:

             sh label: "Collect artifacts",
                 script: '''...'''
            

            But as you can see, they are displayed quite differently.

            I've opened JENKINS-59918 about this, FWIW.

            Show
            brianjmurrell Brian J Murrell added a comment - - edited Matt C. Wilson Even using {{label:}}s produces inconsistent results: Those two steps in the red box are both of the form: sh label: <label_name>, script: '''...''' The first one is in the steps portion of the stage and looks like: sh label: env.STAGE_NAME, script: '''...''' and the second one is in the post -> success portion of the stage and looks like: sh label: "Collect artifacts", script: '''...''' But as you can see, they are displayed quite differently. I've opened  JENKINS-59918 about this, FWIW.
            Hide
            mcshauno Shaun McDonnell added a comment -

            It's been a year and this hasn't been fixed.  Perhaps the standard/static Jenkins community is starting to die out a little bit in favor of things like Jenkins-X.  

            Show
            mcshauno Shaun McDonnell added a comment - It's been a year and this hasn't been fixed.  Perhaps the standard/static Jenkins community is starting to die out a little bit in favor of things like Jenkins-X.  
            Hide
            reinholdfuereder Reinhold Füreder added a comment -

            I would also be very happy about this issue being resolved (in order to nicely show a parameter value) and actually would have hoped that this is easy for someone like Liam Newman (of course I am not just trying to challenge him in any way )...

            The workaround with sh step using label attribute also requires a node wrapping context and thus is quite some runtime overhead too.
            JENKINS-55612 could also be considered some overhead with respect to written pipeline code.
            I am quite confused/concerned/surprised about the mentioned/found inconsistencies and whether or not this is actually on purpose (cf. parameter and env values) and why?
            Another workaround is adding a non-printable anywhere in the middle, e.g. for an URL parameter: echo "URL: '${params.URL.replace('.', '.\u007F')}'"

            Show
            reinholdfuereder Reinhold Füreder added a comment - I would also be very happy about this issue being resolved (in order to nicely show a parameter value) and actually would have hoped that this is easy for someone like Liam Newman (of course I am not just trying to challenge him in any way )... The workaround with sh step using label attribute also requires a node wrapping context and thus is quite some runtime overhead too. JENKINS-55612 could also be considered some overhead with respect to written pipeline code. I am quite confused/concerned/surprised about the mentioned/found inconsistencies and whether or not this is actually on purpose (cf. parameter and env values) and why? Another workaround is adding a non-printable anywhere in the middle, e.g. for an URL parameter: echo "URL: '${params.URL.replace('.', '.\u007F')}'"

              People

              • Assignee:
                Unassigned
                Reporter:
                sirgnip S Nelson
              • Votes:
                19 Vote for this issue
                Watchers:
                22 Start watching this issue

                Dates

                • Created:
                  Updated: