Extracting of jenkins error

45 views
Skip to first unread message

james prakash

unread,
Jan 19, 2021, 5:14:08 AM1/19/21
to Jenkins Users
How to find specific errors from jenkins console output and print them by echo statement 

Victor Martinez

unread,
Jan 19, 2021, 8:21:59 AM1/19/21
to Jenkins Users
There are different approaches but need more information, can you elaborate? 

james prakash

unread,
Jan 19, 2021, 1:13:12 PM1/19/21
to Jenkins Users
For example I made a missing of closing statement " } " in my pipeline script as shown below
cats2.jpg



Which  produces the error in jenkins console output as shown below 
cats1.jpg


So I want to print out the wrong statement in my jenkins output (using echo ) along with buildnumber ,build outcome as shown below .


catsw.jpg

For example in this particular build it should say expecting '}', found '' @ line 23, column 1. 

Victor Martinez

unread,
Jan 20, 2021, 8:05:59 AM1/20/21
to Jenkins Users
I understand now, thanks.

I'm afraid in your case the issue is related to a syntax error in the Pipeline so nothing about a runtime error, so there is no way to run any echo as you want.

Though If I recall the Text Area field had a syntax validation, but I cannot find if that's true or something I just wrongly said. I might need to dig a bit deeper, so I'll comment here if I can find something.

In any case, if you use pipeline script from SCM definition then you could benefit of the linting in your local environment:

james prakash

unread,
Jan 21, 2021, 1:57:56 AM1/21/21
to Jenkins Users
Thanks alot for your help @victor
Reply all
Reply to author
Forward
0 new messages