That is Jenkins pipleine which is a sandboxed Groovy DSL. Most Groovy rules still apply though.

As to your question and not having looked ever at how the DSL has been implemented, then 'scm' is either field called 'scm' or a method called 'getScm()'.

You are right about 'checkout'. It will be a method by the same name. 'checkout(scm)' should achive the same result.

Stuff like stage("checkout") { ... } and dir("some-dir") { ...} are usually just method calls of the format:

    stage(String name, Closure configurator)
    dir(String name, Closure configurator)


On 25/05/2018 15:34, Chris Fouts wrote:
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.

defmainScmDetails

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


--
Schalk W. Cronjé
Twitter / Ello / Toeter : @ysb33r

Reply via email to