So I have been trying to find a way to turn off logging basic pipeline steps like pwd(), fileExists(), readFile() or sh(), and I can’t seem to find a way.
I also tried looking into re-implementing fileExists() (without basic steps), so I wouldn’t get the steps showing up, but it seems pretty problematic. These steps show up hundreds of times since our groovy logic is pretty complex, which means a large portion of our logs is absolutely unnecessary or basically just clutter.
Surely there is a way right?
Any help and pointers would be greatly appreciated!
Jenkins 2.528.3
On the UI under pipeline steps, and on the Pipeline Graph plugin:
The hideFromView step/block that you’ve found is really the only good option at the moment.
I have created a few wrapper global vars in our jenkins shared library for common steps like fileExists. If you haven’t done something like this already, it’s an easy way to replace a pipeline step with the ‘hidden’ variant quickly across the entire library:
#!groovy
// vars/fileExistsHidden.groovy
/*
* Wrapper step to call fileExists pipeline step within a hideFromView block
* so the step is hidden from pipeline visualization
*/
public boolean call(String file) {
boolean result = false
hideFromView {
result = fileExists(file)
}
return result
}