0

I'm trying to silent the echo command so that it doesn't display me the output on Jenkins console. I'm defining value of abc variable just at the beginning of pipeline. Following is the script:

steps{
  script{
     xyz = sh(script: "echo ${abc} | base64 --decode", returnStdout: true).trim()
}
}

How can I silent or hide the value of abc appearing in the console?

gaurav sharma
  • 91
  • 1
  • 10
  • You mean hiding command itself? Because with `returnStdout: true` no output will be shown in console by itself. – markalex Aug 04 '23 at 14:10
  • Does this answer your question? [Hide command executed, only show output](https://stackoverflow.com/questions/47523909/hide-command-executed-only-show-output) – markalex Aug 04 '23 at 14:12
  • Hi @markalex - it shows me echo and then value on the Jenkins console. I want this to get executed in silent mode. – gaurav sharma Aug 04 '23 at 14:33

1 Answers1

0

I managed to hide the echo command using below script in Jenkins pipeline .. Anyone looking for this answer please follow below script:

steps{
  script{
     sh "set +x && echo ${abc} | base64 --decode > abc.txt"
     xyz = sh(script: "cat abc.txt, returnStdout: true)
}
}

Thanks

gaurav sharma
  • 91
  • 1
  • 10