Answers: <ol>
  <li><p>If you run a script you have to specify where the output goes.
  sh(returnStdout: true, script: &quot;echo 'this should not be logged it is secret'&quot;)
  returnStdout: true is standard, set it to false and nothing is shown</p>
  </li>
  <li><p>If you want to capture the output do.
  def msg = sh(returnStdout: false, script: &quot;echo 'this should not be logged it is secret'&quot;)</p>
  </li>
  <li><p>label: &quot;THIS SHOULD DISPLAY&quot; puts a Label on the &quot;sup&quot;step to display on the Jenkins site. What you see is the intended result.</p>
  </li>
  </ol>
  <p>conclusion:</p>
  <pre><code>node(&quot;master&quot;) {
      stage(&quot;Test&quot;) {
        script {
          def msg = sh(
              returnStdout: false, 
              label: &quot;THIS SHOULD DISPLAY&quot;,
              script: &quot;set -e; echo 'this should not be logged it is secret'&quot;
          )
          // do whatever you want with the output msg
        }
      }
  }
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2021-06-30T08:58:03.193Z
Answers: 2021-06-30T11:28:21.583Z
Answers: 2021-06-30T11:28:21.583Z
Answers: David
Body: <p>using a minimal jenkinsfile as an example</p>
  <pre><code>node(&quot;master&quot;) {
      stage(&quot;Test&quot;) {
          sh(
              label: &quot;THIS SHOULD DISPLAY&quot;,
              script: &quot;set -e; echo 'this should not be logged it is secret'&quot;
          )
      }
  }
  </code></pre>
  <p>For some reason the following occurs</p>
  <p><a href="https://i.sstatic.net/nL8lY.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nL8lY.jpg" alt="blue ocean logs" /></a></p>
  <p>I'm not sure what's going on here. Ideally I want the cmand not to be displayed and the label to take the place of the command.</p>
  
Comments: CC BY-SA 4.0
Comments: 2021-06-19T15:10:23.957Z
Comments: The screenshot does not seem to match your code. It has set +x. Do you have a screenshot of the code you shared?
Comments: ssc327
Comments: CC BY-SA 4.0
Comments: 2021-06-19T15:11:14.183Z
Comments: Can you also show a screenshot with the step expanded (click that arrow)
Comments: ssc327
Tags: <jenkins><jenkins-blueocean>
Title: Blue ocean logging my step commands
UserDisplayName: zevrant
ThreadText: # Blue ocean logging my step commands
  
  (Asked by: username_0 on 2021-06-09)
  
  using a minimal jenkinsfile as an example
  
  ```
  node("master") {
      stage("Test") {
          sh(
              label: "THIS SHOULD DISPLAY",
              script: "set -e; echo 'this should not be logged it is secret'"
          )
      }
  }
  
  ```
  
  For some reason the following occurs
  
  [![blue ocean logs](https://i.sstatic.net/nL8lY.jpg)](https://i.sstatic.net/nL8lY.jpg)
  
  I'm not sure what's going on here. Ideally I want the cmand not to be displayed and the label to take the place of the command.
  
  **Tags:** jenkins, jenkins-blueocean
  
  > **Comments:**
  > **username_1**: The screenshot does not seem to match your code. It has set +x. Do you have a screenshot of the code you shared?  
  > **username_1**: Can you also show a screenshot with the step expanded (click that arrow)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-06-30. Score: 1
  
  1. If you run a script you have to specify where the output goes.
     sh(returnStdout: true, script: "echo 'this should not be logged it is secret'")
     returnStdout: true is standard, set it to false and nothing is shown
  2. If you want to capture the output do.
     def msg = sh(returnStdout: false, script: "echo 'this should not be logged it is secret'")
  3. label: "THIS SHOULD DISPLAY" puts a Label on the "sup"step to display on the Jenkins site. What you see is the intended result.
  
  conclusion:
  
  ```
  node("master") {
      stage("Test") {
        script {
          def msg = sh(
              returnStdout: false, 
              label: "THIS SHOULD DISPLAY",
              script: "set -e; echo 'this should not be logged it is secret'"
          )
          // do whatever you want with the output msg
        }
      }
  }
  
  ```
  
  
  ---
  
  