Ariel
Ariel

Reputation: 48

Suppress/Hide bash commands in jenkins logs

I want to suppress sh command output in the jenkins logs. The logs look noisy with all the command outputs and also I want to hide credentials from being print in the logs.

I found that we can use this command (#!/bin/sh -e) to suppress the script being output. But unfortunately this works only within a sh command.

My pipeline have multiple nodes/stages and I want to use this command at single place (like globally) and expect it works throughout the pipeline.

Any suggestion on how to do this in pipeline script code?

Ref: https://groups.google.com/forum/#!topic/jenkinsci-users/phhDyqLHFDw

Upvotes: 1

Views: 2232

Answers (1)

Ashokekumar S
Ashokekumar S

Reputation: 361

for blocking masking credentials you can use https://wiki.jenkins.io/display/JENKINS/Mask+Passwords+Plugin, for console log the better option would be to organize the logs rather than hiding it, so consider https://plugins.jenkins.io/collapsing-console-sections or there are smilar plugins which can help better loging

Upvotes: 1

Related Questions