2016-04-29 106 views
6

我在Jenkins中寫了一個管道作業,它顯示了管道控制檯輸出中下游作業的輸出控制檯。這項工作目前還在進行中,但由於管道作業本身將所有回波線添加到輸出中,所以輸出結果很難讀取。如何在jenkins管道控制檯輸出中抑制源腳本行回聲?

Started by user [email protected] 
[Pipeline] Allocate node : Start 
Running on swqa-pr-prod-slave-1 in /srv/jenkins-slave/workspace/UUT Automated Regression - 1.20 
[Pipeline] node { 
[Pipeline] echo 

[Pipeline] echo 
///////////////////////////////////////////////// 
[Pipeline] echo 
       Start Execution     
[Pipeline] echo 
///////////////////////////////////////////////// 
[Pipeline] echo 

[Pipeline] echo 

[Pipeline] [monitor] echo 
[monitor] [EnvInject] - Loading node environment variables. 
[Pipeline] [monitor] echo 
[monitor] Building remotely on swqa-pr-prod-slave-1 (pr-prod-linux-slaves) in workspace /srv/jenkins-slave/workspace/Process Map Components Lock Down - 1.00 
[Pipeline] [monitor] echo 
[monitor] [EnvInject] - Injecting environment variables from a build step. 
[Pipeline] [monitor] echo 
[monitor] [EnvInject] - Injecting as environment variables the properties content 
[Pipeline] [monitor] echo 
[monitor] componentsLockDownScript=RegressionComponentsLockDown.py 
[Pipeline] [monitor] echo 
[monitor] modifyProcessMapXmlScript=ModifyXmlDom-1.20.py 
[Pipeline] [monitor] echo 
[monitor] uutAndNodePropertiesFile=DL380G8PR2-NodeData-(203).properties 
[Pipeline] [monitor] echo 
[monitor] 
[Pipeline] [monitor] echo 
[monitor] [EnvInject] - Variables injected successfully. 

是否有一個選項,配置,命令或任何在流水線插件或在Groovy或詹金斯讓我抑制所有額外的「呼應」,使控制檯輸出可讀性更強?

回答

0

你需要通過jenkins來做到嗎?如果沒有,你可以從控制檯直接用grep顯示它(假設你在Linux控制檯上的輸出):

cat YOUR_EXAMPLE_OUTPUT.txt | grep -v '\[Pipeline\]\|\[monitor\]\|^$' 

,將只留下了:

Started by user [email protected] 
Running on swqa-pr-prod-slave-1 in /srv/jenkins-slave/workspace/UUT Automated Regression - 1.20 

///////////////////////////////////////////////// 
       Start Execution     
///////////////////////////////////////////////// 

UPDATE: 如果你想要它「活」按照你的輸出和管道它變成一個行緩衝的grep:

tail -f YOUR_EXAMPLE_OUTPUT.txt | grep -v '\[Pipeline\]\|\[monitor\]\|^$' --line-buffered 
+0

是的,我想要的是在生成輸出控制檯時消除多餘的行,我不想等到作業完成後才處理/清除輸出。 –

0

你真的找什麼是JENKINS-26124。顯然你有這樣的解決方法,但是它的實現有一個缺陷,我們在這個問題中看不到。

相關問題