How do you debug Jenkins pipelines?

2,195 views
Skip to first unread message

Yeikel

unread,
Apr 9, 2020, 2:21:41 PM4/9/20
to jenkins...@googlegroups.com
Besides running the pipeline in a Jenkins instance, is there any other way to validate Jenkins pipelines? I  sometimes see myself running a long pipeline after a refactor to see a runtime exception (like invalid methods)

I imagine that setting breakpoints is wishful thinking, but is it possible?

Thanks!

ch.fetzer

unread,
Apr 9, 2020, 2:48:54 PM4/9/20
to jenkins...@googlegroups.com
In jenkinsfile editor of eclipse I noticed some function to give a jenkinsfile to Jenkins for validation but I did not get this working up to now. 

My method to make it work is tracing currently. 

-------- Ursprüngliche Nachricht --------
Von: Yeikel <yeik...@gmail.com>
Datum: 09.04.20 20:21 (GMT+01:00)
Betreff: How do you debug Jenkins pipelines?

Besides running the pipeline in a Jenkins instance, is there any other way to validate Jenkins pipelines? I  sometimes see myself running a long pipeline after a refactor to see a runtime exception (like invalid methods)

I imagine that setting breakpoints is wishful thinking, but is it possible?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMMhyA1%2Bt%2BiMWiGN72T%2BWh17SwiDxvq3wrL-brzOYfzVwL511Q%40mail.gmail.com.

Yeikel

unread,
Apr 9, 2020, 2:55:10 PM4/9/20
to jenkins...@googlegroups.com
What do you mean with "tracing" ? Running it on an instance?

Christoph Fetzer

unread,
Apr 20, 2020, 7:37:09 AM4/20/20
to Jenkins Users
Sorry for the delay, I've been on vacation.
With tracing I understood adding output to the code that helps you understanding what happens e.g. variable content,....
For sure that's not the most efficient way and in case your pipeline runs for a time it might get boring....

Am Donnerstag, 9. April 2020 20:55:10 UTC+2 schrieb Yeikel:
What do you mean with "tracing" ? Running it on an instance?

On Thu, Apr 9, 2020, 2:48 PM ch.fetzer <ch.f...@gmx.net> wrote:
In jenkinsfile editor of eclipse I noticed some function to give a jenkinsfile to Jenkins for validation but I did not get this working up to now. 

My method to make it work is tracing currently. 

-------- Ursprüngliche Nachricht --------
Von: Yeikel <yeik...@gmail.com>
Datum: 09.04.20 20:21 (GMT+01:00)
Betreff: How do you debug Jenkins pipelines?

Besides running the pipeline in a Jenkins instance, is there any other way to validate Jenkins pipelines? I  sometimes see myself running a long pipeline after a refactor to see a runtime exception (like invalid methods)

I imagine that setting breakpoints is wishful thinking, but is it possible?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.

Jérôme Godbout

unread,
Apr 20, 2020, 9:24:50 AM4/20/20
to jenkins...@googlegroups.com

I have a test project pipeline where I copy my code and test it there, only the part I want to test, avoid the long checkout, I copy the source into the workspace directly. The painfull part is testing with interaction with external server (that actually deploy, AppCenter, Azure, Amazone Cloud, Artifactory…). I need to up a dummy server and test on it while testing my script code.

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/342997a3-17de-4546-a710-4674294258d0%40googlegroups.com.

Nick Stolwijk

unread,
Apr 20, 2020, 10:24:09 AM4/20/20
to jenkins...@googlegroups.com
You can validate your Jenkinsfile by sending it to your Jenkinsserver[1]. There is also a VSCode plugin to send it. [2].


Hth,

Nick Stolwijk

~~~ Try to leave this world a little better than you found it and, when your turn comes to die, you can die happy in feeling that at any rate you have not wasted your time but have done your best ~~~

Lord Baden-Powell


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

Jan Monterrubio

unread,
Apr 20, 2020, 11:26:58 AM4/20/20
to jenkins...@googlegroups.com
You want to be able to do something like this?

image.png



Lee Meador

unread,
Apr 20, 2020, 8:27:42 PM4/20/20
to Jenkins
Here's some links to stuff I found useful. It isn't easy to debug them. 
The addition of println statements here and there is old fashioned but does work however slowly. 
Using the way Jenkins lets you put a part of a script in a test job with the inline editor (when you have a pipeline job without a Jenkinsfile) can help you see how things work with a shorter turnaround. But it only helps sometimes.

https://jenkins.io/doc/book/pipeline/development/ 
 



--
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com

doug liu

unread,
Feb 28, 2024, 5:37:39 PMFeb 28
to Jenkins Users
Exactly! Any guide on this? thanks!
Reply all
Reply to author
Forward
0 new messages