Matteo Scandolo | 6784281 | 2021-07-13 16:52:13 -0700 | [diff] [blame] | 1 | // stops all the kail processes created by startComponentsLog |
| 2 | |
| 3 | def call(Map config) { |
| 4 | |
| 5 | def defaultConfig = [ |
| 6 | logsDir: "$WORKSPACE/logs", |
| 7 | compress: false, // wether to compress the logs in a tgz file |
| 8 | ] |
| 9 | |
| 10 | def tag = "jenkins-" |
| 11 | println "Stopping all kail logging process" |
| 12 | sh """ |
| 13 | P_IDS="$(ps e -ww -A | grep "_TAG=jenkins-kail" | grep -v grep | awk '{print $1}')" |
| 14 | if [ -n "$P_IDS" ]; then |
| 15 | for P_ID in $P_IDS; do |
| 16 | kill -9 $P_ID |
| 17 | done |
| 18 | fi |
| 19 | """ |
| 20 | if (compress) { |
| 21 | sh """ |
| 22 | tar czf ${logsDir}/combined.tgz * |
| 23 | rm *.log |
| 24 | """ |
| 25 | |
| 26 | } |
| 27 | } |