I have to read the jenkins console output and grep the line which has the string "%)"
. I am able to grep the line wit the following code:
def result = fileContents.findAll { it.contains('%)') }
println result*.toString()
Output:
× 35 of 45 failed (78%) 06:13 247 3 38 66 140
From the above line, I need to fetch and print only failed %. ie. 78 and make the Jenkins job failed if the failed % is above 50%
Can someone please help me with this using Groovy? Is there any other way to do it without using Groovy also fine for me?