Strange variable scoping behavior in Jenkinsfile

TL;DR variables defined with def in the main script body cannot be accessed from other methods. variables defined without def can be accessed directly by any method even from different scripts. It’s a bad practice. variables defined with def and @Field annotation can be accessed directly from methods defined in the same script. Explanation When … Read more