-
Improvement
-
Resolution: Unresolved
-
Trivial
-
None
-
CloudBees Jenkins Enterprise 2.7.19.0.1
-
Powered by SuggestiMate
Currently the pipeline plugin prints the steps into the console output, prefixed with [Pipeline]
[Pipeline] node Running on Agent1 in C:\Jenkins\workspace\TEST JOB [Pipeline] { [Pipeline] withEnv [Pipeline] { [Pipeline] withCredentials [Pipeline] { [Pipeline] bat [TEST JOB] Running batch script [Pipeline] } [Pipeline] // withCredentials [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node
Is it possible to have a flag somewhere to disable this logging, either in the pipeline itself or configurable at a master level. I'd like to remove this extra logging as it adds too much information to our output. Ideally this should read:
Running on Agent1 in C:\Jenkins\workspace\TEST JOB [TEST JOB] Running batch script
- relates to
-
JENKINS-38381 [JEP-210] Optimize log handling in Pipeline and Durable Task
-
- Resolved
-
- links to
[JENKINS-41845] Suppress default pipeline output
Code changed in jenkins
User: Marc MacIntyre
Path:
src/main/java/org/jenkinsci/plugins/workflow/job/console/WorkflowRunConsoleNote.java
http://jenkins-ci.org/commit/workflow-job-plugin/d0e19f62c377bbcace954176f65297b958c08dc6
Log:
Add the CSS class "pipeline-annotated" to all pipeline annotated console messages. This will allow the administrator to override the display of these messages using the Simple Theme Plugin.
This should fix JENKINS-41845
Resolved as of 2.18 by supporting use of the Simple Theme Plugin to hide these (they now include the pipeline-annotated class).
Examples for using the CSS class pipeline-annotated would be nice.
.pipeline-annotated { }
For me what worked was:
.pipeline-new-node {
display: none;
}
Yes the CSS was completely changed recently (see JENKINS-38381). Note however that if you hide the pipeline-new-node lines, you also lose the ability to collapse sections with the hide links. It ought to be possible to enhance NewNodeConsoleNote/script.js to have an option to hide all of these lines from the GUI, and recoverably.
jglick Can it be that this ability to collapse sections with "(hide)" links is actually broken? Please note that I have not even known that something like this exists, so either I have never noticed that because I am blind, or are these links (that only appear via mouse over) actually new? (I just updated Jenkins plugins – and having a lot of guts – including "workflow-job:2.29")
reinholdfuereder the (hide) links were introduced in workflow-job 2.26.
Thanks jglick – that explains my confusion/semi-blindness very well
And since updating workflow-job plugin is still not recommended according to plugin center, I guess there is no sense in filing an issue for that, as the corresponding developers like dnusbaum may be very well aware of it anyhow... ^^
Sorry for the fuss
I am the developer of this feature. If you are aware of some issues with it, please file in this component and assign to me, with steps to reproduce from scratch if possible.
I use scripted pipelines heavily and I think the ability to toggle these lines as an option is really useful, removing a lot of clutter from logs and improving productivity.
Its nearly impossible to click hide of hundreds of blocks I have in large pipelines and also Blueocean's declarative pipelines is not an option as its not meant for advanced/ complex pipelines and is only for pipeline rookies (simpler, application oriented use-cases)
jglick I am an experienced user of scripted pipelines but new to plugin development, let me know how I can help and I'll be happy to spend time on this
rgodavarthi this has little or nothing to do with Scripted vs. Declarative Pipeline syntax. You can use either the “classic” or Blue Ocean UIs to display execution results. (B.O. does impose certain restrictions on the structure of flow graphs which it is able to display; Declarative syntax is designed to only produce graphs which follow those restrictions, though you can do the same from Scripted syntax with a bit of care.)
At any rate,
removing a lot of clutter from logs
is a valid goal.
new to plugin development, let me know how I can help
This would be a patch to workflow-job-plugin, probably tested only interactively (mvn hpi:run) since I do not know of a straightforward way to automate it. I would try patching src/main/resources/org/jenkinsci/plugins/workflow/job/console/NewNodeConsoleNote/script.js to offer some sort of button to toggle display of pipeline-new-node spans, ideally persisting this preference in the browser. (It could also be stored in a UserProperty but that would require some more complicated Java plumbing I do not want to go into right now.)
Using: Jenkins 2.190.2,
Simple Theme plugin 0.5.1
- timestamp are enabled for all pipeline jobs.
after adding the following as extra css in simple theme plugin:
{{.pipeline-annotated
{ display: none; }}}
and:
{{.pipeline-new-node
{ display: none; }}}
I'm still seeing the lines that originally had the pipeline output, but now they only show the time and line number (other plugins I'm using).
here:
15:46:34 Started by user Dar Amit
15:46:34 Running in Durability level: PERFORMANCE_OPTIMIZED
15:46:34
15:46:34
15:46:34
15:46:34
15:46:34
15:46:34
15:46:34
15:46:34
15:46:34
15:46:34 test first stage
15:46:34
15:46:34
15:46:34 test second stage
15:46:34
15:46:34
15:46:34
when I view the console as plain text, I see:
[2019-12-12T13:36:20.913Z] Started by user Dar Amit
[2019-12-12T13:36:20.988Z] Running in Durability level: PERFORMANCE_OPTIMIZED
[2019-12-12T13:36:22.129Z] [Pipeline] Start of Pipeline
[2019-12-12T13:36:22.530Z] [Pipeline] parallel
[2019-12-12T13:36:22.578Z] [Pipeline] { (Branch: firstBranch)
[2019-12-12T13:36:22.583Z] [Pipeline] { (Branch: secondBranch)
[2019-12-12T13:36:22.629Z] [Pipeline] stage
[2019-12-12T13:36:22.664Z] [Pipeline] { (first)
[2019-12-12T13:36:22.666Z] [Pipeline] stage
[2019-12-12T13:36:22.670Z] [Pipeline]
[2019-12-12T13:36:22.694Z] [Pipeline] echo
[2019-12-12T13:36:22.694Z] test second stage
[2019-12-12T13:36:22.702Z] [Pipeline] }
Am I missing something here? I thought the whole idea was to remove those lines completely...
{{}}
UPDATE: removing the line number plugin and disable the timestamp in the jenkins configuration solved it, but still I would expect the line number and timestamp to show in the displayed lines (without all the pipeline output clutter).
I'm on Jenkins version 2.195, running in classic mode, and I added the following to the Simple Theme Plugin.
.pipeline-annotated {
display: none;
}
.pipeline-new-node {
display: none;
}
Works for me. The console is nice and clean. Only seeing the output I want/need to.
The workaround using Simple Theme Plugin can interact badly with other features. The most noticeable one is that there are lines that have multiple timestamps, as mentioned above. They have accumulated the timestamps from lines that were suppressed, but for which the timestamp was not suppressed. Tools that inspect the Jenkins log will not interact well with that. It's not acceptable to disable the timestamps. Another bad interaction is with the HTML used in status page summaries from the Badge plugin. Introducing the Simple Themes Plugin changes those. For example, table borders created using standard HTML, not CSS, disappear. The use case of interest to me is one where a pipeline job reads more than 100 configuration files, and there is a line containing only "readYAML" for each one. There are similar lines whenever the existence of a file is checked, or a file is written, so the beginning of the build has hundreds of almost empty lines. So a switch that controls default step output would be useful. It only matters for the commonly used basic steps. One of the side-effects of the default output is that two consecutive calls to echo result in output that is not on consecutive lines. So to get a multi-line output with consecutive lines, the string must be constructed with line breaks and then output in a single echo call. This is not ideal.
This css will hide timestamps plus the pipeline node log output
.pipeline-new-node { display: none!important; } span.timestamp:has(+ .pipeline-new-node) { display: none; }
Please file issues under the component pipeline if you do not actually know the plugin implementing a given aspect of behavior.