groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Schalk Cronjé <ysb...@gmail.com>
Subject Re: Help with Groovy syntax
Date Fri, 25 May 2018 13:55:23 GMT
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: 'git@domain.com/path/project.git 
> <http://git@domain.com/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


Mime
View raw message