I'm developing Jenkins pipelines as Groovy scripts (scripted pipelines, not declarative), and having a real hard time. Jenkins is always very generic regarding syntax/semantic errors, outputting stacks like below:
groovy.lang.MissingPropertyException: No such property: caughtError for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at
So I have to figure where the error is completely by myself, inspecting line per line of code. Is there a better way to debug it? What you guys use to do?
I'm developing Jenkins pipelines as Groovy scripts (scripted pipelines, not declarative), and having a real hard time. Jenkins is always very generic regarding syntax/semantic errors, outputting stacks like below: So I have to figure where the error is completely by myself, inspecting line per line of code.
“Pipeline-as-code” is the idea to allow everyone involved in DevOps to create and maintain Jenkins pipelines. In fact, there are two ways of applying this “pipeline-as-code” principle in life: Scripted and Declarative pipelines. “Pipeline-as-code” allows Jenkins to treat pipelines as regular files.
Where they differ however is in syntax and flexibility. Declarative: Declarative is a more recent and advanced implementation of a pipeline as a code. Scripted: Scripted was the first and traditional implementation of the pipeline as a code in Jenkins. It was designed as a general-purpose DSL (Domain Specific Language) built with Groovy.
Closures, methods and maps are just a few examples of Groovy concepts that Jenkins leverages for its scripted pipeline syntax. While each is only briefly touched upon here, more in-depth detail can be found in the Groovy documentation.
I have seen this post, http://notes.asaleh.net/posts/debugging-jenkins-pipeline/ Which describe how to debug a groovy script for jenkins pipeline. it's clearly describe the steps how to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With