7

I'm relatively new to Jenkins and was wondering if there are any examples on suppressing scripted pipelines output in Jenkins.

I see this issue on jenkins website, but I'm not exactly sure how to implement.

I also didn't see a clear answer from a question on Stack Overflow about this issue.

I basically want to get rid of all the Pipeline stuff:

$ docker top 5f4682c000c81cbede8dc72f190b25254e049e9607ba008cbad72a78adab56a2 -eo pid,comm
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Check Style)
[Pipeline] ansiColor
[Pipeline] {
[Pipeline] sh
[ppetry_corpsite_apache_user-HHEF3S7EJLFY7ER74K63UO3KKEOJY46P57XF77IGT3LQ76I2UIJQ] Running shell script
+ lintcheck.sh




--------LINT RESULTS--------
********ALL TESTS PASSED*******


[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Check Syntax)
[Pipeline] ansiColor
[Pipeline] {
[Pipeline] sh
[ppetry_corpsite_apache_user-HHEF3S7EJLFY7ER74K63UO3KKEOJY46P57XF77IGT3LQ76I2UIJQ] Running shell script
+ syntaxcheck.sh




--------SYNTAX RESULTS--------
********ALL TESTS PASSED*******


[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Generate Puppet Auth Token)
[Pipeline] withCredentials
[Pipeline] {
[Pipeline] ansiColor
[Pipeline] {
[Pipeline] sh
[ppetry_corpsite_apache_user-HHEF3S7EJLFY7ER74K63UO3KKEOJY46P57XF77IGT3LQ76I2UIJQ] Running shell script
+ gentoken.sh
--------GENERATING PUPPET ACCESS TOKEN--------
Token generated successfully.


[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
$ docker stop --time=1 5f4682c000c81cbede8dc72f190b25254e049e9607ba008cbad72a78adab56a2
$ docker rm -f 5f4682c000c81cbede8dc72f190b25254e049e9607ba008cbad72a78adab56a2
[Pipeline] // withDockerContainer
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline

GitHub has been notified of this commit’s build result

Finished: SUCCESS
AmerllicA
  • 29,059
  • 15
  • 130
  • 154
Kris Reese
  • 111
  • 1
  • 1
  • 8
  • 2
    To be frank, does it really matter? :-) I'm processing a handful of various stages to conduct lint, syntax, validation, and code deployment. Having the Pipeline output elongate the amount of console output to peruse was not making the feedback digestible. In the event a stage fails, I want my end users to sift through the output without the cruft the Pipeline output clutters the screen with. So in that aspect, it's productive to me to make it easier on my end users to more easily interpret the console output. – Kris Reese Jul 02 '18 at 18:03
  • 2
    I think `echo` and `ansiColor` are particularly annoying – Gi0rgi0s Nov 03 '20 at 16:32

5 Answers5

17

Prerequisites:

Go to Manage Jenkins > Configure System > Theme. In Extra CSS field put the following

.pipeline-annotated {
    display: none;
}

Click save.

After that you will not see any [Pipeline] logs anymore.

Vitalii Vitrenko
  • 9,763
  • 4
  • 43
  • 62
6

I was able to solve the problem using the plugin mentioned in the previous answers with the following CSS:

.pipeline-new-node {
    display: none;
}
  • Thank you, it works in browser. However it does not apply to the ${BUILD_LOG_EXCERPT} inside the emailext() E-Mail notification block of the scripted pipeline. The log excerpt in the e-mail still contains [Pipeline]. It would be very nice to know how to extend the solution on this case also. – Alexander Samoylov Sep 15 '22 at 11:26
5

As @Vitalii Vitrenko mentioned, solved by install the Simple Theme Plugin. But in the new version of Jenkins(2.252 in my case) maybe u need to add another new style to make it works

.pipeline-annotated {
     display: none; 
}
.pipeline-new-node {
      display: none; 
}

see: JENKINS-41845

Kent
  • 371
  • 3
  • 6
2

The Jenkins Console Content is an HTML file / stream etc - aka you can change it's appearance with CSS and HTML styling.

The best way to do it(as it is described in the Ticket), is to use the Simple Theme Plugin.. With the help of it you can even react to some events in the DOM (Javascript, CSS).

So long story short: Install the Plugin and then override the CSS class pipeline- annotated to be hidden:

.pipeline-annotated {
    visibility: hidden;
}

In case this does not suppress all messages, you can look up other HTML elements present in the console and define similar settings for them.

Bela Tamas Jozsa
  • 714
  • 5
  • 10
  • Thanks for the hint on looking up other HTML elements present in the console to define similar settings. Much appreciated! – Kris Reese Jul 01 '18 at 03:00
0

Thanks to all the posters for the great hint. While trying it out I came up with another nuance: I did not want to "cripple" the whole Jenkins installation for each and every job, it sufficed for me that a particular job's output be rid of the "[Pipeline] echo" garbage in the middle of an output produced by a loop with printlns.

So I used the console features of modern browsers (F12 in most of them), and edited the in-memory CSS of the already rendered page. For example with Firefox, I went to the Style Editor tab, pressed the "+" button above the listing of CSS files in use, and added a runtime patch on top of these - with an example from the other answers here.

Et voila, with "pipeline-new-node" the garbage lines disappeared and my println'ed table data remained.

Thanks again to everyone who chimed in here (and/or linked to this answer from elsewhere).

Jim Klimov
  • 187
  • 6
  • 1
    this is not a solution for every user to see, rather a local one-time one-browser solution, if you want the solution to be visible for all users from every browser and every computer - then you have to use a server side solution that comes from the CSS as seen in "Vitalii Vitrenko" solution (and "Robson Bittencourt" solution) – Shaybc Sep 24 '19 at 14:16