groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: Need help in each loop to run multiple steps
Date Mon, 02 Oct 2017 22:58:05 GMT
I haven't look into the jenkins job DSL any time recently. It might pay to
ask questions about that on their community support channels. Otherwise
including the closure stack trace you spoke of might help. Nothing jumps
out at me as wrong in what you have.

Cheers, Paul.

On Mon, Oct 2, 2017 at 1:41 PM, Sakthivel Subramanian <sakthi.99it@gmail.com
> wrote:

> Hi,
>
> I am trying loop through array values using each and wants to run 2 set of
> operation but when I add it it throws some closure issue (I m pretty new to
> groovy, didn’t get what it meant by). Here is the sample code which I am
> trying. Commented two lines are the one which I want to execute before
> creating pipelineJob.  Can anyone help with the syntax? Or anyother method
> to loop array values and create pipeline job and other script execution.
> Please help.
>
>
>
> create_job.groovy
>
> =================
>
>
> def apps = [
>
>
>    [project:"myproj",repo:"my-test-repo1"],
>
>    [project:"testproj",repo:"my-test-repo2"],
>
>    [project:"myproj",repo:"my-dev-repo"]
>
> ]
>
>
>
> apps.each {
>
>        app ->
>
>
>        //mystashurl = 'mybaseurl+scm/'+app.project+'/' + app.repo + '.git'
>
>        //sh("sed -i.bak -e 's#--GIT_URL--#${mystashurl}#' Jenkinsfile")
>
>
>        pipelineJob('LIB.' + app.repo.replaceAll('-','')) {
>
>        description('Containerized microservice lib config')
>
>
>
>        definition {
>
>         cps
>
>         {
>
>             script(readFileFromWorkspace('Jenkinsfile'))
>
>             sandbox()
>
>         }
>
>     }
>
>
>
>    }
>
> }
>
>
>
>
> Thanks,
>
> Sakthi
>

Mime
View raw message