It just defines a variable outside the scope of the closure that is passed to stage. This variable is used in that closure.
Erick Nelson Senior Developer – IT HD Supply Facilities Maintenance (858) 740-6523 From: Chris Fouts <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Friday, May 25, 2018 at 6:55 AM To: "[email protected]" <[email protected]> Subject: Re: Help with Groovy syntax Firstly, what does the... def mainScmDetails ...without anything after it mean in Groovy? "stage" defines a Jenkins pipeline stage that I see in my pipeline browser, that is, I see "Checkout" as one of the stages. Chris On Fri, May 25, 2018 at 9:47 AM Nelson, Erick <[email protected]<mailto:[email protected]>> wrote: Looks to me like stage is a method or a closure that takes 2 args. The first is a string, the second is a closure. Erick Nelson Senior Developer – IT HD Supply Facilities Maintenance (858) 740-6523<tel:(858)%20740-6523> From: Chris Fouts <[email protected]<mailto:[email protected]>> Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Date: Friday, May 25, 2018 at 6:35 AM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: Help with Groovy syntax I'm 4 days old new to Groovy. I bought a book, but I just want to learn what this syntax mean for today. We use Groovy to run a Jenkins file in our Jenkins build. One stage has these statements in it. def mainScmDetails stage("Checkout") { mainScmDetails = checkout scm dir("some-dir") { git url: '[email protected]/path/project.git<http://[email protected]/path/project.git>', credentialsId: 'some_creds', branch: 'develop' } } Does this define a code block named mainScmDetails? Does the statement... mainScmDetails = checkout scm ...call two functions, namely, checkout and scm? Thanks, Chris
